Quantcast
Channel: SCN : All Content - ABAP Development
Viewing all articles
Browse latest Browse all 8332

Unable to exit on change , at new of new field

$
0
0

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                                                                                      

COSTOBJECTGCTBILL
8104562014005

                      

it_final expected :                     

COSTOBJECTGCTBILL
8104562014005
8107892014005
9101232014005
9104562014005
9107892014005
9108522014005

Viewing all articles
Browse latest Browse all 8332

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>