‎2009 Feb 13 12:10 PM
Hi,
How can i join a table with an internal table in Sap Query?
i have a base table (aufk) and i will be creating an internal table with code in an infoset. Then i need to join the internal table with aufk.
Thanks,
‎2009 Feb 13 1:24 PM
Hi Alper,
Here is the sample code for inner join.
SELECT mara~matnr
marc~werks
INTO TABLE t_material
FROM mara AS mara INNER JOIN marc AS marc
ON maramatnr = marcmatnr
WHERE mara~mtart = p_mtart.
here instead of a standard table use your internal table.
Hope it helps!
Much Regards,
Amuktha.
‎2009 Feb 13 12:14 PM
SELECT *
FROM AUFK
INTO TABLE i_aufk
FOR ALL ENTRIES IN i_itab
WHERE field = i_itab-field.
‎2009 Feb 13 12:18 PM
Can you give more details?
i created an infoset with just aufk.
then where will i put this code? in additional fields? or where?
Thanks.
‎2009 Feb 13 12:19 PM
Hi Alper
[Table Joins|http://help.sap.com/saphelp_nw04/helpdata/EN/50/a71ec8f65911d296390000e82de14a/content.htm]
Regards,
Sravanthi
‎2009 Feb 13 1:24 PM
Hi Alper,
Here is the sample code for inner join.
SELECT mara~matnr
marc~werks
INTO TABLE t_material
FROM mara AS mara INNER JOIN marc AS marc
ON maramatnr = marcmatnr
WHERE mara~mtart = p_mtart.
here instead of a standard table use your internal table.
Hope it helps!
Much Regards,
Amuktha.
‎2009 Feb 13 4:22 PM
i was thinking about doing this on sq01 sap query,
from what you wrote i should understand that i need to create a seperate program for this?
‎2009 Feb 13 9:43 PM
Yes. sq01 is made to help querying out database tables, not doing some "complex" abap. In SQ01, can't you query a DB table instead of creating an internal table?
‎2009 Feb 14 6:43 AM
what i have is :
order no
1
2
order no---material no--reserved amount--
1--
1--
2--
order no-material no
1--
1--
2--
with these 3 tables, i want to get :
order no-material no
1--
1--
1--
2--
as you can see material numbers are unique lists for that order both from reservations and consumes.
Any hope?
Alper,
‎2009 Feb 14 3:03 PM
Thank you for the details, it's clear : I don't see how it can be done in only one query, so I guess you'd better create an abap program.