Probably you don't need to use temporary table, you can use simple SELECT query. If the data are stored in two different tables, like
Document
and
Document_Details
and they are related by
Doc_No
, you can use something like this:
SELECT D.Doc_No, DD.Material, DD.Quantity
FROM Document AS D
LEFT JOIN Document_Details AS DD ON D.Doc_No = DD.Doc_No
But if you need it:
CREATE TABLE #tt (Doc_No INT, Material NVARCHAR(300), Quantity INT)
INSERT INTO #tt (Doc_No, Material, Quantity)
SELECT D.Doc_No, DD.Material, DD.Quantity
FROM Document AS D
LEFT JOIN Document_Details AS DD ON D.Doc_No = DD.Doc_No
SELECT *
FROM #tt
DROP TABLE #tt