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

Problem with control break event

Former Member
0 Likes
380

Hi All,

I had a problem with control break events with dynamic internal table .

it is not allowing the SUM in the follwing block of code.

is there any other option to sum the records.

LOOP AT <dyn_table> INTO <dyn_wa>.

AT END OF <f1>.

  • SUM.

ENDAT.

ENDLOOP.

Thanks

Venkat

1 ACCEPTED SOLUTION
Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
347

Hello,

Try this workaround:


  DATA: lv_sum       TYPE p DECIMALS 2,
        lv_fieldname TYPE fieldname.

* Field on which you want to use the control-break operations
  lv_fieldname = 'WRBTR'.

  LOOP AT <itab> INTO <wa>.
    ASSIGN COMPONENT lv_fieldname OF STRUCTURE <wa> TO <val>.
    IF sy-subrc = 0.
      lv_sum = lv_sum + <val>.
    ENDIF.
    AT END OF (lv_fieldname).
      WRITE: / lv_sum. CLEAR lv_sum. "Initialize the added value
    ENDAT.
  ENDLOOP.

BR,

Suhas

1 REPLY 1
Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
348

Hello,

Try this workaround:


  DATA: lv_sum       TYPE p DECIMALS 2,
        lv_fieldname TYPE fieldname.

* Field on which you want to use the control-break operations
  lv_fieldname = 'WRBTR'.

  LOOP AT <itab> INTO <wa>.
    ASSIGN COMPONENT lv_fieldname OF STRUCTURE <wa> TO <val>.
    IF sy-subrc = 0.
      lv_sum = lv_sum + <val>.
    ENDIF.
    AT END OF (lv_fieldname).
      WRITE: / lv_sum. CLEAR lv_sum. "Initialize the added value
    ENDAT.
  ENDLOOP.

BR,

Suhas