‎2009 Sep 29 6:32 PM
Dear friends,
Tables : J_1iexcdtl, j_1igrxsub.
exnum exyear matnr zeile exc_zeile mblnr
90005 2009 AA 01 01 4500001
4500002
90005 2009 AB 02 02
90005 2009 AC 03 03 4500007
4500008 This is the final output I need.But I am getting below output.
exnum exyear matnr zeile exc_zeile mblnr
90005 2009 AA 01 01 4500001
4500002
90005 2009 AC 03 03 4500007
4500008 select * from J_1iexcdtl into corresponding fields of table it_exe
where exnum in s_exnum and exyear in s_exyear. if not it_exe[] is initial.
select * from j_1igrxsub into corresponding fields of table it_sub
for all entries in it_exe where exnum = it_exe-exnum and mjahr = it_exe-exyear.
endif..
loop at it_exe into wa_exe.
loop at it_sub into wa_sub where exnum = wa_exnum
and exc_zeile = wa_exe-zeile.
move-corresponding wa_exe to wa_final.
move : wa_sub-mblnr to wa_final-mblnr.
append wa_final to it_final.
clear : wa_exe,wa_sub.
endloop.
endloop.please suggest some idea.
Regards,
Bathri
Edited by: Bathrinath Sankaranarayanan on Sep 30, 2009 1:33 AM
Edited by: Bathrinath Sankaranarayanan on Sep 30, 2009 1:36 AM
‎2009 Sep 29 6:37 PM
Hi,
Try like this
loop at it_exe into wa_exe.
move-corresponding wa_exe to wa_final.
read table it_sub into wa_sub with key exnum = wa_exnum
and exc_zeile = wa_exe-zeile.
if sy-subrc = 0.
move : wa_sub-mblnr to wa_final-mblnr.
endif.
append wa_final to it_final.
clear: wa_exe,wa_sub.
endloop.
Instead of nested loops use read to increase performance
or if you have M:M relation between the internal tables, use nested loops as its unavoidable
loop at it_exe into wa_exe.
move-corresponding wa_exe to wa_final.
loop at it_sub into wa_sub where exnum = wa_exnum
and exc_zeile = wa_exe-zeile.
move : wa_sub-mblnr to wa_final-mblnr.
append wa_final to it_final.
clear: wa_exe,wa_sub.
endloop.
endloop.
Regards,
Vikranth
Edited by: Vikranth.Reddy on Sep 29, 2009 11:11 PM
‎2009 Sep 29 6:37 PM
Hi,
Try like this
loop at it_exe into wa_exe.
move-corresponding wa_exe to wa_final.
read table it_sub into wa_sub with key exnum = wa_exnum
and exc_zeile = wa_exe-zeile.
if sy-subrc = 0.
move : wa_sub-mblnr to wa_final-mblnr.
endif.
append wa_final to it_final.
clear: wa_exe,wa_sub.
endloop.
Instead of nested loops use read to increase performance
or if you have M:M relation between the internal tables, use nested loops as its unavoidable
loop at it_exe into wa_exe.
move-corresponding wa_exe to wa_final.
loop at it_sub into wa_sub where exnum = wa_exnum
and exc_zeile = wa_exe-zeile.
move : wa_sub-mblnr to wa_final-mblnr.
append wa_final to it_final.
clear: wa_exe,wa_sub.
endloop.
endloop.
Regards,
Vikranth
Edited by: Vikranth.Reddy on Sep 29, 2009 11:11 PM
‎2009 Sep 29 7:07 PM
Dear Vikranth,
This is the second tabix.
exnum exyear matnr zeile exc_zeile
90005 2009 AB 02 SPACE
Sorry in the original I couldnt able to edit.
In the second table there is no exc_zeile .
But I want to display the material.
Please Tell some idea.
‎2009 Sep 29 7:36 PM
Hi,
Then remove just that condition in the second loop and try
loop at it_exe into wa_exe.
move-corresponding wa_exe to wa_final.
loop at it_sub into wa_sub where exnum = wa_exnum. "remove where on exc_zeile
move : wa_sub-mblnr to wa_final-mblnr.
append wa_final to it_final.
clear: wa_exe,wa_sub.
endloop.
endloop.
Regards,
Vikranth