2007 Sep 04 7:00 AM
hi experts, i have written the following code.
itab contains the data including budat.my requirement is
i need to pick the budat from the itab which should be the most recent date with satisfying the below condition. i dont want to read from table once more, bcoz already read and stored in itab.
how can i solve this, pls help me.
loop at it_final.
read table itab with key kdauf = it_final-kdauf kdpos = it_final-kdpos.
if sy-subrc = 0.
it_final-budat = itab-budat.
modify it_final.
endif.
endloop.
Thanks in advance.
Regards
Rajaram
2007 Sep 04 7:04 AM
sort itab by KDAUF descending.
loop at it_final.
loop at itab where kdauf = it_final-kdauf and kdpos = it_final-kdpos.
it_final-budat = itab-budat.
modify it_final.
exit.
endloop.
endloop.
hi experts, i have written the following code.
itab contains the data including budat.my requirement is
i need to pick the budat from the itab which should be the most recent date with satisfying the below condition. i dont want to read from table once more, bcoz already read and stored in itab.
how can i solve this, pls help me.
loop at it_final.
read table itab with key kdauf = it_final-kdauf kdpos = it_final-kdpos.
if sy-subrc = 0.
it_final-budat = itab-budat.
modify it_final.
endif.
endloop.
Thanks in advance.
Regards
Rajaram
2007 Sep 04 7:04 AM
sort itab by KDAUF descending.
loop at it_final.
loop at itab where kdauf = it_final-kdauf and kdpos = it_final-kdpos.
it_final-budat = itab-budat.
modify it_final.
exit.
endloop.
endloop.
2007 Sep 04 7:07 AM
Hi Rajaram..
This is the correct code: Try it..
Note: Since the Itab is sorted based on Descending order on BUDAT it will give the Most recent date first.
Code:
Sort itab by kdauf kdpos budat descending. "Here only budat is descending
loop at it_final.
read table itab with key kdauf = it_final-kdauf kdpos = it_final-kdpos
transporting budat
binary search.
if sy-subrc = 0.
it_final-budat = itab-budat.
modify it_final.
endif.
endloop.
<b>reward if Helpful.</b>
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |