OPEN PO QTY IN PARTICULAR DATE
Hi Experts
I need to check the open qty of purchase order bcoz i have to upload the PO from old system to new system.
so i want to get the Open Purchase order qty from particular date say 1st april .
so that i can upload the same into new System with upload programme.
Thanks
Pankaj Agarwal
Hi
check following link
[Report including open purchase order quantity for one storage location;
[http://wiki.sdn.sap.com/wiki/display/sandbox/OPENPOQTYREPORT-CODE]
Regards
Kailas Ugale
Similar Messages
-
PO OPEN QTY AT PARTICULAR DATE
Hi Experts
I need to check the open qty of purchase order bcoz i have to upload the PO from old system to new system.
so i want to get the Open Purchase order qty from particular date say 1st april .
so that i can upload the same into new System with upload programme.
Thanks
Pankaj AgarwalIf the legacy system is also a SAP system, you may refer to ME2* series reports (eg: ME2M, ME2N, etc).
As regards to open, it depends on the definition of open PO, so PO's which are not delivered, those delivered but not invoiced etc. So use the selection parameter eg: WE101 to get the relevant data.
If you wish to do the same at table level, then some of the tables which should help are EKKO,EKPO,EKBE,EKET,MSEG.
However if the legacy system is not a SAP system, then get in touch with the client's IT team to do the extraction.
Also do search in MM forum to find similar threads. -
How to calculate Opening Stock for a particular date.
Hi Experts,
I have a sitution to calculate Opening stock for a particular date.
please help me with the necessary Fields & Tables required.
Appriciate If any Sample coding available.
Thanks & regards,
Venkat.Hi Venkat,
To Calculate Opening Stock & Closing stock there are different procedures.
It just depends of\n the client requirements & usage of the material.
For example, we have different types of stocks, like, Through Pipeline, Special, Unristricted, quality, safety,
and many types of stocks.... so all these types are indicated in MSEG tabe in SOBTZ field,...
Now Comimg to your Query, You need to calculate OPENING & CLOSING STOCK.
We have a similiar standard report in MB5B Tcode..
to get the same results in your report do like this...
For valuated stock go to the MARDH, MBEWH, MCHBH tables But I Prefer MBEWH.
here in MBEWH give the month & year and you get the result in LBKUM field...
For Special stock, You need to go to another table like MKOLH,,(I forgot still 2 more) and
give the month & year inputs and you will get the result in SLABS field.
and remaining MB5B refers to its deetails lists with different Movement types,
whcih you can get clearly from MSEG Table...
Hope you can write the select Queries accordingly.
Thanks & Regards,
Dileep .C -
Stock value and qty on particular date.
Hi All.
Could you you guide me in which transcation I will get the report of existing stock value and qty for a particular valution class on particular date like 15 Apr 2009.There is a transaction MB5B similar to my requirement but there is no Valuation class as selection.
Thanks in Advance
Regards
kattaHi,
You can get valuation class data thru MC.9 or MC.1 but problem is it is for month only
If you want to go for particular material analysis than use MB51 from go live to till date or MB5b with storage location selection
Regards,
Chetan Mistry -
Functional Specification For Opening And closing stock On Particular Date
Dear Gurus,
I am creating report for opening and closing stock on particular date in which batch and storage location should also be included. I want to know the tables and fields for the same.I have searched the forum and got report on month basis but I want this report on posting day basis.kindly suggest tables and fields. Thanks in AdvanceDear sir,
There are many other colums that client wants to add which are not present in MB5B transaction.columns which client wants to add are as follows...
Material Number
Material Description
Material Type
Material Group
External material Group
Movement Type
Plant
Storage Location
Customer Number
Customer Name
Vendor Number
Vendor Name
Posting Date Receipt Doc. Number
Issue Doc. Number
Reference Issue Document Number
Opening Stock Quanity
Material Receipt Quantity
Material Issue Quantity
Material Closing Stock Quantity
Value Of Closing Stock
And for this I want tables and logic for the same. kindly provide the solution for the same. -
How to get a opening stock of a material on a particular date
Hi,
Could you pls provide me the logic of how to get the opening stock of the material on a particular date. I searched the forum and found the logic to fetch the closing stock at a given period but not for a date.
An immediate response would be really appreciated.
Thanks
HarrisDear,
Please read following part of my code
FORM GET_OPENING .
IF IT_FINAL[] IS NOT INITIAL.
SELECT * FROM MARD
INTO CORRESPONDING FIELDS OF TABLE IT_MARD
FOR ALL ENTRIES IN IT_FINAL
WHERE MATNR = IT_FINAL-MATNR
AND WERKS = '1000'.
SELECT A~MBLNR A~MJAHR A~BUDAT B~WAERS B~ZEILE B~BWART B~MATNR B~WERKS B~LGORT B~CHARG B~SHKZG B~MENGE B~MEINS B~BUSTM B~XAUTO
INTO CORRESPONDING FIELDS OF TABLE IT_MKPF
FROM MKPF AS A JOIN MSEG AS B
ON A~MANDT = B~MANDT
AND A~MBLNR = B~MBLNR
AND A~MJAHR = B~MJAHR
FOR ALL ENTRIES IN IT_FINAL
WHERE B~MATNR = IT_FINAL-MATNR
AND A~BUDAT GE P_BUDAT-LOW
AND B~WERKS = '1000'.
ENDIF.
AKTDAT = SY-DATLO + 30.
IF NOT ( P_BUDAT-HIGH IS INITIAL OR P_BUDAT-HIGH > AKTDAT ).
LOOP AT IT_MKPF INTO WA_MKPF WHERE BUDAT > P_BUDAT-HIGH.
MOVE-CORRESPONDING WA_MKPF TO IT_MKPF1.
APPEND IT_MKPF1.
DELETE IT_MKPF.
ENDLOOP.
ENDIF.
SORT IT_MKPF1 BY WERKS MATNR SHKZG.
LOOP AT IT_MKPF1.
IF ( IT_MKPF1-XAUTO IS INITIAL ) OR
( IT_MKPF1-BUSTM <> 'MA02' AND IT_MKPF1-BUSTM <> 'MA05' ) .
MOVE-CORRESPONDING IT_MKPF1 TO IT_MAT.
COLLECT IT_MAT.
ELSE.
DELETE IT_MKPF1.
ENDIF.
ENDLOOP.
SORT IT_MKPF BY WERKS MATNR SHKZG DESCENDING.
LOOP AT IT_MKPF INTO WA_MKPF.
IF ( WA_MKPF-XAUTO IS INITIAL ) OR
( WA_MKPF-BUSTM <> 'MA02' AND
WA_MKPF-BUSTM <> 'MA05' ).
MOVE-CORRESPONDING WA_MKPF TO T_MAT.
COLLECT T_MAT.
ELSE.
DELETE IT_MKPF.
ENDIF.
ENDLOOP.
LOOP AT IT_MARD.
CLEAR IT_MAT-MENGE.
MOVE-CORRESPONDING IT_MARD TO FINAL.
READ TABLE IT_MAT WITH KEY WERKS = IT_MARD-WERKS
LGORT = IT_MARD-LGORT
MATNR = IT_MARD-MATNR
SHKZG = 'S'.
FINAL-ENDMENGE = IT_MARD-LABST + IT_MARD-INSME + IT_MARD-SPEME + IT_MARD-EINME + IT_MARD-RETME - IT_MAT-MENGE.
CLEAR IT_MAT-MENGE.
READ TABLE IT_MAT WITH KEY WERKS = IT_MARD-WERKS
LGORT = IT_MARD-LGORT
MATNR = IT_MARD-MATNR
SHKZG = 'H'.
FINAL-ENDMENGE = FINAL-ENDMENGE + IT_MAT-MENGE.
COLLECT FINAL.
ENDLOOP.
LOOP AT FINAL.
CLEAR T_MAT-MENGE.
READ TABLE T_MAT WITH KEY WERKS = FINAL-WERKS
MATNR = FINAL-MATNR
SHKZG = 'S'.
MOVE T_MAT-MENGE TO FINAL-SOLL.
CLEAR T_MAT-MENGE.
READ TABLE T_MAT WITH KEY WERKS = FINAL-WERKS
MATNR = FINAL-MATNR
SHKZG = 'H'.
MOVE T_MAT-MENGE TO FINAL-HABEN.
FINAL-ANFMENGE = FINAL-ENDMENGE - FINAL-SOLL + FINAL-HABEN.
MODIFY FINAL.
ENDLOOP.
LOOP AT FINAL.
WA_FINAL1-MATNR = FINAL-MATNR.
WA_FINAL1-MEINS = FINAL-MEINS.
WA_FINAL1-OP_MENGE = FINAL-ANFMENGE.
WA_FINAL1-RE_MENGE = FINAL-SOLL.
WA_FINAL1-IS_MENGE = FINAL-HABEN.
WA_FINAL1-CL_MENGE = FINAL-ENDMENGE.
* WA_FINAL-LGORT = FINAL-LGORT.
* READ TABLE IT_MAKT WITH KEY MATNR = FINAL-MATNR.
* MOVE IT_MAKT-MAKTX TO WA_FINAL-MAKTX.
APPEND WA_FINAL1 TO IT_FINAL1.
ENDLOOP.
ENDFORM. " GET_OPENING -
Deleting open notification of a user till particular date.
Hi,
How can i delete open notifications (in bulk) of a user untill some date. Like if i want to delete all open notifications of any particular user till 15th Mar 2012.
Thank you.
Edited by: 906610 on Sep 8, 2012 10:40 PMHi;
What is EBS version? Did you see below thread:
Re: how to delete(purge) old Workflow Notification from application?
Regard
Helios -
Open PO List as on particular date
Hi all,
I need a report which will give me the Open purchase orders as on particular date.
For example: the report of open PO as on 31st March shold be viewed on 25th April.
Is there any standard reports which will fulfill this requirement. I already checked with ME2L/ME2M where you have the option of giving delivery date. That won't meet my requirement.
Please help me out.
Thanks in advance,
ManjuAssume you have a PO that was created in April, received in June, invoiced in July.
today is August and you want list open POs of May.
So you have to read POs that where created before May, and have to check whether they are still open.
if so you can directly list.
if not open, then you have to find the documents that closed the PO, have to find the date when they got createdor changed and have to compare this with the date you want see the open POs. Depending they were created after this date you can consider the PO as open, ................
For what reason do you need such a report, what benefit will this report give to anybody? -
Is ther a FM to get the open order qty for a particular material &salesorg?
Hi experts,
I have requirement to find the open order qty for a given sales org (plant will be even better ) and material in my report. I do not want to use the standard tables as i need to fetch all records without any time restriction.So it is takin a lot of time.
I know i can find it in va05 but i want to know if ther is some standard function module which can serve this purpose.
Kindly help.
regards
AshwinThanks for the reply,
Can you kindly elaborate what i need to pass to the function module ?
What do I have to pass in the tables LVBMTV and LSELTAB ?
In which field will i get the open quantity for the material and salesorg ?
Kindly help,
Regards
Ashwin -
Report listing Material and Open PO Qty
Hello,
Is there a standard report that can give me the following?
Material | Open PO Qty
This would be specified for a particular purchasing organization, they are just looking for what is currently on order amongst all of their materials and they do not want to see the purchase order # in the report...just a total of what is on order. Any help would be greatly appreciated. I have tried looking into transaction ME2M but unfortunately WE101 scope of list isn't a selectable option for us.
Thank you,
AndyThank you for the responses. I solved this by going into transaction ME80FN, specifying a specific purchasing organization and all purchase orders over a fixed period for document date (I used the beginning of this year to today). I then execute this, select the "Delivery Schedule" layout and export this into Excel. Subtract Quantity Delivered from the Scheduled Quantity via a PivotTable, and this can give me a list of open PO's for a specific material.
Not the easiest way to find the information, but it does work using a standard report. For more consistent reporting ABAP development would probably be recommended. -
Inventory cube 0IC_C03 ,Stock on particular date
Hi All,
We are trying to get the stock on a particular date using cube 0IC_C03 ,but we are unable to get the total stock on a given date.
1)Ex: I want stock on 01.12.2009 ,but in the query output I am getting null values.
I am only getting the total stock quantity on the loaded date for ex:04.01.2010(which is my data loading date in to the cube).
2)And when we restrict 0calday with <=01.12.2009 ,i have to get the total stock till 01.12.2009
Thanks®ards,
SunithaHi,
Check
Treatment of historical full loads with Inventory cube
Setting up material movement/inventory with limit locking time
1)Ex: I want stock on 01.12.2009 ,but in the query output I am getting null values.
I am only getting the total stock quantity on the loaded date for ex:04.01.2010(which is my data loading date in to the cube).
For 2LIS_03_BX it will give the extracted date only
2)And when we restrict 0calday with <=01.12.2009 ,i have to get the total stock till 01.12.2009
try with below options.
Use :
0VALSTCKVAL " for Value
0VALSTCKQTY " for Qty
0CALMONTH " for Month
Use the above combinations in New Selections in columns and go it.
For Qty Opening:
New Selection bad drag abd drop following things
0VALSTCKQTY " for Qty
0CALMONTH " for Month and restrict with less then or equalto option variable (single value, user input) and set the offeset
value = -1 bcoz if user will give 12.2009 , so it will display 11.2009 closing stock, this is opening for 12.2009.
For Qty Closing:
New Selection bad drag abd drop following things
0VALSTCKQTY " for Qty
0CALMONTH " for Month and restrict with less then or equalto option variable (single value, user input) .
In the same way build for Value and other Keyfigures on 0IC_C03.
And
Drag & drop
0MATERAIL
0PLANT " Give some Input Variable.
See the steps.
Treatment of historical full loads with Inventory cube
Setting up material movement/inventory with limit locking time
If it is BI 7 then for BX in in DTP in Extraction Tab you need to select Extacrion mode = NON-Cumulative option.
Thanks
Reddy -
Closing stock of a particular date
how to get plant wise material closing stock on any particular date. say previous months end date. I am calculating that from MSEG table with the help of MSEGINSMK and MSEGSHKZG field. (with date filtaration by joining MBLNR of MKPF table) But stock is showing different with the closing stock showing in MB5B report for that date. I don't know which BWART of MSEG table to be excluded. My email id is [email protected]
Hi,
This is a stock aging report, you can use this for reference.
Logic: Based on current stock and value from MBEW table. The latest receipt dates were taken till the qty tallies off.Rejections and reversals are considered.
The movement types considered are ('101','102','105','106','122','123','131','132','301','302','309','310','501','502','531','532','561','562','701','702').
*& Report ZMM03_TRY *
REPORT ZMM03 LINE-SIZE 226
LINE-COUNT 35(2)
NO STANDARD PAGE HEADING..
TABLES : S032, "Current Stock And Grouping Terms
MBEW, "Material Valuation
T023T, "Material Group Desc.
MAKT, "Material Description
EKPO. "Purchasing Document Item.
DATA : BEGIN OF T_HEADER OCCURS 0,
MTART LIKE MARA-MTART,
MATNR LIKE MBEW-MATNR,
BWKEY LIKE MBEW-BWKEY,
MATKL LIKE MARA-MATKL,
MAKTX LIKE MAKT-MAKTX,
MEINS LIKE MARA-MEINS,
LBKUM LIKE MBEW-LBKUM,
SALK3 LIKE MBEW-SALK3,
VERPR LIKE MBEW-VERPR,
CLSTK LIKE MBEW-LBKUM,
CLVAL LIKE CKMLCR-SALK3,
UNIT LIKE CKMLCR-PVPRS,
END OF T_HEADER.
DATA : BEGIN OF T_MSEG OCCURS 0,
MATNR LIKE MSEG-MATNR,
WERKS LIKE MSEG-WERKS,
BUDAT LIKE MKPF-BUDAT,
MBLNR LIKE MKPF-MBLNR,
MJAHR LIKE MKPF-MJAHR,
ZEILE LIKE MSEG-ZEILE,
LFBNR LIKE MSEG-LFBNR,
LFBJA LIKE MSEG-LFBJA,
LFPOS LIKE MSEG-LFPOS,
BWART LIKE MSEG-BWART,
MENGE LIKE MSEG-MENGE,
EBELN LIKE MSEG-EBELN,
EBELP LIKE MSEG-EBELP,
XAUTO LIKE MSEG-XAUTO,
UMMAT LIKE MSEG-UMMAT,
UMWRK LIKE MSEG-UMWRK,
MARK(1),
END OF T_MSEG.
TYPE-POOLS : SLIS.
DATA : L_STOCK TYPE MSEG-MENGE.
DATA : WA_MSEG LIKE T_MSEG.
DATA : WA_MSEG1 LIKE T_MSEG.
DATA : T_ITEMS LIKE T_MSEG OCCURS 0 WITH HEADER LINE.
DATA : T_CUR_STOCK LIKE T_MSEG OCCURS 0 WITH HEADER LINE.
DATA : L_LBKUM TYPE MBEW-LBKUM.
DATA : BEGIN OF T_OUTPUT OCCURS 0,
WERKS LIKE MSEG-WERKS,
MATNR LIKE MSEG-MATNR,
BUDAT LIKE MKPF-BUDAT,
MENGE LIKE MSEG-MENGE,
PDAYS TYPE I,
PVAL TYPE MSEG-MENGE,
MAKTX LIKE MAKT-MAKTX,
CQTY LIKE MSEG-MENGE,
CPRC LIKE MBEW-SALK3,
END OF T_OUTPUT.
DATA: GRID_TAB TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE.
DATA : T_SORT TYPE SLIS_T_SORTINFO_ALV,
WA_SORT TYPE SLIS_SORTINFO_ALV.
*AT SELECTION-SCREEN.
SELECTION-SCREEN BEGIN OF BLOCK 1 WITH FRAME TITLE TEXT-014.
SELECTION-SCREEN SKIP 1.
PARAMETERS : P_DATE LIKE S032-LETZTABG OBLIGATORY DEFAULT SY-DATUM.
SELECTION-SCREEN SKIP 1.
SELECTION-SCREEN END OF BLOCK 1.
SELECTION-SCREEN BEGIN OF BLOCK 2 WITH FRAME TITLE TEXT-015.
PARAMETERS : P_WERKS TYPE S032-WERKS OBLIGATORY.
SELECT-OPTIONS : S_LGORT FOR S032-LGORT,
S_MATNR FOR S032-MATNR.
SELECTION-SCREEN END OF BLOCK 2.
SELECTION-SCREEN BEGIN OF BLOCK 3 WITH FRAME TITLE TEXT-016.
SELECT-OPTIONS : S_MTART FOR S032-MTART,
S_MATKL FOR S032-MATKL.
SELECTION-SCREEN END OF BLOCK 3.
IF P_DATE IS INITIAL AND
P_WERKS IS INITIAL AND
S_LGORT IS INITIAL AND
S_MATNR IS INITIAL AND
S_MTART IS INITIAL AND
S_MATKL IS INITIAL.
MESSAGE I398(00) WITH 'Enter Selection Critirea'(019).
SY-SUBRC = '1'.
ELSE.
SELECT AMATNR ABWKEY BMATKL BMTART CMAKTX BMEINS A~LBKUM
A~SALK3
INTO CORRESPONDING FIELDS OF TABLE T_HEADER
FROM MBEW AS A INNER JOIN MARA AS B ON AMATNR = BMATNR
INNER JOIN MAKT AS C ON AMATNR = CMATNR
WHERE A~MATNR IN S_MATNR
AND A~BWKEY EQ P_WERKS
AND MATKL IN S_MATKL
AND MTART IN S_MTART
AND BWTAR EQ ' '
AND C~SPRAS = SY-LANGU.
IF SY-SUBRC EQ 0.
SELECT ABUDAT AMBLNR AMJAHR BZEILE BMATNR BWERKS B~BWART
BMENGE BLFBNR BLFBJA BLFPOS BEBELN BEBELP B~XAUTO
BUMMAT BUMWRK
INTO CORRESPONDING FIELDS OF TABLE T_MSEG
FROM MKPF AS A INNER JOIN MSEG AS B ON AMBLNR = BMBLNR
AND AMJAHR = BMJAHR
FOR ALL ENTRIES IN T_HEADER
WHERE A~BUDAT <= P_DATE
AND B~MATNR = T_HEADER-MATNR
AND B~WERKS = T_HEADER-BWKEY
AND B~BWART IN ('101',
'102',
'105',
'106',
'122',
'123',
'301',
'302',
'701',
'702',
'131',
'132',
'309',
'310',
'501',
'502',
'531',
'532',
'561',
'562').
PERFORM GET_DEAD_STOCK.
PERFORM DISPLAY_OUTPUT.
ELSE.
MESSAGE S398(00) WITH 'No Data found for'(013)
'Given Selection Critirea'(017).
LEAVE LIST-PROCESSING.
ENDIF.
ENDIF.
*& Form get_dead_stock
text
FORM GET_DEAD_STOCK .
LOOP AT T_HEADER.
SORT T_MSEG BY MATNR WERKS BUDAT DESCENDING MBLNR DESCENDING.
LOOP AT T_MSEG WHERE MATNR = T_HEADER-MATNR
AND WERKS = T_HEADER-BWKEY
AND ( BWART = '101' OR
BWART = '105' OR
BWART = '501' OR
BWART = '531' OR
BWART = '561' OR
BWART = '701' OR
BWART = '309' OR
BWART = '301' OR
BWART = '131' ).
IF T_MSEG-BWART = 101.
READ TABLE T_MSEG WITH KEY LFBNR = T_MSEG-MBLNR
LFBJA = T_MSEG-MJAHR
LFPOS = T_MSEG-ZEILE
BWART = 102.
IF SY-SUBRC = 0.
T_MSEG-MARK = 'X'.
MODIFY T_MSEG.
CONTINUE.
ENDIF.
READ TABLE T_MSEG INTO WA_MSEG WITH KEY LFBNR = T_MSEG-MBLNR
LFBJA = T_MSEG-MJAHR
LFPOS = T_MSEG-ZEILE
BWART = 122.
IF SY-SUBRC = 0.
READ TABLE T_MSEG INTO WA_MSEG1 WITH KEY LFBNR = WA_MSEG-MBLNR
LFBJA = WA_MSEG-MJAHR
LFPOS = WA_MSEG-ZEILE
BWART = 123.
IF SY-SUBRC EQ 0.
WA_MSEG-MARK = 'X'.
MODIFY T_MSEG FROM WA_MSEG.
CONTINUE.
ELSE.
IF T_MSEG-MENGE EQ WA_MSEG-MENGE.
T_MSEG-MARK = 'X'.
MODIFY T_MSEG.
CONTINUE.
ELSE.
T_MSEG-MENGE = T_MSEG-MENGE - WA_MSEG-MENGE.
MODIFY T_MSEG.
ENDIF.
ENDIF.
ENDIF.
ELSEIF T_MSEG-BWART = 105.
READ TABLE T_MSEG INTO WA_MSEG WITH KEY LFBNR = T_MSEG-MBLNR
LFBJA = T_MSEG-MJAHR
LFPOS = T_MSEG-ZEILE
BWART = 106.
IF SY-SUBRC = 0.
T_MSEG-MARK = 'X'.
MODIFY T_MSEG.
CONTINUE.
ENDIF.
ELSEIF T_MSEG-BWART = 131.
READ TABLE T_MSEG INTO WA_MSEG WITH KEY LFBNR = T_MSEG-MBLNR
LFBJA = T_MSEG-MJAHR
LFPOS = T_MSEG-ZEILE
BWART = 132.
IF SY-SUBRC = 0.
T_MSEG-MARK = 'X'.
MODIFY T_MSEG.
CONTINUE.
ENDIF.
ELSEIF T_MSEG-BWART = 501.
READ TABLE T_MSEG WITH KEY LFBNR = T_MSEG-MBLNR
LFBJA = T_MSEG-MJAHR
LFPOS = T_MSEG-ZEILE
BWART = 502.
IF SY-SUBRC = 0.
T_MSEG-MARK = 'X'.
MODIFY T_MSEG.
CONTINUE.
ENDIF.
ELSEIF T_MSEG-BWART = 301.
READ TABLE T_MSEG WITH KEY LFBNR = T_MSEG-MBLNR
LFBJA = T_MSEG-MJAHR
LFPOS = T_MSEG-ZEILE
BWART = 302.
IF SY-SUBRC = 0.
T_MSEG-MARK = 'X'.
MODIFY T_MSEG.
CONTINUE.
ENDIF.
ELSEIF T_MSEG-BWART = 531.
READ TABLE T_MSEG WITH KEY LFBNR = T_MSEG-MBLNR
LFBJA = T_MSEG-MJAHR
LFPOS = T_MSEG-ZEILE
BWART = 532.
IF SY-SUBRC = 0.
T_MSEG-MARK = 'X'.
MODIFY T_MSEG.
CONTINUE.
ENDIF.
ELSEIF T_MSEG-BWART = 561.
READ TABLE T_MSEG WITH KEY LFBNR = T_MSEG-MBLNR
LFBJA = T_MSEG-MJAHR
LFPOS = T_MSEG-ZEILE
BWART = 562.
IF SY-SUBRC = 0.
T_MSEG-MARK = 'X'.
MODIFY T_MSEG.
CONTINUE.
ENDIF.
ELSEIF T_MSEG-BWART = 701.
READ TABLE T_MSEG WITH KEY LFBNR = T_MSEG-MBLNR
LFBJA = T_MSEG-MJAHR
LFPOS = T_MSEG-ZEILE
BWART = 702.
IF SY-SUBRC = 0.
T_MSEG-MARK = 'X'.
MODIFY T_MSEG.
CONTINUE.
ENDIF.
ELSEIF T_MSEG-BWART = 309.
READ TABLE T_MSEG WITH KEY LFBNR = T_MSEG-MBLNR
LFBJA = T_MSEG-MJAHR
LFPOS = T_MSEG-ZEILE
BWART = 310.
IF SY-SUBRC = 0.
T_MSEG-MARK = 'X'.
MODIFY T_MSEG.
CONTINUE.
ELSEIF T_MSEG-XAUTO = ' '.
T_MSEG-MARK = 'X'.
MODIFY T_MSEG.
CONTINUE.
ELSEIF T_MSEG-MATNR EQ T_MSEG-UMMAT.
T_MSEG-MARK = 'X'.
MODIFY T_MSEG.
CONTINUE.
ENDIF.
ENDIF.
SELECT SINGLE EBELN INTO EKPO-EBELN FROM EKPO
WHERE EBELN = T_MSEG-EBELN
AND EBELP = T_MSEG-EBELP
AND KNTTP = 'K'.
IF SY-SUBRC = 0.
T_MSEG-MARK = 'X'.
MODIFY T_MSEG.
CONTINUE.
ENDIF.
TMENGE = TMENGE - t_mseg-MENGE.
ENDLOOP.
ENDLOOP.
DELETE T_MSEG WHERE MARK = 'X'.
DELETE T_MSEG WHERE ( BWART = '102' OR
BWART = '106' OR
BWART = '502' OR
BWART = '532' OR
BWART = '562' OR
BWART = '702' OR
BWART = '310' OR
BWART = '302' OR
BWART = '123' OR
BWART = '122' OR
BWART = '132' ).
SORT T_HEADER BY MATNR BWKEY.
DELETE ADJACENT DUPLICATES FROM T_HEADER COMPARING MATNR BWKEY.
T_CUR_STOCK[] = T_MSEG[].
SORT T_CUR_STOCK BY MATNR WERKS.
LOOP AT T_CUR_STOCK.
WA_MSEG = T_CUR_STOCK.
AT END OF WERKS.
ENDAT.
ENDLOOP.
LOOP AT T_HEADER.
CLEAR L_LBKUM.
L_LBKUM = T_HEADER-LBKUM.
REFRESH T_ITEMS.
CLEAR T_ITEMS.
LOOP AT T_MSEG WHERE MATNR EQ T_HEADER-MATNR
AND WERKS EQ T_HEADER-BWKEY.
T_ITEMS = T_MSEG.
APPEND T_ITEMS.
CLEAR T_ITEMS.
ENDLOOP.
SORT T_ITEMS BY BUDAT DESCENDING
MBLNR DESCENDING.
CLEAR L_LBKUM.
LOOP AT T_ITEMS.
L_LBKUM = T_ITEMS-MENGE - T_HEADER-LBKUM.
IF L_LBKUM GE 0.
T_OUTPUT-MATNR = T_HEADER-MATNR.
T_OUTPUT-WERKS = T_HEADER-BWKEY.
T_OUTPUT-BUDAT = T_ITEMS-BUDAT.
T_OUTPUT-MENGE = T_HEADER-LBKUM.
APPEND T_OUTPUT.
CLEAR T_OUTPUT.
EXIT.
ELSE.
T_HEADER-LBKUM = T_HEADER-LBKUM - T_ITEMS-MENGE.
T_OUTPUT-MATNR = T_HEADER-MATNR.
T_OUTPUT-WERKS = T_HEADER-BWKEY.
T_OUTPUT-BUDAT = T_ITEMS-BUDAT.
T_OUTPUT-MENGE = T_ITEMS-MENGE.
APPEND T_OUTPUT.
CLEAR T_OUTPUT.
CONTINUE.
ENDIF.
ENDLOOP.
ENDLOOP.
ENDFORM. " get_dead_stock
*& Form DISPLAY_OUTPUT
text
FORM DISPLAY_OUTPUT .
DATA: L_DAYS TYPE I.
DATA : WA_OUTPUT LIKE T_OUTPUT.
DATA : T_FINAL LIKE T_OUTPUT OCCURS 0 WITH HEADER LINE.
DATA : WA_FINAL LIKE T_OUTPUT.
DATA : L_CQTY TYPE MSEG-MENGE,
L_CPRC TYPE MBEW-SALK3.
DATA : L_TITLE TYPE LVC_TITLE.
DATA : L_NAME1 TYPE T001W-NAME1.
*C-- Not to output when the quantity is zero.
DELETE T_OUTPUT WHERE MENGE EQ 0.
SORT T_OUTPUT BY WERKS MATNR BUDAT.
LOOP AT T_OUTPUT.
T_FINAL = T_OUTPUT.
AT NEW MATNR.
CLEAR T_HEADER.
READ TABLE T_HEADER WITH KEY MATNR = T_OUTPUT-MATNR
BWKEY = T_OUTPUT-WERKS.
ENDAT.
T_FINAL-MAKTX = T_HEADER-MAKTX.
IF T_HEADER-LBKUM GT 0.
T_FINAL-PVAL = ( T_OUTPUT-MENGE * T_HEADER-SALK3 / T_HEADER-LBKUM ).
ELSE.
CLEAR T_FINAL-PVAL.
ENDIF.
L_CQTY = L_CQTY + T_OUTPUT-MENGE.
IF T_HEADER-LBKUM GT 0.
L_CPRC = L_CPRC + ( T_OUTPUT-MENGE * T_HEADER-SALK3 / T_HEADER-LBKUM ).
ENDIF.
CALL FUNCTION 'HR_SGPBS_YRS_MTHS_DAYS'
EXPORTING
BEG_DA = T_OUTPUT-BUDAT
END_DA = P_DATE
IMPORTING
NO_CAL_DAY = L_DAYS
EXCEPTIONS
DATEINT_ERROR = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
WRITE : 70 'Error While Calculating days'(018) .
ELSE.
T_FINAL-PDAYS = L_DAYS.
ENDIF.
T_FINAL-CQTY = L_CQTY.
T_FINAL-CPRC = L_CPRC.
APPEND T_FINAL.
AT END OF MATNR.
CLEAR : L_CPRC, L_CQTY.
ENDAT.
ENDLOOP.
PERFORM BUILD_FIELD_CATALOG.
WA_SORT-FIELDNAME = 'MATNR'.
WA_SORT-SPOS = '1'.
APPEND WA_SORT TO T_SORT.
SELECT SINGLE NAME1 FROM T001W INTO L_NAME1
WHERE WERKS = P_WERKS.
CONCATENATE 'Plant: ' P_WERKS ',' L_NAME1 INTO L_TITLE.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-CPROG
I_GRID_TITLE = L_TITLE
IT_FIELDCAT = GRID_TAB[]
IT_SORT = T_SORT
I_SAVE = 'A'
TABLES
T_OUTTAB = T_FINAL[].
SORT T_FINAL BY WERKS MATNR BUDAT.
LOOP AT T_FINAL.
WRITE : /10 T_FINAL-MATNR.
WRITE : 30 T_FINAL-WERKS.
WRITE : 40 T_FINAL-BUDAT.
WRITE : 50 T_FINAL-MENGE.
**C-- FM to find the number of days between
**C-- todays date and the posting date
CALL FUNCTION 'HR_SGPBS_YRS_MTHS_DAYS'
EXPORTING
BEG_DA = T_FINAL-BUDAT
END_DA = P_DATE
IMPORTING
NO_CAL_DAY = L_DAYS
EXCEPTIONS
DATEINT_ERROR = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
WRITE : 70 'Error While Calculating days'(018) .
ELSE.
WRITE : 70 L_DAYS.
ENDIF.
AT END OF MATNR.
ULINE.
READ TABLE T_HEADER WITH KEY MATNR = T_FINAL-MATNR
BWKEY = T_FINAL-WERKS.
IF SY-SUBRC EQ 0.
WRITE : /1 'Total Valuated Stock', T_HEADER-LBKUM.
WRITE : /1 'Value of total valuated Stock', T_HEADER-SALK3.
ULINE.
ENDIF.
ENDAT.
ENDLOOP.
ENDFORM. " DISPLAY_OUTPUT
*& Form BUILD_FIELD_CATALOG
text
--> p1 text
<-- p2 text
FORM BUILD_FIELD_CATALOG .
DATA : CNT1 TYPE I.
CNT1 = CNT1 + 1.
GRID_TAB-COL_POS = CNT1.
GRID_TAB-SELTEXT_L = 'Material'.
GRID_TAB-FIELDNAME = 'MATNR'.
GRID_TAB-KEY = 'X'.
GRID_TAB-NO_ZERO = 'X'.
GRID_TAB-TABNAME = 'T_FINAL'.
APPEND GRID_TAB.
CLEAR GRID_TAB.
CNT1 = CNT1 + 1.
GRID_TAB-COL_POS = CNT1.
GRID_TAB-SELTEXT_L = 'Material Description'.
GRID_TAB-FIELDNAME = 'MAKTX'.
GRID_TAB-OUTPUTLEN = '30'.
GRID_TAB-KEY = 'X'.
GRID_TAB-NO_ZERO = 'X'.
GRID_TAB-TABNAME = 'T_FINAL'.
APPEND GRID_TAB.
CLEAR GRID_TAB.
CNT1 = CNT1 + 1.
GRID_TAB-COL_POS = CNT1.
GRID_TAB-SELTEXT_L = 'Date of Reciept'.
GRID_TAB-FIELDNAME = 'BUDAT'.
GRID_TAB-KEY = 'X'.
GRID_TAB-NO_ZERO = 'X'.
GRID_TAB-TABNAME = 'T_FINAL'.
APPEND GRID_TAB.
CLEAR GRID_TAB.
CNT1 = CNT1 + 1.
GRID_TAB-COL_POS = CNT1.
GRID_TAB-SELTEXT_L = 'Quantity'.
GRID_TAB-FIELDNAME = 'MENGE'.
GRID_TAB-KEY = 'X'.
GRID_TAB-NO_ZERO = 'X'.
GRID_TAB-TABNAME = 'T_FINAL'.
APPEND GRID_TAB.
CLEAR GRID_TAB.
CNT1 = CNT1 + 1.
GRID_TAB-COL_POS = CNT1.
GRID_TAB-SELTEXT_L = 'Pending Days'.
GRID_TAB-FIELDNAME = 'PDAYS'.
GRID_TAB-KEY = 'X'.
GRID_TAB-NO_ZERO = 'X'.
GRID_TAB-TABNAME = 'T_FINAL'.
APPEND GRID_TAB.
CLEAR GRID_TAB.
CNT1 = CNT1 + 1.
GRID_TAB-COL_POS = CNT1.
GRID_TAB-SELTEXT_L = 'Value'.
GRID_TAB-FIELDNAME = 'PVAL'.
GRID_TAB-KEY = 'X'.
GRID_TAB-NO_ZERO = 'X'.
GRID_TAB-TABNAME = 'T_FINAL'.
APPEND GRID_TAB.
CLEAR GRID_TAB.
CNT1 = CNT1 + 1.
GRID_TAB-COL_POS = CNT1.
GRID_TAB-SELTEXT_L = 'Cumulative Quantity'.
GRID_TAB-FIELDNAME = 'CQTY'.
GRID_TAB-KEY = 'X'.
GRID_TAB-NO_ZERO = 'X'.
GRID_TAB-TABNAME = 'T_FINAL'.
APPEND GRID_TAB.
CLEAR GRID_TAB.
CNT1 = CNT1 + 1.
GRID_TAB-COL_POS = CNT1.
GRID_TAB-SELTEXT_L = 'Value of Cumulative Quantity'.
GRID_TAB-OUTPUTLEN = '30'.
GRID_TAB-FIELDNAME = 'CPRC'.
GRID_TAB-KEY = 'X'.
GRID_TAB-NO_ZERO = 'X'.
GRID_TAB-TABNAME = 'T_FINAL'.
APPEND GRID_TAB.
ENDFORM. " BUILD_FIELD_CATALOG -
Dear All,
I am creating a customised report for showing all the importatnt data (like stock, consumption, production, sale in one report) at client level.
In this report I am required to show the stock of material on a particular date, entered by the user in the selection screen.
(In stanard SAP, report MB5B servers the purpose.)
Can you please suggest how can I get the same information in the customised report.?
(I do not prefer using method: month opening stock + total receipts - total consumption)
Is there any alternative way?
Thanks and regards
SarangHi
The MB5B report gives you all the data, if you donot want some of the data, copy the Report, & from the Output Parameters remove the Fields which you dont want.
if you want the ALV functionality add the same to that.
Thanks & Regards
Kishore -
Stock on particular date (performance issue)
Hi Folks,
I m calculating stock at all vendor on a particular date.
But it takes very long and time_out occurs.
I m calculating opening closing provided return and rejection based on movement types.
The report hangs up at following particular Join.
SELECT MKPFBUDAT MSEGBWART MSEGMATNR MSEGLIFNR SUM( MSEG~MENGE )
AS MENGE
INTO CORRESPONDING FIELDS OF TABLE IT_OPEN
FROM
MKPF INNER JOIN MSEG ON
MKPFMBLNR = MSEGMBLNR AND
MKPFMJAHR = MSEGMJAHR
WHERE MKPF~MJAHR = D_YEAR AND
MKPF~BUDAT GE D_DATE AND
MKPF~BUDAT LT S_BUDAT-LOW AND
MSEG~BWART IN ('541','542','543','544','551','702') AND
MSEG~XAUTO NE 'X' AND
MSEG~MATNR IN S_MATNR AND
MSEG~WERKS IN P_WERKS AND
MSEG~LIFNR IN P_LIFNR
GROUP BY LIFNR MATNR BUDAT BWART.
Is there any way to increase performance by breaking this inner join into select statements or anyhow.
Regards
SachinHI,
On seeing your code, it seems like,
SELECT MKPFBUDAT MSEGBWART MSEGMATNR MSEGLIFNR SUM( MSEG~MENGE )
AS MENGE
INTO CORRESPONDING FIELDS OF TABLE IT_OPEN
FROM
MKPF INNER JOIN MSEG ON
MKPFMBLNR = MSEGMBLNR AND
MKPFMJAHR = MSEGMJAHR
WHERE MKPF~MJAHR = D_YEAR AND
MKPF~BUDAT GE D_DATE AND
MKPF~BUDAT LT S_BUDAT-LOW AND
MSEG~BWART IN ('541','542','543','544','551','702') AND
MSEG~XAUTO NE 'X' AND
MSEG~MATNR IN S_MATNR AND
<b>MSEG~WERKS EQ P_WERKS</b> AND
<b>MSEG~LIFNR EQ P_LIFNR</b>
GROUP BY LIFNR MATNR BUDAT BWART.
Please see the code marked with bold as parameter passing in the select statement must be EQ and not IN.
Secondly, remove the aggregate function SUM from the select. First select all the records into an internal table and either use control break statements or Collect to sum up the entries.
Next, while selecting from the database use INTO TABLE IT_OPEN rather than into corresponding fields of table.
Also remove the movement types from the select and restrict it inside the Loop and Endloop.
Lakshminarayanan
Please mark all helpful answers for points -
Dear experts,
We are devloping one report, where i want to find the open order Qty from POs having delivery date in next weeks period.
That is i wanted to find the POs having delivery dates in next weeks period from current date( Date i entered)
Which tables and fields and logic we can use for finding the same.
Regards,
MMDear,
Please Check ME2N.
Enter ME2N, select selection parameter as WE101.
Click on execute button .
Also use table EBAN for purchase order Delivery date and field is LFDAT
Regards,
Mahesh Wagh
Maybe you are looking for
-
I'm considering buying a mac book pro. I want a few opinions about the mac book pro compared to a pc. I've been a pc user. How do you rate the mac compared to a pc?
-
Dynamic table with dynamic binding
Hello, I'm really not sure if I can realize that kind of feature using a table : I've created a dynamic table that have a dynimac number of columns except two. I've setted the value of the table to a certain list to fill out the two static field I ne
-
Refesh Block with Changing Focus to It?
There is a common problem we all share around text fields. A lot of applications need to switch temporarily to a different block this during user input (e.g. Select "Country" then reduce list of "State/Provinces" to that country, or validate surname
-
Since no one responded in the feedback thread... I have updated to Belle on my E7. I keep getting random disconnects of my WiFi despite it being On and the network is set-up as on Anna. It would sometimes automatically reconnect when I try accessing
-
Cannot See DC's in Cons system
Hi, I copied all my DC's from a track 1 to track 2. Track 1 has Sofware component ABC version 10 and Track 2 has Sofware component ABC version 20. I followed this wiki to acheive this, http://wiki.sdn.sap.com/wiki/display/JDI/StepbyStepguidetoMovea