Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 9236

Re: Problem with join

$
0
0

Hi Marina,

 

You have write different SELECT statements for extracting data from different tables using FOR ALL ENTRIES. After that you have to loop through the item table or header table (as per your requirement) and read the remaining internal tables you have selected and build a final internal table which has all the fields that you require. Please find below an example for using FOR ALL ENTRIES with the SELECT statement:

___________________________

SELECT vbeln

             fkdat

             spart

             fkart

             kunag

             kunrg

             vkorg

             vtweg

             netwr

             sfakn

   FROM vbrk

   INTO TABLE lt_vbrk

WHERE fkdat IN so_fkdat.

 

IF sy-subrc = 0.

 

SELECT vbeln

              posnr

              vkbur

   FROM vbrp

   INTO TABLE lt_vbrp

   FOR ALL ENTRIES IN lt_vbrk

  WHERE vbeln = lt_vbrk-vbeln.

 

ENDIF.

___________________________

 

If you notice the second select, you can understand that the fields selected contains the KEY fields of the table along with the fields that you actually need from the table. Similarly you to write the SELECT from tables TVKBT, TSPAT and KNA1 also using the FOR ALL ENTRIES IN statement. And also one final internal table which contains only the necessary fields(fields that you are selected using the SELECT mentioned in original post of yours. So in total you would need 6 internal tables.

 

Regards,

Rahul MB


Viewing all articles
Browse latest Browse all 9236

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>