-ve values in inventory report
Hi Experts,
I have inventory report, this report shows total stock, in this report some materials are showing '-ve' values,but in cube total issue stock and total received stock both are same, that means this inventory report should show '0' value.
for example: in cube total issues stock: 13.60, total received stock: 13.60. That means total stock is = 0 (13.60-13.60), but in report it is showing -13.60.
I am not understanding what is the problem,
Pl help to do this,
good answer will be appriciated.
thanks in advance,
Venkat
Hi Venkat,
The calculation's of Inventory total stock is not as simple as we understand them. To calculate total stock it consider different Movement type's, reversal entries, blocked stock etc. as well into consideration.
There is no -ve stock and there can be no as well, but still u r getting that (i also got that ) then this is how u can analyze at various points where exactly the problem is.
1. Try to run some standard report for total stock (based on inventory Cube 0IC_C03 i guess this is u usign probably). Check the stock value for 1 or two particular Material and cross check the stock of same material in your R/3 system through some tr MMBE.
2. If standard report gives u rite result then probably some logic problem in ur report.
3. Apart from that the main problem of this situation is data loading issue.
Please follow proper inventory data loading steps. If not done step by step u will end up with wrong data.
Hope these steps will help you out in tracking the situation.
Thanks
Dipika Tyagi
Similar Messages
-
Negative Values in Inventory Report Available Stock column
Hi Guys,
Can anyone help me?
Actually, I am getting negative entry value.When am dividing the MovQty/Cartons
I was specified like this in SQL Query,
(Ex:
Select
ROUND(SUM(MovQty/Cartons),4) as Stock
from
Inventory)
But here MovQty - > 0 and Cartons value -> 180
It's the problem, when am dividing the stock value.
Please help me to resolve this problemdouble check your values. one of the two values will quite likely be negative
-
Negative values in Inventory report
Dear Guys,
When we are doing BW Inventory, we are facing one problem. I have searched previous topics. There some guy gave the same problem. But there is no answer. I am giving the details as per his words:
We have been struggling to reload our Material Movements cube (0IC_C03). We have been following the SAP documentation titled 'How to handle inventory management scenarios in BW'.
Our initial loads (Stock Opening Balance, Movements Init, Revaluations Init) have all been successful and validation looks good. The problem is that when the first delta UPDATE runs we end up having many negative inventory quantities appearing. We are not sure what we could be doing wrong.
Compression settings are as follows
1) Run stock opening balance (2LIS_03_BX)
2) Run statistical setup for 4/3 only for Revaluations and Movements (2LIS_03_BF, 2LIS_03_UM)
(Compress with Marker option NOT CHECKED)
3) Load Stock infoPackage 2LIS_03_BX with 'Opening stock balance checked ' (ie: not full update)
(Compress with marker option NOT CHECKED)
4) Run delta init for Movements
(Compress delta init with marker option CHECKED)
5) Run delta init for Revaluations
(Compress delta init with marker option CHECKED)
6) Setup job control in logistics cockpit
7) Run delta update for Movements
Compress delta with marker option NOT CHECKED
8) Run delta update for Revaluations
Compress delta with marker option NOT CHECKED
The issue seems to occur with steps 7 and 8. The initial time we do these steps we get zero records and everything looks good. Then the next day the same steps occur in our nightly process chain and then the data is bad with negative values.
Any ideas what we could be doing wrong?
Thanks!
Regards,
Vivek.VHi Vivek,
I had exactly the same problem.
In my case the issue was with the configuration of material movements in R3
In the R3 IMG goto Materials Management/IM & Phys Inventory/Movement Types/Copy, Change Movement Types execute
Select movement type (enter)
select all Movement Types say 101 to 901
Look for column header "Stat. Relevant" and make sure they are set to 2 or 3. If they are set blank the movements are not picked up by the extractors -
Inventory reports without value/price
Hi there,
I am looking for an inventory report like MC.9, MCBA, MCBE without value. Is there any standard inventory report without value or is it possible to restrict these reports without value through authorization?
Regards,
R.SHI,
,try this not sure
MB53 - Display Plant Stock Availability
MB52 - List of Warehouse Stocks on Hand
MB5T - Stock in transit CC
MMBE-stock overview
MB51-material document list
MC50-dead stock
MC.1 INVCO: Plant Anal. Selection: Stock
MC.2 INVCO: Plant Anal.Selection, Rec/Iss
MC.5 INVCO: SLoc Anal. Selection, Stock
MC.9 INVCO: Material Anal.Selection,Stock
MC.A INVCO: Mat.Anal.Selection, Rec/Iss
MC.L INVCO: Mat.Group Analysis Sel. Stock
MC50 INVCO: Analysis of Dead Stock
MCBA INVCO: Plant Analysis Selection
MCBC INVCO: Stor. Loc. Analysis Selection
MCBE INVCO: Material Analysis Selection
MCBK INVCO: MatGrp Analysis Selection
MCBR INVCO: Batch Analysis Selection
Regards
Kailas Ugale -
Inventory Report-Replacement path for Base UOM to Case and Standrad Cost
Hi, We have a Scenario as below:
Question1:
We have a multiprovider contains 4 infocubes and 2 Master Data objects
a.Demand
b.Inventory
c.Sales Orders
d.In Transit
Master Data objects
a. Material (contains Base UOM to Case as Key Figure Attribute and also Base UOM as an attribute)
b. Material Location (Contains material as an attribute and also Standard Cost as a Key Figure attribute)
At the report level two formula variables are defined with replacement path for showing the Base UOM to Case and Standard Cost in columns.
We have 4 reports on this multiprovider. There is a dialy sales report which gives the following details
Material, Location, MRP Controller, CalDay, Base UOM, Actual Sales(AS), Dependent Demand(DD), Consumption Qyt(CQ), Base to Case UOM, Standard Cost
In this report for all the records the Base to UOM and Standard Cost column is coming with values which is nothing but the replacement path on the material master key figure attribute. Though this report is on the multiprovider all the major keyfigures (AS, DD and CQ) are coming from a single cube( this is an observation from myside).
We have another report which is the Inventory Report with the following details:
Material, Location, MRP Controllder, Calday, Base UOM, Unrestricted Inventory(UI), committed Inventory(CI), Back Order Qty(BOQ), In Transit by Sh/Rec(ITS), In Transit Pipeline(ITP), On Order Qty (OOQ), Current Inventory Position (CIP), Quality Inspection Stock(QIS), Block Stock(BS), Base to Case UOM, Standard Cost
Now in this report for all the records the Base to Case UOM and standrad cost is not showing up. Is there anything which needs to be done in order to get the Base to Case UOM and standard cost for all the records.
Question2:
When Non-Cumulative and Cumulative key figures are combined at the multi provider and also at the report level, will there be any problem?
Regards
VijayHi,
I think you can proceed with virtual characteristics for this.In the code you can truncate the time and you can display on the date:
Regards
Prasad -
Inventory report for stock category B
Hi everyone,
We are trying to generate a customer stock inventory report with stock category B. The table MARD is not displaying any values annwe also looked at table MKOL. Its not giving us any. How do i get the inventory report for this stock type B. Kindly Advise.it is customer owned stock. We receiver materials from customer for repair and we recondition them and we give it back. for this we maintain it in stock type B. it is specifically used in aerospace industries. We want to make an inventory report for this customer owned stock in our inventory . i am unable to get the table. Kindly advise
-
Inventory report with the last transaction details of each material
Hi,
is there any standard inventory report in SAP which gives us the last transaction details of each
Material,along with last procurement qty, value, date and last issue
details of Qty, Value & date.
Thansk in advance.Hi
try following t-code
MB5B u2013 Stock on Posting Date
or
2 s_p00_07000139 u2013 Stock Card and Inventory Material Report
Regards
Kailas Ugale -
How to generate Inventory Report to display all details at end of mon/yr?
Hi Guys..
I would like to know how we can generate a
Inventory report to display all inventory details at the end of every
month or year?
Also, another question.How can we create a PO past delivery date report?
Any help is appreciated.
Thanks,
Sri Harsha;Hi,
Pls the code here-
TYPES :
BEGIN OF ty_mard,
matnr TYPE matnr,
werks TYPE werks_d,
lgort TYPE lgort_d,
labst TYPE labst,
retme TYPE retme,
umlme TYPE umlme,
END OF ty_mard.
TYPES :
BEGIN OF ty_mska,
matnr TYPE matnr,
kalab TYPE labst,
vbeln TYPE vbeln,
posnr TYPE posnr,
END OF ty_mska.
TYPES :
BEGIN OF ty_vbap,
matnr TYPE matnr,
kwmeng TYPE kwmeng,
pstyv TYPE pstyv,
END OF ty_vbap.
TYPES :
BEGIN OF ty_mbew,
matnr TYPE matnr,
salk3 TYPE salk3,
stprs TYPE stprs,
END OF ty_mbew.
TYPES :
BEGIN OF ty_mchb,
matnr TYPE matnr,
charg TYPE charg_d,
END OF ty_mchb.
TYPES :
BEGIN OF ty_mara,
matnr TYPE matnr,
mfrpn TYPE mfrpn,
END OF ty_mara.
TYPES :
BEGIN OF ty_makt,
matnr TYPE matnr,
maktx TYPE maktx,
END OF ty_makt.
TYPES :
BEGIN OF ty_ekpo,
matnr TYPE matnr,
netpr TYPE bprei,
meins TYPE bstme,
END OF ty_ekpo.
DATA :
BEGIN OF final OCCURS 0,
matnr LIKE mard-matnr,
maktx LIKE makt-maktx,
werks LIKE mard-werks,
lgort LIKE mard-lgort,
mfrpn LIKE mara-mfrpn,
usp LIKE mbew-stprs,
labst LIKE mard-labst,
salk3 LIKE mbew-salk3,
kalab LIKE mska-kalab,
vbeln LIKE mska-vbeln,
sov LIKE ekpo-netpr,
uom LIKE ekpo-meins,
posnr LIKE mska-posnr,
pstyv LIKE vbap-pstyv,
kwmeng LIKE vbap-kwmeng,
retme LIKE mard-retme,
umlme LIKE mard-umlme,
END OF final.
DATA :
BEGIN OF itab OCCURS 0,
matnr LIKE mard-matnr,
werks LIKE mard-werks,
lgort LIKE mard-lgort,
labst LIKE mard-labst,
retme LIKE mard-retme,
umlme LIKE mard-umlme,
charg LIKE mchb-charg,
END OF itab.
DATA :
i_mard TYPE STANDARD TABLE OF ty_mard,
i_mbew TYPE STANDARD TABLE OF ty_mbew,
i_mchb TYPE STANDARD TABLE OF ty_mchb,
i_mara TYPE STANDARD TABLE OF ty_mara,
i_vbap TYPE STANDARD TABLE OF ty_vbap,
i_mska TYPE STANDARD TABLE OF ty_mska,
i_makt TYPE STANDARD TABLE OF ty_makt,
i_ekpo TYPE STANDARD TABLE OF ty_ekpo.
DATA :
wa_mard TYPE ty_mard,
wa_mbew TYPE ty_mbew,
wa_mchb TYPE ty_mchb,
wa_mara TYPE ty_mara,
wa_vbap TYPE ty_vbap,
wa_mska TYPE ty_mska,
wa_makt TYPE ty_makt,
wa_ekpo TYPE ty_ekpo.
DATA :
sov_total TYPE currency,
urestrict_total type currency.
*Select options:
SELECTION-SCREEN BEGIN OF BLOCK a WITH FRAME TITLE text-001.
SELECT-OPTIONS : s_matnr FOR gf_matnr, " Material No.
s_werks FOR gf_werks, " Plant
s_lgort FOR gf_lgort, " Storage Location
s_charg FOR gf_charg. " Batch No.
SELECTION-SCREEN END OF BLOCK a.
*Validation of Selection Fields
AT SELECTION-SCREEN.
IF s_matnr IS INITIAL
AND s_werks IS INITIAL
AND s_lgort IS INITIAL
AND s_charg IS INITIAL.
MESSAGE e001(zcir).
ENDIF.
*Function Module for Checking the inputs
CALL FUNCTION 'MMIM_ENTRYCHECK_MAIN'
TABLES
it_matnr = s_matnr
it_werks = s_werks
it_lgort = s_lgort.
*Checking of input values for S_CHARG
IF NOT s_charg-low IS INITIAL OR NOT s_charg-high IS INITIAL.
SELECT charg FROM mchb into table LT_charg WHERE charg IN s_charg.
IF sy-subrc NE 0.
MESSAGE e002(zcir).
ENDIF.
clear wa_mchb.
ENDIF.
*TOP OF PAGE
TOP-OF-PAGE.
FORMAT COLOR COL_HEADING.
WRITE sy-uline(105).
WRITE :/ '|',2 text-101, "MATERIAL NO:
16 text-102, "MATERIAL DESCRIPTION
52 text-103, "PLANT
60 text-104, "STORAGE LOCATION.
74 text-105, "MANUFACTURE PARTNER NO.
88 text-106, "VALUATED STOCK.
95 text-107. "STANDARD PRICE.
105 '|'.
FORMAT COLOR COL_GROUP.
WRITE :/ '|',2 text-108, " UNRESTRCTED STOCK
16 text-109, " SALES DOCUMENT NO:
20 text-110, " ITEM NO:
27 text-111, " UNIT
32 text-112, " NET VALUE
39 text-113, " ITEM CATEGRY
50 text-114, " QUANTITY
60 text-115, " BLOCKED STOCK
79 text-116, " TOTAL STOCK
95 text-117. " STOCK TRANSFER
87 '|'.
FORMAT COLOR OFF.
WRITE sy-uline(105).
*START OF SELECTION
START-OF-SELECTION.
IF NOT s_matnr IS INITIAL
OR NOT s_werks IS INITIAL
OR NOT s_lgort IS INITIAL.
PERFORM select1.
ELSEIF NOT s_charg IS INITIAL.
PERFORM select2.
ELSEIF NOT s_matnr IS INITIAL
OR NOT s_werks IS INITIAL
OR NOT s_lgort IS INITIAL
AND NOT s_charg IS INITIAL.
PERFORM select3.
ENDIF.
PERFORM final1.
PERFORM collect.
*END OF SELECTION
END-OF-SELECTION.
LOOP AT LT_FINAL.
FORMAT COLOR COL_KEY.
WRITE :/2 LT_FINAL-matnr,
14 LT_FINAL-maktx,
52 LT_FINAL-werks,
58 LT_FINAL-lgort,
69 LT_FINAL-mfrpn,
73 LT_FINAL-labst,
87 LT_FINAL-usp.
FORMAT COLOR OFF.
FORMAT COLOR COL_NORMAL.
WRITE :/2 LT_FINAL-kalab,
14 LT_FINAL-vbeln,
17 LT_FINAL-posnr,
24 LT_FINAL-uom,
28 LT_FINAL-sov,
36 LT_FINAL-pstyv,
46 LT_FINAL-kwmeng,
57 LT_FINAL-retme,
65 LT_FINAL-salk3,
75 LT_FINAL-umlme.
ENDLOOP.
FORMAT COLOR COL_TOTAL.
WRITE :/2 text-119, " TOTAL VALUE
28 V_sov_total,
87 V_urestrict_total.
FORMAT COLOR OFF.
Form Name: select1
text: Population of internal table LT_MARD and using LT_MARD populating
the internal table LT_MCHB
FORM select1.
SELECT matnr
werks
lgort
labst
retme
umlme
FROM mard
INTO TABLE LT_mard
WHERE matnr IN s_matnr
AND werks IN s_werks
AND lgort IN s_lgort.
SELECT matnr
charg
FROM mchb
INTO TABLE LT_mchb
FOR ALL ENTRIES IN LT_mard
WHERE matnr EQ LT_mard-matnr.
ENDFORM. "select1
Form Name: select2
text:Population of internal table LT_MCHB and using LT_MCHB populating
LT_MARD
FORM select2.
SELECT matnr
charg
FROM mchb
INTO TABLE LT_mchb
WHERE charg IN s_charg.
SELECT matnr
werks
lgort
labst
retme
umlme
FROM mard
INTO TABLE LT_mard
FOR ALL ENTRIES IN LT_mchb
WHERE matnr EQ LT_mchb-matnr.
ENDFORM. "select2
Form Name: select3
text: Population of internal table LT_TAB using inner join and then
populating internal tables LT_MARD and LT_MCHB
FORM select3.
SELECT a~matnr
a~werks
a~lgort
a~labst
a~retme
a~umlme
b~charg
INTO CORRESPONDING FIELDS OF TABLE LT_TAB
FROM mard AS a
INNER JOIN mchb AS b ON bmatnr = amatnr
WHERE a~matnr IN s_matnr
OR a~werks IN s_werks
OR a~lgort IN s_lgort
AND b~charg IN s_charg.
LOOP AT LT_TAB.
MOVE: LT_TAB-matnr TO wa_mard-matnr,
LT_TAB-werks TO wa_mard-werks,
LT_TAB-lgort TO wa_mard-lgort,
LT_TAB-labst TO wa_mard-labst,
LT_TAB-retme TO wa_mard-retme,
LT_TAB-umlme TO wa_mard-umlme,
LT_TAB-matnr TO wa_mchb-matnr,
LT_TAB-charg TO wa_mchb-charg.
APPEND wa_mard TO LT_mard.
APPEND wa_mchb TO LT_mchb.
ENDLOOP.
ENDFORM. "select3
Form Name:collect
text:population of LT_FINAL internal table-LT_FINAL using other internal
tables
FORM collect.
LOOP AT LT_mard INTO wa_mard.
MOVE : wa_mard-matnr TO LT_FINAL-matnr,
wa_mard-werks TO LT_FINAL-werks,
wa_mard-lgort TO LT_FINAL-lgort,
wa_mard-labst TO LT_FINAL-labst,
wa_mard-retme TO LT_FINAL-retme,
wa_mard-umlme TO LT_FINAL-umlme.
READ TABLE LT_makt INTO wa_makt WITH KEY matnr = wa_mard-matnr.
MOVE wa_makt-maktx TO LT_FINAL-maktx.
READ TABLE LT_mska INTO wa_mska WITH KEY matnr = wa_mard-matnr.
MOVE: wa_mska-kalab TO LT_FINAL-kalab,
wa_mska-vbeln TO LT_FINAL-vbeln,
wa_mska-posnr TO LT_FINAL-posnr.
READ TABLE LT_vbap INTO wa_vbap WITH KEY matnr = wa_mard-matnr.
MOVE: wa_vbap-kwmeng TO LT_FINAL-kwmeng.
READ TABLE LT_mara INTO wa_mara WITH KEY matnr = wa_mard-matnr.
MOVE : wa_mara-mfrpn TO LT_FINAL-mfrpn.
READ TABLE LT_mbew INTO wa_mbew WITH KEY matnr = wa_mard-matnr.
Calculation of Unrestricted value
LT_FINAL-usp = wa_mard-labst * wa_mbew-stprs.
V_urestrict_total = V_urestrict_total + ( wa_mard-labst * wa_mbew-stprs ).
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
input = V_urestrict_total
IMPORTING
OUTPUT = V_urestrict_total
MOVE wa_mbew-salk3 TO LT_FINAL-salk3.
READ TABLE LT_ekpo INTO wa_ekpo WITH KEY matnr = wa_mard-matnr.
MOVE wa_ekpo-meins TO LT_FINAL-uom.
Calculation of Sales Order Value
LT_FINAL-sov = wa_mska-kalab * wa_ekpo-netpr.
V_sov_total = V_sov_total + ( wa_mska-kalab * wa_ekpo-netpr ).
APPEND LT_FINAL.
ENDLOOP.
ENDFORM. "collect
*Form Name:FINAL1
*Population of all the internal tables
FORM FINAL1.
SELECT matnr
kalab
vbeln
posnr
FROM mska
INTO TABLE LT_mska
FOR ALL ENTRIES IN LT_mard
WHERE matnr EQ LT_mard-matnr.
SELECT matnr
kwmeng
pstyv
FROM vbap
INTO TABLE LT_vbap
FOR ALL ENTRIES IN LT_mard
WHERE matnr EQ LT_mard-matnr.
SELECT matnr
salk3
stprs
FROM mbew
INTO TABLE LT_mbew
FOR ALL ENTRIES IN LT_mard
WHERE matnr EQ LT_mard-matnr.
SELECT matnr
mfrpn
FROM mara
INTO TABLE LT_mara
FOR ALL ENTRIES IN LT_mard
WHERE matnr EQ LT_mard-matnr.
SELECT matnr
maktx
FROM makt
INTO TABLE LT_makt
FOR ALL ENTRIES IN LT_mard
WHERE matnr EQ LT_mard-matnr.
SELECT matnr
netpr
FROM ekpo
INTO TABLE LT_ekpo
FOR ALL ENTRIES IN LT_mard
WHERE matnr EQ LT_mard-matnr.
ENDFORM. "final1
Reward if helpful.
Chandralekha -
Hi friends,
I would like to see a report by Product line/Profit center,
I checked these reports, MCBE,MMBE,MCBC,ME80AN. Where I dont see any field that can show Profit center,
And also I would like to see a inventory report by material, qty, batch, and serial number.
Please let me know if we have any report like that ,this will help you
*& Report Z_OPEN_CLOSE *
REPORT Z_OPEN_CLOSE MESSAGE-ID YW2 LINE-SIZE 231 LINE-COUNT 45
NO STANDARD PAGE HEADING.
Type Declaration *
TYPE-POOLS SLIS.
Tables *
TABLES: MKPF, " Material Document: Header Data
MSEG, " Material Document: Item Data
MARA,
MARD,
S031,
EKKO,
EKPO,
LIKP,
MAKT,
J_1IWRKCUS,
T001W,
WB2_V_MKPF_MSEG2,
MMIM_REP_PRINT,
YW2_STKMOVEMENTS,
YPLNT,
MARDH.
Internal Tables *
DATA: I_WERKS LIKE J_1IWRKCUS OCCURS 0 WITH HEADER LINE.
DATA: BEGIN OF I_YPLNT OCCURS 0,
PPLNT LIKE YPLNT-PPLNT,
WPLNT LIKE YPLNT-WPLNT,
END OF I_YPLNT.
DATA: BEGIN OF I_MKPF OCCURS 0,
MBLNR LIKE MKPF-MBLNR,
MJAHR LIKE MKPF-MJAHR,
BUDAT LIKE MKPF-BUDAT,
VGART LIKE MKPF-VGART,
BWART LIKE MSEG-BWART,
MATNR LIKE MSEG-MATNR,
WERKS LIKE MSEG-WERKS,
LGORT LIKE MSEG-LGORT,
MENGE LIKE MSEG-MENGE,
MEINS LIKE MSEG-MEINS,
KUNNR LIKE MSEG-KUNNR,
ZEILE LIKE MSEG-ZEILE,
XAUTO LIKE MSEG-XAUTO,
SHKZG LIKE MSEG-SHKZG,
MATNR1 LIKE MSEG-MATNR,
END OF I_MKPF.
DATA: BEGIN OF I_MARDH OCCURS 0,
WERKS LIKE MARDH-WERKS,
MEINS LIKE MARA-MEINS,
MATNR LIKE MARDH-MATNR,
LGORT LIKE MARDH-LGORT,
LABST LIKE MARDH-LABST,
LFGJA LIKE MARDH-LFGJA, "Added -MB
LFMON LIKE MARDH-LFMON, "Added -MB
PERIO(6),
INSME LIKE MARDH-LABST,
EINME LIKE MARDH-LABST,
SPEME LIKE MARDH-LABST,
RETME LIKE MARDH-LABST,
O_STK LIKE MARDH-LABST, " Opening Stock
C_STK LIKE MARDH-LABST, " Closing Stock
END OF I_MARDH.
DATA: BEGIN OF I_MARD OCCURS 0,
WERKS LIKE MARD-WERKS,
MATNR LIKE MARD-MATNR,
LGORT LIKE MARD-LGORT,
LABST LIKE MARD-LABST,
INSME LIKE MARD-LABST,
MEINS LIKE MARA-MEINS,
EINME LIKE MARD-LABST,
SPEME LIKE MARD-LABST,
RETME LIKE MARD-LABST,
END OF I_MARD.
DATA: I_MARD1 LIKE I_MARD OCCURS 0 WITH HEADER LINE.
DATA: I_MARDH1 LIKE I_MARDH OCCURS 0 WITH HEADER LINE.
DATA: BEGIN OF I_MKPF1 OCCURS 0,
MBLNR LIKE MKPF-MBLNR,
WERKS LIKE MSEG-WERKS,
MATNR LIKE MSEG-MATNR,
BUDAT LIKE MKPF-BUDAT,
BWART LIKE MSEG-BWART,
MJAHR LIKE MKPF-MJAHR,
VGART LIKE MKPF-VGART,
LGORT LIKE MSEG-LGORT,
MENGE LIKE MSEG-MENGE,
MEINS LIKE MSEG-MEINS,
XAUTO LIKE MSEG-XAUTO,
SHKZG LIKE MSEG-SHKZG,
END OF I_MKPF1.
DATA: BEGIN OF I_MKPF2 OCCURS 0,
WERKS LIKE MSEG-WERKS,
MATNR LIKE MSEG-MATNR,
BUDAT LIKE MKPF-BUDAT,
BWART LIKE MSEG-BWART,
MJAHR LIKE MKPF-MJAHR,
VGART LIKE MKPF-VGART,
LGORT LIKE MSEG-LGORT,
MENGE LIKE MSEG-MENGE,
MEINS LIKE MSEG-MEINS,
XAUTO LIKE MSEG-XAUTO,
END OF I_MKPF2.
DATA: BEGIN OF I_FINAL5 OCCURS 0,
WERKS LIKE MSEG-WERKS, " Plant
MATNR LIKE MSEG-MATNR, " Material
LGORT LIKE MSEG-LGORT, " Storage Location
BUDAT LIKE MKPF-BUDAT, " Posting Date
MTART LIKE MARA-MTART, " Material Type
SPMON LIKE S031-SPMON, " Month
MAKTX LIKE MAKT-MAKTX, " Description
meins(3), " UOM
MEINS LIKE MSEG-MEINS,
O_STK LIKE MARDH-LABST, " opening stock
TRECEP LIKE MARDH-LABST, " total receipts
PRODU LIKE MARDH-LABST, " Net Receipts - Production
RECEP LIKE MARDH-LABST, " Net Receipts - Receipts
SAL_RET LIKE MARDH-LABST, " Net Receipts - Sales Return
TDISP LIKE MARDH-LABST, " total dispatches
CUSTMR LIKE MARDH-LABST, " Net Dispatches - Customers
OPLANT LIKE MARDH-LABST, " Net Dispatches - To Other Plant
TLOSS LIKE MARDH-LABST, " Total Loss
TRLOSS LIKE MARDH-LABST, " Transit Loss
WHLOSS LIKE MARDH-LABST, " Warehouse Loss
C_STK LIKE MARDH-LABST, " Closing Stock
TRFSTK LIKE MARDH-LABST, "Transfer stock
MENGE LIKE MSEG-MENGE,
OTHADJ LIKE MARDH-LABST,
END OF I_FINAL5.
DATA: BEGIN OF I_FINAL OCCURS 0,
WERKS LIKE MSEG-WERKS, " Plant
MATNR LIKE MSEG-MATNR, " Material
BUDAT LIKE MKPF-BUDAT, " Posting Date
MTART LIKE MARA-MTART, " Material Type
SPMON LIKE S031-SPMON, " Month
MAKTX LIKE MAKT-MAKTX, " Description
meins(3), " UOM
MEINS LIKE MSEG-MEINS,
O_STK LIKE MARDH-LABST, " opening stock
TRECEP LIKE MARDH-LABST, " total receipts
PRODU LIKE MARDH-LABST, " Net Receipts - Production
RECEP LIKE MARDH-LABST, " Net Receipts - Receipts
SAL_RET LIKE MARDH-LABST, " Net Receipts - Sales Return
TDISP LIKE MARDH-LABST, " total dispatches
CUSTMR LIKE MARDH-LABST, " Net Dispatches - Customers
OPLANT LIKE MARDH-LABST, " Net Dispatches - To Other Plant
TRFSTK LIKE MARDH-LABST, "Material Transfer stock
TRLOSS LIKE MARDH-LABST, " Transit Loss
WHLOSS LIKE MARDH-LABST, " Warehouse Loss
TLOSS LIKE MARDH-LABST, " Total Loss
C_STK LIKE MARDH-LABST, " Closing Stock
OTHADJ LIKE MARDH-LABST,
END OF I_FINAL.
DATA: I_FINAL1 LIKE I_FINAL OCCURS 0 WITH HEADER LINE.
DATA: BEGIN OF I_FINAL_TEMP OCCURS 0,
WERKS LIKE MSEG-WERKS, " Plant
MATNR LIKE MSEG-MATNR, " Material
MTART LIKE MARA-MTART, " Material Type
MAKTX LIKE MAKT-MAKTX, " Description
MEINS LIKE MSEG-MEINS,
O_STK LIKE MARDH-LABST, " opening stock
TRECEP LIKE MARDH-LABST, " total receipts
PRODU LIKE MARDH-LABST, " Net Receipts - Production
RECEP LIKE MARDH-LABST, " Net Receipts - Receipts
SAL_RET LIKE MARDH-LABST, " Net Receipts - Sales Return
TDISP LIKE MARDH-LABST, " total dispatches
CUSTMR LIKE MARDH-LABST, " Net Dispatches - Customers
OPLANT LIKE MARDH-LABST, " Net Dispatches - To Other Plant
TRFSTK LIKE MARDH-LABST, "Material Transfer stock
TRLOSS LIKE MARDH-LABST, " Transit Loss
WHLOSS LIKE MARDH-LABST, " Warehouse Loss
TLOSS LIKE MARDH-LABST, " Total Loss
C_STK LIKE MARDH-LABST, " Closing Stock
OTHADJ LIKE MARDH-LABST,
END OF I_FINAL_TEMP.
For Materials
DATA: BEGIN OF I_MARA OCCURS 0,
MATNR TYPE MARA-MATNR,
MTART TYPE MARA-MTART,
MEINS LIKE MARA-MEINS,
LABST TYPE MARD-LABST,
MAKTX LIKE MAKT-MAKTX,
END OF I_MARA.
DATA: BEGIN OF I_STKMVMNTS OCCURS 0,
BWART LIKE MSEG-BWART,
SHKZG LIKE MSEG-SHKZG,
VZBEW LIKE YW2_STKMOVEMENTS-VZBEW,
END OF I_STKMVMNTS.
DATA: BEGIN OF I_FINALT OCCURS 0,
WERKS LIKE MSEG-WERKS, " Plant
MATNR LIKE MSEG-MATNR, " Material
BUDAT LIKE MKPF-BUDAT, " Posting Date
MTART LIKE MARA-MTART, " Material Type
SPMON LIKE S031-SPMON, " Month
MAKTX LIKE MAKT-MAKTX, " Description
meins(3), " UOM
MEINS LIKE MSEG-MEINS,
O_STK LIKE MARDH-LABST, " opening stock
TRECEP LIKE MARDH-LABST, " total receipts
PRODU LIKE MARDH-LABST, " Net Receipts - Production
RECEP LIKE MARDH-LABST, " Net Receipts - Receipts
SAL_RET LIKE MARDH-LABST, " Net Receipts - Sales Return
TDISP LIKE MARDH-LABST, " total dispatches
CUSTMR LIKE MARDH-LABST, " Net Dispatches - Customers
OPLANT LIKE MARDH-LABST, " Net Dispatches - To Other Plant
TRFSTK LIKE MARDH-LABST, "Material Transfer stock
TRLOSS LIKE MARDH-LABST, " Transit Loss
WHLOSS LIKE MARDH-LABST, " Warehouse Loss
TLOSS LIKE MARDH-LABST, " Total Loss
C_STK LIKE MARDH-LABST, " Closing Stock
OTHADJ LIKE MARDH-LABST,
MONTH(8) ,
END OF I_FINALT.
DATA: IMKPFT LIKE I_MKPF OCCURS 0 WITH HEADER LINE.
DATA: IMKPFT1 LIKE I_MKPF1 OCCURS 0 WITH HEADER LINE.
DATA: IMARDT LIKE I_MARD OCCURS 0 WITH HEADER LINE.
DATA: IMARDHT LIKE I_MARDH OCCURS 0 WITH HEADER LINE.
DATA: T_FINAL LIKE I_MKPF OCCURS 0 WITH HEADER LINE.
DATA: IMKPFT2 LIKE I_MKPF OCCURS 0 WITH HEADER LINE.
FCAT is used for the field catalog
DATA: FCAT TYPE TABLE OF SLIS_FIELDCAT_ALV WITH NON-UNIQUE DEFAULT KEY
WITH HEADER LINE INITIAL SIZE 0,
for excluding the ICONs from the application toolbar
FEXC TYPE TABLE OF SLIS_EXTAB WITH NON-UNIQUE DEFAULT KEY
WITH HEADER LINE INITIAL SIZE 0,
FS_LAYO is used for Grid Layout
FS_LAYO TYPE SLIS_LAYOUT_ALV,
FEVENTS to handle the events TOP OF PAGE & USER_COMMAND
FEVENTS TYPE TABLE OF SLIS_ALV_EVENT WITH NON-UNIQUE DEFAULT KEY
WITH HEADER LINE INITIAL SIZE 0,
FHEADER is used for List header
FHEADER TYPE TABLE OF SLIS_LISTHEADER WITH NON-UNIQUE DEFAULT KEY
WITH HEADER LINE INITIAL SIZE 0,
sort is used for sorting
FSORT TYPE TABLE OF SLIS_SORTINFO_ALV WITH NON-UNIQUE DEFAULT KEY
WITH HEADER LINE INITIAL SIZE 0,
FCAT1 TYPE TABLE OF SLIS_FIELDCAT_ALV WITH NON-UNIQUE DEFAULT KEY
WITH HEADER LINE INITIAL SIZE 0,
FS_LAYO1 TYPE SLIS_LAYOUT_ALV,
GT_LIST_TOP_OF_PAGE1 TYPE SLIS_T_LISTHEADER,
FEVENTS1 TYPE TABLE OF SLIS_ALV_EVENT WITH NON-UNIQUE DEFAULT KEY
WITH HEADER LINE INITIAL SIZE 0,
FHEADER1 TYPE TABLE OF SLIS_LISTHEADER WITH NON-UNIQUE DEFAULT
KEY WITH HEADER LINE INITIAL SIZE 0,
G_STATU_071 TYPE SLIS_FORMNAME VALUE 'Z_PFSTATUS',
ALV_VARIANT1 LIKE DISVARIANT.
Variable Declaration *
TYPES: TRFF_TYPE_DEC_6_5(6) TYPE P DECIMALS 5.
DATA: FYEAR(4),
MON(2),
FYEAR1(4),
MON1(2),
OBAL LIKE MARD-LABST,
CBAL LIKE MARD-LABST,
INDEX TYPE I,
COUNT,
COUNT1 TYPE I,
O_STK TYPE P DECIMALS 3,
C_STK TYPE P DECIMALS 3,
V_MJAHR LIKE MKPF-MJAHR,
MONTHS TYPE TRFF_TYPE_DEC_6_5,
MONTH TYPE I.
Global variables for handling ALV functionality
DATA: ALV_KEYINFO TYPE SLIS_KEYINFO_ALV,
ALV_VARIANT LIKE DISVARIANT,
ALV_LAYOUT TYPE SLIS_LAYOUT_ALV,
ALV_REPID LIKE SY-REPID,
ALV_PRINT TYPE SLIS_PRINT_ALV,
ALV_DETAIL_FUNC(30),
ALV_DEFAULT_VARIANT LIKE DISVARIANT-VARIANT,
ALV_COLOURIZE_FIELDS LIKE MMIM_REP_PRINT-COLOR.
RANGES: R_BUDAT FOR MKPF-BUDAT.
*Added by Prabhu for year on 26.4.05.
DATA: IDATE LIKE R_BUDAT OCCURS 0 WITH HEADER LINE.
Selection Screen Elements *
SELECTION-SCREEN BEGIN OF BLOCK BLK WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS: S_WERKS FOR MARD-WERKS OBLIGATORY NO INTERVALS.
PARAMETER: P_SPMON LIKE S031-SPMON NO-DISPLAY .
SELECT-OPTIONS: S_MATNR FOR MARA-MATNR OBLIGATORY,
S_LGORT FOR MSEG-LGORT NO-EXTENSION NO INTERVALS,
S_MBLNR FOR MKPF-MBLNR,
S_BUDAT FOR MKPF-BUDAT OBLIGATORY .
SELECTION-SCREEN END OF BLOCK BLK.
SELECTION-SCREEN BEGIN OF BLOCK BLK3 WITH FRAME TITLE TEXT-004.
PARAMETER : MTART LIKE MARA-MTART DEFAULT 'FERT' NO-DISPLAY.
SELECTION-SCREEN END OF BLOCK BLK3.
SELECTION-SCREEN BEGIN OF BLOCK BLK2 WITH FRAME TITLE TEXT-003.
SELECTION-SCREEN END OF BLOCK BLK2.
ADDED BY PRABHU FOR DAY-WISE REPORT.
SELECTION-SCREEN BEGIN OF BLOCK B3 WITH FRAME TITLE TEXT-007.
PARAMETERS: D1 RADIOBUTTON GROUP P1 DEFAULT 'X',
M1 RADIOBUTTON GROUP P1,
Y1 RADIOBUTTON GROUP P1.
SELECTION-SCREEN END OF BLOCK B3.
SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-006.
PARAMETERS: ALV_DEF LIKE DISVARIANT-VARIANT.
SELECTION-SCREEN END OF BLOCK B2.
DATA: S_BUDAT1 LIKE S_BUDAT OCCURS 0 WITH HEADER LINE."prabhu
Initialization *
INITIALIZATION.
PERFORM ALV_INIT.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR ALV_DEF.
PERFORM ALV_F4.
At Selection Screen
*AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_spmon.
PERFORM monat_f4.
At Selection Screen *
AT SELECTION-SCREEN.
checking for the layout
PERFORM ALV_CHECK.
authorisation check for the Plant
PERFORM auth_check.
Validation for the Plant
PERFORM VALIDITY_CHECK.
IF MTART NE 'FERT'.
MESSAGE E041 WITH 'Material Type must be FERT Only...'.
ENDIF.
IF D1 = 'X'." On 26.4.05.
P_SPMON0(4) = S_BUDAT-LOW0(4).
P_SPMON4(2) = S_BUDAT-LOW4(2).
ELSE.
P_SPMON0(4) = S_BUDAT-LOW0(4).
P_SPMON4(2) = S_BUDAT-LOW4(2).
ENDIF.
LOOP AT S_BUDAT.
IF S_BUDAT-HIGH IS INITIAL.
S_BUDAT-HIGH = S_BUDAT-LOW.
MODIFY S_BUDAT.
ENDIF.
ENDLOOP.
IDATE-LOW = S_BUDAT-LOW.
IDATE-HIGH = S_BUDAT-HIGH.
CALL FUNCTION 'FIMA_DAYS_AND_MONTHS_AND_YEARS'
EXPORTING
I_DATE_FROM = IDATE-LOW
I_DATE_TO = IDATE-HIGH
IMPORTING
E_DAYS =
E_MONTHS = MONTH
E_YEARS =
DATA: I(3) TYPE C.
I = S_BUDAT-LOW+4(2).
CLEAR: R_BUDAT.
REFRESH: R_BUDAT.
*added by Prabhu for Only for Oneday.on 18.5.5
IF MONTH EQ '0'.
MONTH = MONTH + 1.
ENDIF.
*added by Prabhu for Only for Oneday.on 18.5.5
DO MONTH TIMES.
R_BUDAT-LOW = S_BUDAT-LOW.
APPEND R_BUDAT.
ENDDO.
I = 0.
LOOP AT R_BUDAT.
R_BUDAT-LOW4(2) = S_BUDAT-LOW4(2) + I.
I = I + 1.
R_BUDAT-LOW+6(2) = '01'.
MODIFY R_BUDAT.
ENDLOOP.
LOOP AT R_BUDAT.
CALL FUNCTION 'RP_LAST_DAY_OF_MONTHS'
EXPORTING
DAY_IN = R_BUDAT-LOW
IMPORTING
LAST_DAY_OF_MONTH = R_BUDAT-HIGH
EXCEPTIONS
DAY_IN_NO_DATE = 1
OTHERS = 2
MODIFY R_BUDAT.
ENDLOOP.
LOOP AT R_BUDAT.
IF R_BUDAT-LOW4(2) = S_BUDAT-LOW4(2).
R_BUDAT-LOW = S_BUDAT-LOW.
MODIFY R_BUDAT.
ENDIF.
IF R_BUDAT-HIGH4(2) = S_BUDAT-HIGH4(2).
R_BUDAT-HIGH = S_BUDAT-HIGH.
MODIFY R_BUDAT.
ENDIF.
For Summary on 26.4.05.
IF Y1 = 'X'.
CLEAR R_BUDAT.
REFRESH R_BUDAT.
R_BUDAT-LOW = S_BUDAT-LOW.
R_BUDAT-HIGH = S_BUDAT-HIGH.
APPEND R_BUDAT.
CLEAR R_BUDAT.
ENDIF.
ENDLOOP.
At Selection Screen *
AT SELECTION-SCREEN OUTPUT.
Start of Selection *
START-OF-SELECTION.
V_MJAHR = P_SPMON+0(4).
Get plant distinction warehouse/production
PERFORM GET_PLANT_DISTINCTION.
Collect the data from various tables
PERFORM GETDATA_FG_STOCK.
here the number of rows in the output table is found
PERFORM OUTPUT_TABLE_CHECK.
here the top of the page code is written, that is to be displayed
in the output
PERFORM Z_TOP_OF_PAGE.
here ALV layout properties are set
PERFORM Z_LAYOUT_SETTINGS.
ALV EVENTS for TOP OF PAGE and for USER COMMAND
PERFORM Z_ALV_EVENTS.
The field catalog is defined for the Primary List is defined in
the subroutine CREATE_FIELD_CATALOG include program ZPRRDOCR_FCAT
PERFORM Z_CREATE_FIELD_CATALOG.
This is for displaying the output
PERFORM Z_REUSE_ALV_GRID_DISPLAY.
*& Form getdata_fg_stock
Getting data from standard tables
FORM GETDATA_FG_STOCK.
For getting the Start date & end date of the month
PERFORM get_month_dates.
Getting the Opening Stock from MARDH table
IF MON EQ '01'.
MON1 = MON.
FYEAR1 = FYEAR.
MON = '12'.
FYEAR = FYEAR - 1.
ELSE.
MON1 = MON.
FYEAR1 = FYEAR.
MON = MON - 1.
FYEAR = FYEAR.
ENDIF.
PERFORM GET_RECORDS_FROM_DB.
*added for Month Summary on 26.4.05.
LOOP AT R_BUDAT.
S_BUDAT-LOW = R_BUDAT-LOW.
S_BUDAT-HIGH = R_BUDAT-HIGH.
*for Month
P_SPMON0(4) = S_BUDAT-LOW0(4).
P_SPMON4(2) = S_BUDAT-LOW4(2).
*for summary.
IF Y1 = 'X'.
LOOP AT S_BUDAT.
S_BUDAT1-SIGN = 'I'.
S_BUDAT1-OPTION = 'NB'.
S_BUDAT1-LOW = S_BUDAT-LOW.
S_BUDAT1-HIGH = S_BUDAT-HIGH.
APPEND S_BUDAT1.
CLEAR S_BUDAT1.
ENDLOOP.
ENDIF.
IMKPFT[] = I_MKPF[].
IMKPFT2[] = I_MKPF[].
IMARDT[] = I_MARD[].
IMARDHT[] = I_MARDH[].
PERFORM MONTH_WISE.
PERFORM PROCESS_MOVEMENTS.
PERFORM CALCULATE_OPENING_STOCK.
PERFORM UPDATE_NON_TRANSACTION_ITMS.
PERFORM DELETE_EMPTY_RECORDS.
CLEAR: IMARDHT,IMARDT,IMKPFT1,IMKPFT,I_FINAL,I_FINAL5.
REFRESH: IMARDHT,IMARDT,IMKPFT1,I_FINAL,I_FINAL5,IMKPFT.
ENDLOOP.
CLEAR: R_BUDAT.
REFRESH: R_BUDAT.
*end of changes for month.
ENDFORM. " getdata_fg_stock
FORM MONAT_F4 *
F4-Hilfe für Monat *
FORM MONAT_F4.
DATA: BEGIN OF MF_DYNPFIELDS OCCURS 1.
INCLUDE STRUCTURE DYNPREAD.
DATA: END OF MF_DYNPFIELDS.
DATA: MF_RETURNCODE LIKE SY-SUBRC,
MF_MONAT LIKE ISELLIST-MONTH,
MF_HLP_REPID LIKE SY-REPID.
FIELD-SYMBOLS: .
Wert von Dynpro lesen
GET CURSOR FIELD MF_DYNPFIELDS-FIELDNAME.
APPEND MF_DYNPFIELDS.
MF_HLP_REPID = SY-REPID.
DO 2 TIMES.
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
DYNAME = MF_HLP_REPID
DYNUMB = SY-DYNNR
TABLES
DYNPFIELDS = MF_DYNPFIELDS
EXCEPTIONS
INVALID_ABAPWORKAREA = 01
INVALID_DYNPROFIELD = 02
INVALID_DYNPRONAME = 03
INVALID_DYNPRONUMMER = 04
INVALID_REQUEST = 05
NO_FIELDDESCRIPTION = 06
UNDEFIND_ERROR = 07.
IF SY-SUBRC = 3.
Aktuelles Dynpro ist Wertemengenbild
MF_HLP_REPID = 'SAPLALDB'.
ELSE.
READ TABLE MF_DYNPFIELDS INDEX 1.
Unterstriche durch Blanks ersetzen
TRANSLATE MF_DYNPFIELDS-FIELDVALUE USING '_ '.
EXIT.
ENDIF.
ENDDO.
IF SY-SUBRC = 0.
Konvertierung ins interne Format
CALL FUNCTION 'CONVERSION_EXIT_PERI_INPUT'
EXPORTING
INPUT = MF_DYNPFIELDS-FIELDVALUE
IMPORTING
OUTPUT = MF_MONAT
EXCEPTIONS
ERROR_MESSAGE = 1.
IF MF_MONAT IS INITIAL.
Monat ist initial => Vorschlagswert aus akt. Datum ableiten
MF_MONAT = SY-DATLO(6).
ENDIF.
CALL FUNCTION 'POPUP_TO_SELECT_MONTH'
EXPORTING
ACTUAL_MONTH = MF_MONAT
IMPORTING
SELECTED_MONTH = MF_MONAT
RETURN_CODE = MF_RETURNCODE
EXCEPTIONS
FACTORY_CALENDAR_NOT_FOUND = 01
HOLIDAY_CALENDAR_NOT_FOUND = 02
MONTH_NOT_FOUND = 03.
IF SY-SUBRC = 0 AND MF_RETURNCODE = 0.
ASSIGN (MF_DYNPFIELDS-FIELDNAME) TO <MF_FELD>. " ==>> note 148804
<MF_FELD> = MF_MONAT.
CALL FUNCTION 'CONVERSION_EXIT_PERI_OUTPUT'
EXPORTING
INPUT = MF_MONAT
IMPORTING
OUTPUT = MF_DYNPFIELDS-FIELDVALUE.
COLLECT MF_DYNPFIELDS.
CALL FUNCTION 'DYNP_VALUES_UPDATE'
EXPORTING
DYNAME = MF_HLP_REPID
DYNUMB = SY-DYNNR
TABLES
DYNPFIELDS = MF_DYNPFIELDS
EXCEPTIONS
INVALID_ABAPWORKAREA = 01
INVALID_DYNPROFIELD = 02
INVALID_DYNPRONAME = 03
INVALID_DYNPRONUMMER = 04
INVALID_REQUEST = 05
NO_FIELDDESCRIPTION = 06
UNDEFIND_ERROR = 07. "<<== note 148804
ENDIF.
ENDIF.
ENDFORM. "MONAT_F4
*& Form get_month_dates
Calculating the Month Start & End Date
FORM GET_MONTH_DATES.
IF M1 = 'X'.
FYEAR = P_SPMON+0(4).
MON = P_SPMON+4(2).
CONCATENATE FYEAR MON '01' INTO R_BUDAT-LOW.
R_BUDAT-SIGN = 'I'.
R_BUDAT-OPTION = 'BT'.
CALL FUNCTION 'BKK_GET_MONTH_LASTDAY'
EXPORTING
I_DATE = R_BUDAT-LOW
IMPORTING
E_DATE = R_BUDAT-HIGH.
APPEND R_BUDAT.
CLEAR S_BUDAT.
REFRESH S_BUDAT.
S_BUDAT-SIGN = 'I'.
S_BUDAT-OPTION = 'BT'.
S_BUDAT-LOW = R_BUDAT-LOW.
S_BUDAT-HIGH = R_BUDAT-HIGH.
APPEND S_BUDAT.
ELSE.
FYEAR = P_SPMON+0(4).
MON = P_SPMON+4(2).
CONCATENATE FYEAR MON '01' INTO R_BUDAT-LOW.
R_BUDAT-SIGN = 'I'.
R_BUDAT-OPTION = 'BT'.
CALL FUNCTION 'BKK_GET_MONTH_LASTDAY'
EXPORTING
I_DATE = R_BUDAT-LOW
IMPORTING
E_DATE = R_BUDAT-HIGH.
APPEND R_BUDAT.
ENDIF.
ENDFORM. " get_month_dates
*& Form output_table_Check
checking for records for output
FORM OUTPUT_TABLE_CHECK .
DESCRIBE TABLE I_FINALT LINES INDEX.
IF INDEX EQ 0.
MESSAGE I041 WITH TEXT-005.
LEAVE LIST-PROCESSING.
ENDIF.
ENDFORM. "OUTPUT_TABLE_CHECK
*& Form Z_TOP_OF_PAGE
for setting the details in the top of page *
has no formal paramters *
FORM Z_TOP_OF_PAGE.
DATA: V_MON(2),
V_YR(40),
V_FIN(18),
V_FIN1(48),
LOW(10),
HIGH(10).
V_MON = P_SPMON+4(2).
V_YR = P_SPMON+0(4).
FHEADER-TYP = 'H'.
FHEADER-INFO = 'Stock Register Report (FG Stock)'.
APPEND FHEADER.
CLEAR FHEADER.
*if m1 = 'X'.
CONCATENATE 'Month = ' v_mon '.' v_yr INTO v_fin.
fheader-typ = 'H'.
fheader-info = v_fin.
APPEND fheader.
CLEAR fheader.
*endif."prabhu on 18.5.5
IF D1 = 'X'.
CLEAR S_BUDAT.
LOOP AT S_BUDAT.
CONCATENATE S_BUDAT-LOW6(2) '/' S_BUDAT-LOW4(2) '/'
S_BUDAT-LOW+0(4) INTO LOW.
CONCATENATE S_BUDAT-HIGH6(2) '/' S_BUDAT-HIGH4(2) '/'
S_BUDAT-HIGH+0(4) INTO HIGH.
CONCATENATE 'Date = ' LOW ' - ' HIGH INTO V_FIN1.
FHEADER-TYP = 'H'.
FHEADER-INFO = V_FIN1.
APPEND FHEADER.
CLEAR FHEADER.
ENDLOOP.
ENDIF.
ENDFORM. " Z_TOP_OF_PAGE
*& Form Z_LAYOUT_SETTINGS
this is done for setting the properties for the layout of the *
grid *
has no formal paramters *
FORM Z_LAYOUT_SETTINGS.
FS_LAYO-ZEBRA = 'X'. " Output in Zebra pattern
FS_LAYO-DETAIL_POPUP = 'X'. " A popup window appears to give
FS_LAYO-DETAIL_TITLEBAR = TEXT-022.
FS_LAYO-COLWIDTH_OPTIMIZE = 'X'.
ENDFORM. " Z_LAYOUT_SETTINGS
*& Form Z_ALV_EVENTS
This is used for handling the events TOP OF PAGE and the USER *
COMMAND event *
has no formal paramters *
FORM Z_ALV_EVENTS.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = FEVENTS[].
READ TABLE FEVENTS WITH KEY NAME = 'TOP_OF_PAGE'.
IF SY-SUBRC = 0.
FEVENTS-FORM = 'Z_TOPOFPAGE'.
MODIFY FEVENTS INDEX SY-TABIX.
CLEAR FEVENTS.
ENDIF.
READ TABLE FEVENTS WITH KEY NAME = 'USER_COMMAND'.
IF SY-SUBRC = 0.
FEVENTS-FORM = 'Z_USER_COMMAND'.
MODIFY FEVENTS INDEX SY-TABIX.
CLEAR FEVENTS.
ENDIF.
ENDFORM. "Z_ALV_EVENTS
*& Form Z_CREATE_FIELD_CATALOG
here the field catalog is created for the primary list *
no formal parameters *
FORM Z_CREATE_FIELD_CATALOG.
for the Plant
FCAT-FIELDNAME = 'WERKS'.
FCAT-KEY = 'X'.
FCAT-OUTPUTLEN = '000005'.
FCAT-JUST = 'L'.
FCAT-SELTEXT_M = 'Plant'.
FCAT-DDICTXT = 'M'.
FCAT-INTTYPE = 'C'.
FCAT-DATATYPE = 'CHAR'.
APPEND FCAT.
CLEAR FCAT.
for the Material Type
FCAT-FIELDNAME = 'MTART'.
FCAT-KEY = 'X'.
FCAT-OUTPUTLEN = '000006'.
FCAT-JUST = 'L'.
FCAT-SELTEXT_M = 'MatTyp'.
FCAT-DDICTXT = 'M'.
FCAT-INTTYPE = 'C'.
FCAT-DATATYPE = 'CHAR'.
APPEND FCAT.
CLEAR FCAT.
for the Material No.
FCAT-FIELDNAME = 'MATNR'.
FCAT-KEY = 'X'.
fcat-hotspot = 'X'.
FCAT-OUTPUTLEN = '000018'.
FCAT-JUST = 'L'.
FCAT-SELTEXT_M = 'Material'.
FCAT-DDICTXT = 'M'.
FCAT-INTTYPE = 'C'.
FCAT-DATATYPE = 'CHAR'.
APPEND FCAT.
CLEAR FCAT.
for the Material Description
FCAT-FIELDNAME = 'MAKTX'.
FCAT-KEY = ''.
FCAT-OUTPUTLEN = '000040'.
FCAT-JUST = 'L'.
FCAT-SELTEXT_M = 'Description'.
FCAT-DDICTXT = 'M'.
FCAT-INTTYPE = 'C'.
FCAT-DATATYPE = 'CHAR'.
APPEND FCAT.
CLEAR FCAT.
for the Unit of Measure
FCAT-FIELDNAME = 'MEINS'.
FCAT-KEY = ''.
FCAT-OUTPUTLEN = '03'.
FCAT-JUST = 'C'.
FCAT-SELTEXT_M = 'UOM'.
FCAT-DDICTXT = 'M'.
FCAT-INTTYPE = 'C'.
FCAT-DATATYPE = 'UNIT'.
APPEND FCAT.
CLEAR FCAT.
for the Plant
FCAT-FIELDNAME = 'MONTH'.
FCAT-KEY = 'X'.
FCAT-OUTPUTLEN = '08'.
FCAT-JUST = 'L'.
FCAT-SELTEXT_M = 'MONTH'.
FCAT-DDICTXT = 'M'.
FCAT-INTTYPE = 'C'.
FCAT-DATATYPE = 'CHAR'.
APPEND FCAT.
CLEAR FCAT.
for the Opening Stock
FCAT-FIELDNAME = 'C_STK'.
FCAT-HOTSPOT = ' '.
FCAT-OUTPUTLEN = '000016'.
FCAT-JUST = 'L'.
FCAT-SELTEXT_M = 'Opening Stock'.
FCAT-DDICTXT = 'M'.
FCAT-INTTYPE = 'Q'.
FCAT-DATATYPE = 'QUAN'.
fcat-do_sum = 'X'.
FCAT-JUST = 'R'.
FCAT-NO_ZERO = 'X'.
APPEND FCAT.
CLEAR FCAT.
for the Total Receipts
FCAT-FIELDNAME = 'TRECEP'.
FCAT-HOTSPOT = ' '.
FCAT-OUTPUTLEN = '000016'.
FCAT-JUST = 'L'.
FCAT-SELTEXT_M = 'Total Receipts'.
FCAT-DDICTXT = 'M'.
FCAT-INTTYPE = 'Q'.
FCAT-DATATYPE = 'QUAN'.
FCAT-DO_SUM = 'X'.
FCAT-JUST = 'R'.
FCAT-NO_ZERO = 'X'.
APPEND FCAT.
CLEAR FCAT.
for the Production
FCAT-FIELDNAME = 'PRODU'.
FCAT-HOTSPOT = ' '.
FCAT-OUTPUTLEN = '000016'.
FCAT-JUST = 'L'.
FCAT-SELTEXT_M = 'Production'.
FCAT-DDICTXT = 'M'.
FCAT-INTTYPE = 'Q'.
FCAT-DATATYPE = 'QUAN'.
FCAT-DO_SUM = 'X'.
FCAT-JUST = 'R'.
FCAT-NO_ZERO = 'X'.
APPEND FCAT.
CLEAR FCAT.
for the Other Plant Receipts
FCAT-FIELDNAME = 'RECEP'.
FCAT-HOTSPOT = ' '.
FCAT-OUTPUTLEN = '000016'.
FCAT-JUST = 'L'.
FCAT-SELTEXT_M = 'Othr Plnt Recpts'.
FCAT-DDICTXT = 'M'.
FCAT-INTTYPE = 'Q'.
FCAT-DATATYPE = 'QUAN'.
FCAT-DO_SUM = 'X'.
FCAT-JUST = 'R'.
FCAT-NO_ZERO = 'X'.
APPEND FCAT.
CLEAR FCAT.
Sales Return
FCAT-FIELDNAME = 'SAL_RET'.
FCAT-HOTSPOT = ' '.
FCAT-OUTPUTLEN = '000016'.
FCAT-JUST = 'L'.
FCAT-SELTEXT_M = 'Sales Return'.
FCAT-DDICTXT = 'M'.
FCAT-INTTYPE = 'Q'.
FCAT-DATATYPE = 'QUAN'.
FCAT-DO_SUM = 'X'.
FCAT-JUST = 'R'.
FCAT-NO_ZERO = 'X'.
APPEND FCAT.
CLEAR FCAT.
Total Dispatches
FCAT-FIELDNAME = 'TDISP'.
FCAT-HOTSPOT = ' '.
FCAT-OUTPUTLEN = '000016'.
FCAT-JUST = 'L'.
FCAT-SELTEXT_M = 'Total Dispatches'.
FCAT-DDICTXT = 'M'.
FCAT-INTTYPE = 'Q'.
FCAT-DATATYPE = 'QUAN'.
FCAT-DO_SUM = 'X'.
FCAT-JUST = 'R'.
FCAT-NO_ZERO = 'X'.
APPEND -
One Consolidated MM Inventory report for all inventories
Hello Experts,
I have a requirement to develop an MM inventory report which should include all the below inventories for a given period. basically I have to display the Quantity, Unit price and Value for all these.
1. Stock Beginning value (Similar to MB5B)
2. Stock period end value (Similar to MB5B)
3. Stock in (MSEG-BWART = 101 and 102 )
4. Total available goods
5. Stock out to project ( MSEG-BWART = 261, 921, 961 )
6. Stock out to Cost center ( MSEG-BWART = 201)
7. Stock difference (MSEG-BWART = 701 and 702)
8. Scraping (MSEG-BWART = 501)
I heard that there are separate transactions for each points above. But Is there any consolidated (Standard or Z)report which includes all the above said information.
Thanks in advance,
BalajiHi,
Pl. explore this report S_P00_07000139, hope it will help you, else you need to develop a Z Report
Regards,
Vikas
Edited by: Vikas Mayekar on Jul 27, 2009 10:57 AM -
Hi SAP GURUS,
1) Is there any standard Raw Material Inventory report that shows value by inventory type (scrap, alloys, principal supplies, spare parts and minor supplies, WIP, finished goods, graphite, and the reserves for those material types
2) A report that shows Scrap receipts by plant u2013 by material and also a report that shows the recycled scrap receipts by type. Would like it to show quantity in lbs and gross tons as well as the value and average cost per gross ton
Thanks
Anusha
Edited by: anusha vemulapati on Jan 19, 2009 3:25 PM
Edited by: anusha vemulapati on Jan 19, 2009 3:25 PMYou try with this report. And selection option is there, select which option you required
Tcode: S_P00_07000139.
It may help full.
Regards
Jrp. -
Hello Dears,
While running the inventory (Material account distribution summary) report at 1-aug -2010,it is an opening balance date of our business , and run another report (inventory value report by subinventory) at the same date for comparing , i found the difference between
the total values of both reports, i do not know why? is there a difference between two reports?
thanksMaterial account distribution summary has txn dates from and to but the Inventory Value Report is to be for the current balances in the sub-inventory. please make sure that the parameters cover similar scop..i.e subinventory,including expense etc
-
Hi all,
There is problem in inventory report.
When i run as report as on date (31.12.2008) total is coming correct its matching with R/3.
But if i add stock of all the material then its not matching.
eg..
Material qty val
m01 10 100
e01 20 200
total 50 700
my total is matching with R/3. but if add stock of material then it is showing as 30 while total is showing 50 which exactly same as R/3. now when i changed the date range (01.01.2008 to 31.12.2008) it shows me follwoing result...
Material qty val
m01 10 100
e01 20 200
f01 [20] [400]
total 50 700
I am not able to understand why its showing result like this ??? So i have to ask my users to run this report large date range ... which is not logical .. .inventory report should be as on date...
Regards,
Viren.Hi,
Create a new Calculated Key-Figure For Value with Exception Aggregation as 'Total' and Reference Characteristic as 'Quantity'.
Please allot points if you find it useful.
Thanks and Regards,
Kuntal. -
Pls some one send me mm inventory report
hi all,'
pls some one send me mm inventory report.
i m facing problem in mm report.
regards
vikas saini.Hai.
check the examople codes.
MM Process flow
The typical procurement cycle for a service or material consists of the following phases:
1. Determination of Requirements
Materials requirements are identified either in the user departments or via materials planning and control. (This can cover both MRP proper and the demand-based approach to inventory control. The regular checking of stock levels of materials defined by master records, use of the order-point method, and forecasting on the basis of past usage are important aspects of the latter.) You can enter purchase requisitions yourself, or they can be generated automatically by the materials planning and control system.
2. Source Determination
The Purchasing component helps you identify potential sources of supply based on past orders and existing longer-term purchase agreements. This speeds the process of creating requests for quotation (RFQs), which can be sent to vendors electronically via SAP EDI, if desired.
3.Vendor Selection and Comparison of Quotations
The system is capable of simulating pricing scenarios, allowing you to compare a number of different quotations. Rejection letters can be sent automatically.
4. Purchase Order Processing
The Purchasing system adopts information from the requisition and the quotation to help you create a purchase order. As with purchase requisitions, you can generate Pos yourself or have the system generate them automatically. Vendor scheduling agreements and contracts (in the SAP System, types of longer-term purchase agreement) are also supported.
5. Purchase Order Follow-Up
The system checks the reminder periods you have specified and - if necessary - automatically prints reminders or expediters at the predefined intervals. It also provides you with an up-to-date status of all purchase requisitions, quotations, and purchase orders.
6. Goods Receiving and Inventory Management
Goods Receiving personnel can confirm the receipt of goods simply by entering the Po number. By specifying permissible tolerances, buyers can limit over- and underdeliveries of ordered goods.
7. Invoice Verification
The system supports the checking and matching of invoices. The accounts payable clerk is notified of quantity and price variances because the system has access to PO and goods receipt data. This speeds the process of auditing and clearing invoices for payment.
example code.
REPORT ZMMBDC1_1 NO STANDARD PAGE HEADING MESSAGE-ID ZT.
Declaration of internal tables
internal table for selecting data from flat file
DATA : BEGIN OF IT_DATA OCCURS 0,
MBRSH, " Industry sector
MTART(4), " Material type
KZSEL, " Checkbox
MAKTX(40), " Material description
MEINS(3), " Base unit of measure
MATKL(9), " Material group
BISMT(18), " Old material number
END OF IT_DATA.
internal table for bdcdata
DATA : IT_BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
internal table to handle messages
DATA : IT_MESSAGES LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.
Variables & Flag declaration
variables declaration
DATA : V_MESG(50).
flag declaration
DATA : FG_BDC,
FG_FLAG1 TYPE I.
selection screen
SELECTION-SCREEN BEGIN OF BLOCK BLK1 WITH FRAME TITLE TEXT-001.
parameter
PARAMETERS : P_FILE LIKE RLGRAP-FILENAME OBLIGATORY.
SELECTION-SCREEN END OF BLOCK BLK1.
initialization
INITIALIZATION.
peform to initialize parameter
PERFORM INIT_PARM.
start of selection
start-of-selection.
perform to upload it_data
PERFORM UP_LOAD_IT_DATA.
perform transfer data
PERFORM TRANSFER_DATA.
end of selection
END-OF-SELECTION.
*& Form INIT_PARM
Initializing parameter
FORM INIT_PARM.
P_FILE = 'C:\'.
ENDFORM. " INIT_PARM
*& Form UP_LOAD_IT_DATA
Transfering data from file to internal table
FORM UP_LOAD_IT_DATA.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
FILENAME = P_FILE
FILETYPE = 'ASC'
TABLES
DATA_TAB = IT_DATA
EXCEPTIONS
CONVERSION_ERROR = 1
FILE_OPEN_ERROR = 2
FILE_READ_ERROR = 3
INVALID_TABLE_WIDTH = 4
INVALID_TYPE = 5
NO_BATCH = 6
UNKNOWN_ERROR = 7
GUI_REFUSE_FILETRANSFER = 8
OTHERS = 9.
IF SY-SUBRC = 2 .
FG_FLAG1 = 1.
MESSAGE I001.
ENDIF.
ENDFORM. " UP_LOAD_IT_DATA
*& Form TRANSFER_DATA
Processing the data
FORM TRANSFER_DATA.
FG_BDC = 'N'.
LOOP AT IT_DATA.
perform to fill it_bdcdata.
PERFORM FILL_IT_BDCDATA.
CALL TRANSACTION 'MM01' USING IT_BDCDATA MODE 'N' UPDATE 'S'
MESSAGES INTO IT_MESSAGES.
IF SY-SUBRC <> 0.
FG_FLAG1 = 1.
if error occurs in transaction mode run bdc session for that data
PERFORM BDC_PROCESS.
ENDIF.
Handles error messages
PERFORM ERROR_MESSAGES.
CLEAR : IT_BDCDATA,IT_DATA,IT_MESSAGES.
REFRESH : IT_BDCDATA,IT_MESSAGES.
ENDLOOP.
IF FG_FLAG1 = 0.
MESSAGE I003.
ENDIF.
IF FG_BDC = 'O'.
close bdc if it is open
PERFORM CLOSE_BDC.
ENDIF.
ENDFORM. " TRANSFER_DATA
*& Form FILL_IT_BDCDATA
Filling Bdcdata structure with it_data
Some fields have been commented for future updations
FORM FILL_IT_BDCDATA.
PERFORM BDC_DYNPRO USING : 'SAPLMGMM' '0060'.
PERFORM BDC_FIELD USING : 'BDC_OKCODE' '/00',
: 'BDC_CURSOR' 'RMMG1_REF-MATNR',
: 'RMMG1-MBRSH' IT_DATA-MBRSH,
: 'RMMG1-MTART' IT_DATA-MTART.
PERFORM BDC_DYNPRO USING : 'SAPLMGMM' '0070'.
PERFORM BDC_FIELD USING : 'BDC_OKCODE' '=RESA'.
PERFORM BDC_DYNPRO USING : 'SAPLMGMM' '0070'.
PERFORM BDC_FIELD USING : 'BDC_OKCODE' '=ENTR',
: 'MSICHTAUSW-KZSEL(01)' IT_DATA-KZSEL.
PERFORM BDC_DYNPRO USING : 'SAPLMGMM' '4000'.
PERFORM BDC_FIELD USING : 'BDC_OKCODE' '=BU',
: 'BDC_SUBSCR' 'SAPLMGMM' & ' 2000TABFRA1',
: 'BDC_SUBSCR' 'SAPLMGD1' & ' 1002SUB1',
: 'BDC_CURSOR' 'MAKT-MAKTX',
: 'MAKT-MAKTX' IT_DATA-MAKTX,
: 'BDC_SUBSCR' 'SAPLMGD1' & ' 2001SUB2',
: 'MARA-MEINS' IT_DATA-MEINS,
: 'MARA-MATKL' IT_DATA-MATKL,
: 'MARA-BISMT' IT_DATA-BISMT,
: 'BDC_OKCODE' '=BU'.
*perform bdc_field using 'MARA-EXTWG' ''.
*perform bdc_field using 'MARA-LABOR' ''.
*perform bdc_field using 'MARA-KOSCH' ''.
*perform bdc_field using 'MARA-MSTAE' ''.
*perform bdc_field using 'MARA-MSTDE' ''.
*perform bdc_field using 'BDC_SUBSCR' 'SAPLMGD1' & ' 2561SUB3'.
*perform bdc_field using 'MARA-BEGRU' ''.
*perform bdc_field using 'BDC_SUBSCR' 'SAPLMGD1' & ' 2007SUB4'.
*perform bdc_field using 'MARA-NTGEW' ''.
*perform bdc_field using 'MARA-BRGEW' ''.
*perform bdc_field using 'MARA-GEWEI' ''.
*perform bdc_field using 'MARA-VOLUM' ''.
*perform bdc_field using 'MARA-VOLEH' ''.
*PERFORM BDC_FIELD USING 'MARA-GROES' ''.
*perform bdc_field using 'MARA-EAN11' ''.
*perform bdc_field using 'MARA-NUMTP' ''.
*PERFORM BDC_FIELD USING 'BDC_SUBSCR' 'SAPLMGD1' & ' 2005SUB5'.
*perform bdc_field using 'BDC_SUBSCR' 'SAPLMGD1' & ' 2011SUB6'.
*perform bdc_field using 'MARA-MAGRV' ''.
ENDFORM. " FILL_IT_BDCDATA
*& Form BDC_DYNPRO
Filling the it_bdcdata table with program name & screen number
FORM BDC_DYNPRO USING PROGRAM LIKE BDCDATA-PROGRAM
DYNPRO LIKE BDCDATA-DYNPRO.
IT_BDCDATA-PROGRAM = PROGRAM.
IT_BDCDATA-DYNPRO = DYNPRO.
IT_BDCDATA-DYNBEGIN = 'X'.
APPEND IT_BDCDATA.
CLEAR IT_BDCDATA.
ENDFORM. " BDC_DYNPRO
*& Form BDC_FIELD
Filling it_bdcdata with field name and field value
FORM BDC_FIELD USING FNAM LIKE BDCDATA-FNAM
FVAL.
IT_BDCDATA-FNAM = FNAM.
IT_BDCDATA-FVAL = FVAL.
APPEND IT_BDCDATA.
CLEAR IT_BDCDATA.
ENDFORM. " BDC_FIELD
*& Form ERROR_MESSAGES
Displaying error messages
FORM ERROR_MESSAGES.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
ID = SY-MSGID
LANG = '-D'
IMPORTING
MSG = V_MESG
EXCEPTIONS
NOT_FOUND = 1
OTHERS = 2.
LOOP AT IT_MESSAGES WHERE MSGTYP = 'E'.
WRITE : / 'Message :'(I06) ,V_MESG.
CLEAR IT_MESSAGES.
ENDLOOP.
ENDFORM. " ERROR_MESSAGES
*& Form BDC_PROCESS
Open bdc session if call transaction fails
FORM BDC_PROCESS.
IF FG_BDC = 'N'.
open bdc session
PERFORM OPEN_BDC.
FG_BDC = 'O'.
ENDIF.
IF FG_BDC = 'O'.
insert data into bdc session
PERFORM INSERT_BDC.
ENDIF.
ENDFORM. " BDC_PROCESS
*& Form OPEN_BDC
Calling function module to open bdc session
FORM OPEN_BDC.
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
CLIENT = SY-MANDT
GROUP = 'SMM1'
KEEP = 'X'
USER = SY-UNAME
EXCEPTIONS
CLIENT_INVALID = 1
DESTINATION_INVALID = 2
GROUP_INVALID = 3
GROUP_IS_LOCKED = 4
HOLDDATE_INVALID = 5
INTERNAL_ERROR = 6
QUEUE_ERROR = 7
RUNNING = 8
SYSTEM_LOCK_ERROR = 9
USER_INVALID = 10
OTHERS = 11.
ENDFORM. " OPEN_BDC
*& Form INSERT_BDC
Insert it_bdcdata into bdc by calling function module bdc_insert
FORM INSERT_BDC.
CALL FUNCTION 'BDC_INSERT'
EXPORTING
TCODE = 'MM01'
TABLES
DYNPROTAB = IT_BDCDATA
EXCEPTIONS
INTERNAL_ERROR = 1
NOT_OPEN = 2
QUEUE_ERROR = 3
TCODE_INVALID = 4
PRINTING_INVALID = 5
POSTING_INVALID = 6
OTHERS = 7.
ENDFORM. " INSERT_BDC
*& Form CLOSE_BDC
Closing bdc session
FORM CLOSE_BDC.
CALL FUNCTION 'BDC_CLOSE_GROUP'
EXCEPTIONS
NOT_OPEN = 1
QUEUE_ERROR = 2
OTHERS = 3.
ENDFORM. " CLOSE_BDC
example code.
report ZMMBDCP_MATERIAL_PRICE
no standard page heading
line-size 255.
Includes
include zbdcrecx1.
Tables
TABLES : MARA.
Internal Tables
*--Internal Table To hold Material Price data from flat file.
Data: begin of it_mat_price occurs 0,
key(4),
f1(10), " date
f2(4), " Company Code
f3(4), " Plant
f4(18), " material
f5(15), " Price
end of it_mat_price.
*--Internal Table To hold Material Price header Data .
data : begin of it_header occurs 0,
key(4),
f1(10),
f2(4),
f3(4),
end of it_header.
*--Internal Table To hold Material Price details data .
data : begin of it_details occurs 0,
key(4),
f4(18),
f5(15),
end of it_details.
Variables
data : v_sno(2), " Serial Number
v_rows type i, " Number of Rows
v_fname(40). " To store Field Name
Start of Selection
start-of-selection.
clear it_mat_price.
refresh it_mat_price.
clear it_header.
refresh it_header.
clear it_details.
refresh it_details.
WRITE : / 'Upload Material Price Change from ',
P_FNAME, ' on ', SY-DATUM.
*--To Upload Material Price Data from Flat file.
CALL FUNCTION 'UPLOAD'
EXPORTING
FILENAME =
'C:\WINDOWS\Desktop\mat_price_change.txt'
FILETYPE = 'DAT'
TABLES
DATA_TAB = it_mat_price
EXCEPTIONS
CONVERSION_ERROR = 1
INVALID_TABLE_WIDTH = 2
INVALID_TYPE = 3
NO_BATCH = 4
UNKNOWN_ERROR = 5
GUI_REFUSE_FILETRANSFER = 6
OTHERS = 7.
OPEN DATASET P_FNAME FOR INPUT IN TEXT MODE.
IF SY-SUBRC NE 0.
WRITE : / 'File could not be opened. Please check file name.'.
STOP.
ENDIF.
CLEAR : it_mat_price[], it_mat_price.
DO.
READ DATASET P_FNAME INTO V_STR.
IF SY-SUBRC NE 0.
EXIT.
ENDIF.
write v_str.
translate v_str using '#/'.
SPLIT V_STR AT ',' INTO it_mat_price-key
it_mat_price-F1 it_mat_price-F2
it_mat_price-F3 it_mat_price-F4
it_mat_price-F5.
APPEND it_mat_price.
CLEAR it_mat_price.
ENDDO.
IF it_mat_price[] IS INITIAL.
WRITE : / 'No data found to upload'.
STOP.
ENDIF.
*--Separating Header & Details Records
loop at it_mat_price.
At new key.
read table it_mat_price index sy-tabix.
move-corresponding it_mat_price to it_header. " Header
append it_header.
clear it_header.
endat.
move-corresponding it_mat_price to it_details. " Details
append it_details.
clear it_details.
endloop.
*--Perform to open Session
perform open_group.
*--To get Number of rows for Table Control
v_rows = sy-srows - 13.
*--Looping on Header record
loop at it_header.
perform bdc_dynpro using 'SAPRCKM_MR21' '0201'.
perform bdc_field using 'BDC_CURSOR'
'MR21HEAD-WERKS'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_field using 'MR21HEAD-BUDAT'
it_header-f1.
perform bdc_field using 'MR21HEAD-BUKRS'
it_header-f2.
perform bdc_field using 'MR21HEAD-WERKS'
it_header-f3.
perform bdc_field using 'MR21HEAD-SCREEN_VARIANT'
'MR21_LAGERMATERIAL_0250'.
v_sno = 0.
*--Looping On detials record.
loop at it_details where key eq it_header-key.
SELECT SINGLE MATNR INTO IT_DETAILS-F4
FROM MARA
WHERE BISMT EQ IT_DETAILS-F4.
if v_sno le v_rows.
v_sno = v_sno + 1.
endif.
perform bdc_dynpro using 'SAPRCKM_MR21' '0201'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
clear v_fname.
CONCATENATE 'CKI_MR21_0250-MATNR(' V_SNO ')' INTO V_FNAME.
perform bdc_field using v_fname
it_details-f4.
clear v_fname.
CONCATENATE 'CKI_MR21_0250-NEWVALPR(' V_SNO ')' INTO V_FNAME.
perform bdc_field using v_fname
it_details-f5.
endloop.
perform bdc_dynpro using 'SAPRCKM_MR21' '0201'.
perform bdc_field using 'BDC_OKCODE'
'=SAVE'.
perform bdc_field using 'BDC_CURSOR'
'MR21HEAD-SCREEN_VARIANT'.
perform bdc_field using 'MR21HEAD-SCREEN_VARIANT'
'MR21_LAGERMATERIAL_BWKEY_0250'.
*--Call Transaction to upadate New price
perform bdc_transaction using 'MR21'.
endloop.
perform close_group.
regards.
sowjanya.b -
Facing Problem with passing Values from One report to another
Hi,
I am Hemanth, I have developed 2 reports. Firast Report High Level Summary, Secong is detailed. First report is developed using Union(4 union) , I am having 4 columns. The report is generating the data. I have used Navigation option on Client Column to move on to Second report. In Second report with in Filter i am using Prompted option. Due to some problem, the client value from first report is not passing to the second one. The second report is getting generated for all the clients.
Normally i have used this Navigate option in other reports and that works fine. I have even tested with Union, it works. This time it is giving some trouble.
Please, let me know whats going wrong.
Thanks for the help.sorry for the late updation.
My First Report, Summary level is a Pivot Table.
I tried the same report with Table option, the value is passing correctly.
Is there a way to get rid of this situation using Pivot table.
Thanks for your help.
below is the original request.
Hi,
I am Hemanth, I have developed 2 reports. Firast Report High Level Summary, Secong is detailed. First report is developed using Union(4 union) , I am having 4 columns. The report is generating the data. I have used Navigation option on Client Column to move on to Second report. In Second report with in Filter i am using Prompted option. Due to some problem, the client value from first report is not passing to the second one. The second report is getting generated for all the clients.
Normally i have used this Navigate option in other reports and that works fine. I have even tested with Union, it works. This time it is giving some trouble.
Please, let me know whats going wrong.
Thanks for the help.
Maybe you are looking for
-
Ms Excel move automatically without pressing Enter or Tab to the next cell
Hi, I wonder if it is possible to make Ms Excel move automatically without pressing Enter or Tab to the next cell once a certain number of digits is entered, for example, I'm using a barcode scanner to scan a barcode of 13 digits, so I want Excel to
-
I'm GLAD I DID NOT INSTALL THIS AMP what a headache
WOW am I glad I read the forums befor I downloaded this JUNK of a player. To many people with to many problems to use this sorry AMP!! You can't even uninstall it and it wants to load up at start up. The softwear for the AMP should be in the add/remo
-
Why am I not able to upload my video nor am I able to watch a video on Facebook with my mac.
I am unable to upload my videos nor am I able to watch videos ( it shows me HMTL5) on facebook. I am alsohaving trouble editing my photo on photobucket.This one shows flash Not sure why it's doing this... PLEA
-
Completed Sched. Agreements are still in due list.
Hi All, There is a problem where in the Scheduling aggreements which are completed still appear in the Delivery due list. I checked all the deliveries which are created for the particular Scheduling aggreement.But I could not find any delivery which
-
Application manager failing to update with this message!
Adobe Photoshop 13.0.3 There was an error installing this update. Please quit and try again later. Error Code: U44M1I210 Adobe Illustrator CS6 Update (version 16.0.3) There was an error installing this update. Please quit and try again later. Error C