Hi Techies ,
i have a requirement where need to collect all my latest dates's records and place in another table.
types :
begin of ty_tab ,
costobject type char20,
gctbill type char7
end of ty_tab.
data : it_tab type table of ty_tab,
wa_tab type ty_tab,
it_final type table of ty_tab,
wa_final type ty_tab.
i have 10 records in it_tab (snapshot of records attached).
i want to collect the latest records and place them in another table it_final.
so am doing following :
sort it_tab descending by gctbill . "to get latest
loop at it_tab into wa_tab .
AT NEW GCTBILL . "used on change also
EXIT.
ENDAT.
append wa_tab to it_final . "filling the final table with the latest records.
endloop.
contents of it_final expected : i thought at new GCTBILL it would exit , but it is not , instead it is reading only first record and coming out of loop.
, so after , the it_final has only one record .
it_final
COSTOBJECT | GCTBILL |
810456 | 2014005 |
it_final expected :
COSTOBJECT | GCTBILL |
810456 | 2014005 |
810789 | 2014005 |
910123 | 2014005 |
910456 | 2014005 |
910789 | 2014005 |
910852 | 2014005 |