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.
Select * from ekpo into table it_ekpo for all entries in it_ekko where ebeln = it_ekko-ebeln.
Select * from lfai into table it_lfa1 for all entries in it_ekko where lifnr = it_ekko-lifnr.
Select * from t005t into table it_t005t for all entries in it_lfa1 where land1 = it_lfa1-land1.
Select * from tvzbt into tablt it_tvzbt for all entries in it_ekko where zterm = it_ekko-zterm.
Select * from eket into table it_eket for all entires in it_ekko where ebeln = it_ekko-ebeln.
Select * from esuh into table it_esuh for all entries in it_ekpo where packno = .it_ekpo-packno
Now coming to your loop statements, the conditions for read statemntare not exactly right.
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.
" The main mistake in read statement is that you cannot use wa_lfa1 in your condition since the values will be in that only after the read statement. So also for all the other read statements.
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.
clear : wa_itab, wa_ekko, wa_ekpo, wa_t005t,wa_tvzbt, wa_eket, wa_esuh, wa_lfa1.
Endloop.
Endloop.
Now the table itab will contain the required data to be passed to ALV display.