Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

help me

Former Member
0 Likes
678

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
566

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

2 REPLIES 2
Read only

Former Member
0 Likes
567

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.

Read only

varma_narayana
Active Contributor
0 Likes
566

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>