Application Development 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: 

sumarize

Former Member
0 Kudos

hi experts

i am running a loop on a table and i want to use the command sum but my process block is defined by to attributes.

how can i do this

thanks

amit

1 ACCEPTED SOLUTION

karol_seman
Active Participant
0 Kudos

Hi Amit,

I'm not sure if I understand "attributes" correctly.

But did you try to use command "at new <field>" and in this block do the summation?

Otherwise please provide the code ...

Regards,

Karol

3 REPLIES 3

karol_seman
Active Participant
0 Kudos

Hi Amit,

I'm not sure if I understand "attributes" correctly.

But did you try to use command "at new <field>" and in this block do the summation?

Otherwise please provide the code ...

Regards,

Karol

0 Kudos

here is the code attached:

SORT i_data by lifnr grund.

LOOP at i_data INTO wa_data.

if i_data-shkzg = 'H'.

i_data-erfmg = i_data-erfmg * -1.

modify i_data.

ENDIF.

at END OF lifnr .

at END OF grund.

SUM.

ENDAT.

ENDAT.

ENDLOOP.

i want to summary according those two attributes but the command doesn't work

thanks

amit

0 Kudos

SORT i_data by lifnr grund.

LOOP at i_data INTO wa_data.
if i_data-shkzg = 'H'.
i_data-erfmg = i_data-erfmg * -1.
modify i_data.
ENDIF.
AT END OF grund.
SUM.
WRITE: / wa_data-lifnr, wa_data-grund.
ENDAT.
ENDLOOP.

the table is already sorted by lifnr and grund so you don't need nested "AT"

sum supports types I , F and P, make sure you have this data type there