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

Re: Loop Condition through multiple tables ....

$
0
0

Hi ManiGandan,

 

I think there is somthing wrong in your code.

 

First declare an internal table containing all the fields required for passing to the ALV display.

 

types: begin of out_type,

ebeln like ekko-ebeln,

lifnr like lfa1-lifnr,

name1 like lfa1-name1,

land1 like lfa1-land1,

landx like t005t-landx,

zterm like ekko-zterm,

vtext like tvzbt-vtext,

       eindt like eket-eindt,

       packno like ekpo-packno,

       commitment like esuh-commitment,

*Add any other field that is required.

end of out_type.

 

Data :itab like table of out_type,

         Wa_itab like line of itab.

 

*Read data into internal tables It_ekko, it_ekpo, it_lfa1, it_t005t, it_tzvbt, it_eket, it_esuh from the corresponding database tables with required selection criteria.

 

For that use the select statements select * from ekko into table it_ekko where <condition>. Similarly for all other tables.

 

LOOP AT  it_ekko into wa_ekko.

         LOOP AT it_ekpo into wa_ekpo WHERE ebeln = wa_ekko-ebeln.

         wa_itab-ebeln = ekko-ebeln.

        Wa_itab-lifnr = ekko-lifnr.

 

          READ TABLE it_lfa1 INTO wa_lfa1 with KEY lifnr = wa_ekko-lifnr. 

          Wa_itab name1 = wa_lfa1-name1.

 

          READ TABLE it_t005t INTO wa_t005t with KEY land1 = spras = sy-langu  wa_lfa1-land1 .

          Wa_itba- landx = wa_t005t-landx.

       

       READ TABLE it_tvzbt INTO wa_tvzbt with KEY spras = sy-langu zterm = wa_ekko-zterm.

          wa_itab-zterm = wa_ekko-zterm.

          wa_itab-vtext = wa_tvzbt-vtext.

 

          READ TABLE it_eket INTO wa_eket with KEY ebeln = wa_ekko-ebeln and ebelp = wa_ekko-ebelp.

          wa_itab-eindt = wa_eket-eindt.

         

          READ TABLE it_esuh INTO wa_esuh with KEY packno = wa_ekpo-packno.

          wa_itab- wa_ekpo-packno.

          wa_itab- commitment = wa_esuh-commitment.

        

          append wa_itab into itab.

Endloop.

Endloop.

  

  Now the table itab will contain the required data to be passed to ALV display.


Viewing all articles
Browse latest Browse all 8499

Trending Articles



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