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

query

Former Member
0 Likes
697

hi all

thanks to this forum which has solved many of my queries.

thanks to all who have helped me.

my query is

in the report output, i have 5 columns for quantity field defining the sum of quantities of purchase orders in the month of jan, feb, mar, apr,may. the quantity field is taken from s012-wemgm. how can i get the sum of all the materials purchased in the month of jan in a single field( say wemgm1 for s012-wemgm), for the month of feb in wemgm2 like s012-wemgm.can anybody help me in getting the idea for this. i wil grateful to them.

do i need to take all these fields wemgm1....wemgm5 in an internal table

loop at itab

do_sum

or

do i need to take a counter?

pls help me

thanks in advance

5 REPLIES 5
Read only

Former Member
0 Likes
662

Hi,

Yes..You can loop at the internal table and sum all the fields wemgm1..wemgm5..

Example

-


LOOP AT itab.

itab-final_amount = itab-wemgm1 + itab-wemgm2 + itab-wemgm3

itab-wemgm4 + itab-wemgm5.

modify itab transporting final_amount.

ENDLOOP.

THanks,

Naren

Read only

Former Member
0 Likes
662

Hi,

Since u need 5 coloumns u have to take 5 fields like menge1 to 5.

Then u retrieve the data into Internal table by select statement.

then u loop it like.

Loop at Itab.

At end of Menge

Sum.

wirte: / 'Total Quantity'.

Endat.

endloop.

If hels pls award points.

Thanks,

Radha.

Read only

0 Likes
662

hi radha

thanks for the reply

i am totally new to abap.

can i have a more specific idea pls

if i use this code then will i get the sum of the particular column at the end?

according to the requirement what i need is.......

quantity is taken s012-wemgm, in the output display ineed 5 fields for wemgm like s012-wemgm.

wemgm1= sum of po amount in month 1

wemgm2= sum of po amount in month 2 like wise..

how can i achieve this?

thanks in advance

l

Read only

former_member582701
Contributor
0 Likes
662

Yes, i think u need five counters. One for every month.

Loop at it.

v_wemgn1 = v_wemgn1 + it-wemgn1.

v_wemgn2 = v_wemgn2 + it-wemgn2.

.

.

.

endloop.

Read only

0 Likes
662

hi

i appreciate the response

can i have a more specific idea pls

thanks

in advance