‎2008 Jan 09 12:39 PM
The report take input as range of materials and shows subtotal of the stock for each storage location and grand total of the stock at the end of the plant.
‎2008 Jan 10 11:29 AM
Hi,
Here you can use Control Break Statements:
1.At First
2.At New
3.At End
4.At last.
3.At End is going to trigger at the end of a new value of a particular fields.
It is used for subtotals.
4.At Last is going to trigger at the last loop of the internal table.
It is used for finding grand totals.
but these control break statements must be used within the loop itself.
Bye.
‎2008 Jan 10 11:43 AM
Hi,
i can give one classical example,it prints the totals and subtotals.
change this to as ur requirement by adding the input fields and where condition in select statement.
DATA: BEGIN OF ITAB OCCURS 0,
BUKRS LIKE LFC1-BUKRS,
UM01H LIKE LFC1-UM01H,
UM01U LIKE LFC1-UM01U,
END OF ITAB.
SELECT BUKRS UM01H UM01U INTO TABLE ITAB FROM LFC1.
SORT ITAB BY BUKRS.
LOOP AT ITAB.
WRITE:/ ITAB-BUKRS,7 ITAB-UM01H,ITAB-UM01U.
AT END OF BUKRS.
SUM.
WRITE:/ ITAB-BUKRS COLOR 7,7 ITAB-UM01H COLOR 7,ITAB-UM01U COLOR 7.
ENDAT.
AT LAST.
SUM.
WRITE:/ TOTAL COLOR 3,ITAB-UM01H COLOR 1,ITAB-UM01U COLOR 1.
ENDAT.
ENDLOOP.
reward points,if it is useful.
Thanks,
chandu.
‎2008 Jan 10 11:56 AM
check this code....
TABLES mard.
SELECT-OPTIONS: s_matnr FOR mard-matnr.
DATA : itab LIKE STANDARD TABLE OF mard WITH HEADER LINE.
SELECT matnr lgort labst INTO CORRESPONDING FIELDS OF
itab FROM mard WHERE matnr IN s_matnr.
COLLECT itab.
ENDSELECT.
SORT itab BY matnr lgort.
LOOP AT itab.
WRITE :/ itab-matnr, itab-lgort, itab-labst DECIMALS 0.
AT LAST.
SUM.
ULINE /(50).
WRITE :/ 'GRAND TOTAL ', itab-labst DECIMALS 0.
ENDAT.
ENDLOOP.