2007 Jun 01 8:35 PM
Hello All,
I need to Create a report which will give the existing stock for a material. The report should have the sub total of the stock for each storage location and grand total of the stock at the end of the plant.can someone tell how to display each Plant data at a new page.
thanks in advance,
seenu SAP
2007 Jun 01 9:11 PM
Hi,
Try this sample code..
DATA: BEGIN OF WA,
WERKS TYPE WERKS_D,
LGORT TYPE MARD-LGORT,
MATNR TYPE MATNR,
MENGE TYPE EKPO-MENGE,
END OF WA.
DATA: T_DATA LIKE TABLE OF WA.
* Assuming the data is filled in teh internal table T_DATA.
SORT T_DATA BY WERKS LGORT.
LOOP AT T_DATA INTO WA.
* Display the details.
WRITE: / WA-MATNR, WA-WERKS, WA-LGORT, WA-MENGE.
AT NEW WERKS.
* Display in a new page.
NEW-PAGE.
ENDAT.
AT END OF LGORT.
* Display the Storage location level total.
SUM.
WRITE: / WA-MENGE.
ENDAT.
AT END OF WERKS.
* Display the plant level total.
SUM.
WRITE: / WA-MENGE.
ENDAT.
ENDLOOP.
Thanks,
Naren
Hello All,
I need to Create a report which will give the existing stock for a material. The report should have the sub total of the stock for each storage location and grand total of the stock at the end of the plant.can someone tell how to display each Plant data at a new page.
thanks in advance,
seenu SAP
2007 Jun 01 9:06 PM
Research the following statements, which will provide you with a good idea of how to do this:
AT FIRST
ENDAT
NEW-PAGE
See the following for a good example of how to do this:
http://help.sap.com/saphelp_nw2004s/helpdata/en/9f/db9f3935c111d1829f0000e829fbfe/content.htm
Thanks,
John
2007 Jun 01 9:10 PM
See the below example code to get sub totals and totals
&----
*& Report ZTEST_IEVENTS
*&
&----
*&
*&
&----
REPORT ZTEST_IEVENTS no standard page heading
line-count 40(2).
tables : vbap.
data : begin of i_vbap occurs 0,
vbeln like vbap-vbeln,
posnr like vbap-posnr,
matnr like vbap-matnr,
kwmeng like vbap-kwmeng,
netpr like vbap-netpr,
end of i_vbap.
data wa_vbap like line of i_vbap.
data v_flag type c.
select-options s_vbeln for vbap-vbeln obligatory.
start-of-selection.
select vbeln
posnr
matnr
kwmeng
netpr from vbap
into table i_vbap
where vbeln in s_vbeln.
sort i_vbap by vbeln posnr.
end-of-selection.
loop at i_vbap.
move i_vbap to wa_vbap.
at first.
write:/2 'Order #',15 'Item #',28 'Material #',50 'Qty', 70 'Net value'.
skip 1.
endat.
at new vbeln.
write:/2 wa_vbap-vbeln,15 wa_vbap-posnr,28 wa_vbap-matnr,
47 wa_vbap-kwmeng,65 wa_vbap-netpr.
v_flag = 'X'.
endat.
if v_flag ne 'X'.
write:/15 wa_vbap-posnr,28 wa_vbap-matnr,
47 wa_vbap-kwmeng,65 wa_vbap-netpr.
endif.
at end of vbeln.
sum.
skip 1.
write:/5 'Sub totals', 47 i_vbap-kwmeng,65 i_vbap-netpr.
skip 1.
endat.
at last .
skip 1.
sum.
write:/5 'Grand Totals',47 i_vbap-kwmeng,65 i_vbap-netpr.
skip 1.
write:/ 'end of page', 'Footer'.
endat.
clear v_flag.
endloop.
2007 Jun 01 9:11 PM
Hi,
Try this sample code..
DATA: BEGIN OF WA,
WERKS TYPE WERKS_D,
LGORT TYPE MARD-LGORT,
MATNR TYPE MATNR,
MENGE TYPE EKPO-MENGE,
END OF WA.
DATA: T_DATA LIKE TABLE OF WA.
* Assuming the data is filled in teh internal table T_DATA.
SORT T_DATA BY WERKS LGORT.
LOOP AT T_DATA INTO WA.
* Display the details.
WRITE: / WA-MATNR, WA-WERKS, WA-LGORT, WA-MENGE.
AT NEW WERKS.
* Display in a new page.
NEW-PAGE.
ENDAT.
AT END OF LGORT.
* Display the Storage location level total.
SUM.
WRITE: / WA-MENGE.
ENDAT.
AT END OF WERKS.
* Display the plant level total.
SUM.
WRITE: / WA-MENGE.
ENDAT.
ENDLOOP.
Thanks,
Naren
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |