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

Re: Summarization In an Internal table- Smartforms

$
0
0

Hi Lokeshwari,

 

I hope you got the answer

 

If not you can try this code below, it will work i have checked

 

Do the following steps before you use the code,

 

Make the field matnr (Whichever field you want to use as a condition for summarization) as first field in your structure,

 

Also create one extra internal table as final which will hold your summarized value and use that table to display.

 

Define other data as we used in the code,

 

after that use the code below,

 

   LOOP AT it_item1 INTO wa_item1.

  AT NEW matnr.     

    G_flag1 = 1.
  ENDAT.

 


  IF G_flag1 is NOT INITIAL.
    wa_final-item     = wa_item1-item.
    wa_final-desc    = wa_item1-item.
  CLEAR G_flag1.
  ENDIF.

 

    wa_final-qty         =  wa_final-qty+ wa_item1-qty.
    wa_final-intvalue1 gwa_final-intvalue1+  gwa_item1-intvalue1.
    wa_final-intvalue2 gwa_final-intvalue2+  gwa_item1-intvalue2.
    wa_final-intvalue3 gwa_final-intvalue3+  gwa_item1-intvalue3.


at END OF matnr.
   G_flag2 = 1.
   ENDAT.


   IF G_flag2 is NOT INITIAL.
     APPEND wa_final TO it_final.
    CLEAR wa_final.
    CLEAR G_flag2.
   ENDIF.


ENDLOOP.

 

 

" Am using Flag value inside "at new" and "at end of" because variables will be holding only junk value inside these control break statements.

 

Hope you got this logic, Please get back if you have any issues in understanding the code

 

Thanks,

Satish


Viewing all articles
Browse latest Browse all 10519

Trending Articles



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