Skip to Content
0
Former Member
Apr 10, 2008 at 05:48 AM

retrieving sum of all line items

27 Views

Hi,

i want to retrieve the sum of LABST field for all line lineitems for a given material No in MARD table.when i wrote the following statement

TYPES : BEGIN OF TY_Mard,

MATNR TYPE MARD-MATNR,

LABST TYPE MARD-LABST,

END OF TY_MARD.

data :T_MARD TYPE TABLE OF TY_MARD,

w_MARD TYPE TY_MARD.

SELECT MATNR

SUM( LABST) INTO TABLE T_MARD

FROM MARD FOR ALL ENTRIES IN T_INPUT1 WHERE MATNR = T_INPUT1-MATNR

AND WERKS = P_RESWK .

it's giving me error as 'SUM' cannnot be used with 'for all entries'. if i remove 'sum' its picking the value(LABST) of 1st line item only,i want the sum(LABST) of all line items for a given material no and should be placed in the internal table .Please help.

Thanks and regards,

k srinivas