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

Sum in write statement / Urgent

Former Member
0 Likes
493

hi all ,

i have some fields in write statement o/p like NETWR , MWSBP... and i want to

take total (Sum of all NETWR & MWSBP) net value at end of output coloum..

how can i do in write statement.??

exa : NETWR MWSBP

100.00 25.00

50.00 10.00

-


-


<b>SUM 150.00 35.00</b>

can anybody help me its urgent .

regards saurabh .

hi all ,

i have some fields in write statement o/p like NETWR , MWSBP... and i want to

take total (Sum of all NETWR & MWSBP) net value at end of output coloum..

how can i do in write statement.??

exa : NETWR MWSBP

100.00 25.00

50.00 10.00

-


-


<b>SUM 150.00 35.00</b>

can anybody help me its urgent .

regards saurabh .

3 REPLIES 3
Read only

Former Member
0 Likes
472

Hi use SUM, inside the loop.

Loop at itab.

at end of vbeln.

sum.

endat.

endloop.

or

data: tot_netwr type netwr.

loop at itab.

tot_netwr = tot_netwr + itab-netwr.

endloop.

write : / tot_netwr.

Read only

former_member386202
Active Contributor
0 Likes
472

Hi,

Use control statement

Loop at itab.

at last.

sum.

write 😕

endloop.

Reagrds,

Prashant

Read only

Former Member
0 Likes
472

Hi,

I hopr the example code below will help you:

DATA: BEGIN OF LUGGAGE,

AVERAGE TYPE P DECIMALS 2,

SUM TYPE P DECIMALS 2,

END OF LUGGAGE.

SELECT AVG( LUGGWEIGHT ) AS AVERAGE SUM( LUGGWEIGHT ) AS SUM

INTO CORRESPONDING FIELDS OF LUGGAGE

FROM SBOOK.

WRITE: / 'Average:', LUGGAGE-AVERAGE,

/ 'Sum :', LUGGAGE-SUM.

Please award points if found useful.

Cheers,

Chandra Sekhar.