03-18-2008 5:32 AM
hi guru,
i developed a report.
IF S_BGPRO = 'X'.
SELECT AUFNR GMNGA FROM
AFRU INTO CORRESPONDING FIELDS OF TABLE IT_AFRU12 WHERE WERKS = 'PD01'
AND BUDAT IN S_BUDAT.
IF NOT IT_AFRU12[] IS INITIAL.
SELECT AUFNR KTEXT PLNBEZ INTO CORRESPONDING FIELDS OF
TABLE IT_CAUFV1 FROM CAUFV
FOR ALL ENTRIES IN IT_AFRU12
WHERE AUFNR = IT_AFRU12-AUFNR.
IF SY-SUBRC 0.
MESSAGE E000(ZPP) WITH 'VALUE NOT EXISTING '.
ENDIF.
ENDIF.
ENDIF.
LOOP AT IT_AFRU12 INTO WA_AFRU12.
LOOP AT IT_CAUFV1 INTO WA_CAUFV1 WHERE AUFNR = WA_AFRU12-AUFNR.
WA_AFRU12-KTEXT = WA_CAUFV1-KTEXT.
WA_AFRU12-PLNBEZ = WA_CAUFV1-PLNBEZ.
MODIFY IT_AFRU12 FROM WA_AFRU12.
ENDLOOP.
ENDLOOP.
IN THE ABOVE COADING :
GMNGA value is in numbers . i want to add all the no.s and
displayed to last in my alv report.how to do this..
please help me.
thanks
03-18-2008 5:55 AM
Hi,
Try adding the field "GMNGA" at the end of your internal table data and define the field catalog for the fields of the report.
it should work accordingly.
Please do the above step and let me know whether it has worked for you or not.
Thanks,
Vishnu.
03-18-2008 5:55 AM
Hi,
Try adding the field "GMNGA" at the end of your internal table data and define the field catalog for the fields of the report.
it should work accordingly.
Please do the above step and let me know whether it has worked for you or not.
Thanks,
Vishnu.
03-18-2008 7:14 AM
Use a variable sum and initialize it to 0.
then add the contents of gmnga to it and then display the sum at the end in ur ALV report
SELECT AUFNR GMNGA FROM
AFRU INTO CORRESPONDING FIELDS OF TABLE IT_AFRU12 WHERE WERKS = 'PD01'
AND BUDAT IN S_BUDAT.
IF NOT IT_AFRU12[] IS INITIAL.
SELECT AUFNR KTEXT PLNBEZ INTO CORRESPONDING FIELDS OF
TABLE IT_CAUFV1 FROM CAUFV
FOR ALL ENTRIES IN IT_AFRU12
WHERE AUFNR = IT_AFRU12-AUFNR.
IF SY-SUBRC 0.
MESSAGE E000(ZPP) WITH 'VALUE NOT EXISTING '.
ENDIF.
ENDIF.
ENDIF.
LOOP AT IT_AFRU12 INTO WA_AFRU12.
sum = sum + WA_AFRU12-gmnga
LOOP AT IT_CAUFV1 INTO WA_CAUFV1 WHERE AUFNR = WA_AFRU12-AUFNR.
WA_AFRU12-KTEXT = WA_CAUFV1-KTEXT.
WA_AFRU12-PLNBEZ = WA_CAUFV1-PLNBEZ.
MODIFY IT_AFRU12 FROM WA_AFRU12.
ENDLOOP.
ENDLOOP.