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

sumarize

Former Member
0 Likes
947

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
Read only

karol_seman
Active Participant
0 Likes
873

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
Read only

karol_seman
Active Participant
0 Likes
874

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

Read only

0 Likes
873

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

Read only

0 Likes
873

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