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: 

Regarding :to sum the field value of a segment

Former Member
0 Kudos
121

I have on requirement. in tht based on the condition . i have to sum the quantity field of one segment.

here e1edp01 is a segment which stores item level values.

in e1edp01 there is one field menge.

if my condition satisfies

i have to sum all the e1edp01-menge values for the given material.

e1edp01 is also having matnr.so for one matnr i have more than one quantites.

so PLz tell me how to sum the menge field values in tht segment

thanks in advance

pavan

1 ACCEPTED SOLUTION

Former Member
0 Kudos
67

Hi Pavan,

Try this way :

parameters :
  p_matnr like E1EDP01-matnr.

Data :
  w_total type p decimals 2,
  t_tab like standard table of E1EDP01,
  fs_tab like line of t_tab.

select MENGE
          MATNR
  from E1EDP01
  into table t_tab
 where matnr eq p_matnr.

loop at t_tab into fs_tab.

    if < your condition >.

        w_total = w_total + fs_tab-MENGE.

    endif.

endloop.

 write 😕 w_total.

Regards,

Swapna.

1 REPLY 1

Former Member
0 Kudos
68

Hi Pavan,

Try this way :

parameters :
  p_matnr like E1EDP01-matnr.

Data :
  w_total type p decimals 2,
  t_tab like standard table of E1EDP01,
  fs_tab like line of t_tab.

select MENGE
          MATNR
  from E1EDP01
  into table t_tab
 where matnr eq p_matnr.

loop at t_tab into fs_tab.

    if < your condition >.

        w_total = w_total + fs_tab-MENGE.

    endif.

endloop.

 write 😕 w_total.

Regards,

Swapna.