Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 9110

Re: issue regarding collect statement

$
0
0

FORM test_07 .

   TYPES: BEGIN OF tp_sbook_1 .

   TYPES: carrid      TYPE sbook-carrid ,
          luggweight  TYPE sbook-luggweight ,
          luggweighc  TYPE string ,
          luggweighs  TYPE p DECIMALS 4 ,
          count       TYPE i .
   TYPES: END OF tp_sbook_1 .

   DATA: it_sbook TYPE TABLE OF sbook .

   SELECT * INTO TABLE it_sbook
   FROM sbook .

   FIELD-SYMBOLS:  <st_sbook> LIKE LINE OF it_sbook .

   DATA: it_sbook_1 TYPE TABLE OF tp_sbook_1 .
   DATA: st_sbook_1 LIKE LINE OF it_sbook_1 .

   LOOP AT it_sbook ASSIGNING <st_sbook> .

     MOVE-CORRESPONDING <st_sbook> TO st_sbook_1 .

     st_sbook_1-luggweighc = st_sbook_1-luggweighs = <st_sbook>-luggweight .

     st_sbook_1-count = 1 .

     COLLECT st_sbook_1 INTO it_sbook_1 .

   ENDLOOP .

   FIELD-SYMBOLS: <st_sbook_1> LIKE LINE OF it_sbook_1 .

   LOOP AT it_sbook_1 ASSIGNING <st_sbook_1> .
     <st_sbook_1>-luggweight = <st_sbook_1>-luggweight / <st_sbook_1>-count .
   ENDLOOP.

   BREAK-POINT .

ENDFORM.


look at   it_sbook_1 .


regards.                                      


Viewing all articles
Browse latest Browse all 9110

Trending Articles



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