Query for material wise pricing
i want to extract price for sales org/distribution channel/ Division/material. which tables can i used .
Table
Field combination
A274
- Sales org./Distr. chl/Division/Material/Item
A273
- Sales org./Distr. chl/Division/Material/Customer/Item
Regards
JP
Similar Messages
-
SAP query for Material pricing group changes in material.
Dear all,
I'm trying to generate a query for Material Pricing group changes in material. For that I've to retrieve data from follwing three tables MVKE, CDHDR & CDPOS.
Firstly while generating infoset -
I tried it by joining tables MVKE & CDHDR, but system is not allowing it, also table CDPOS can't bejoined.
Then I tried by reading dirctly from table MVKE and then adding additional fields in it. query created using this infoset is giving the output, however it's giving only 1 entry per material entered in input.
for multiple entries in output for MPG changes in same material I tried creating addtional structure for table CDHDR & CDPOS but again I'm getting only 1 entry per material.
please suggest how I can get MPG changes done in specified time period for a material.
Thanks.Hi
Check the report RSSCD100 and run it for object MAT_FULL for table MVKE. Use this report as a template for your own development.
I hope this helps you
Regards
Eduardo
PD: sorry, the table is DMVKE
Edited by: E_Hinojosa on Sep 2, 2011 9:37 AM -
Query For Series wise Collection
Hi
Please anyone provide query for series-wise collectionSatish Doke,
Im using this query as "Series Wise Outstanding" I want to create another query for "series wise collection".How can i do this.Im not into SAP accounting.Please help.
DECLARE @Date AS DATETIME
DECLARE @Series AS varchar(30)
DECLARE @Branch AS varchar(30)
DECLARE @Exec AS varchar(30)
/* SELECT FROM [dbo].[OINV] S0 WHERE */ SET @Date = /* S0.DocDate*/ '[%0]'
/* SELECT FROM [dbo].[NNM1] S2 WHERE */ SET @Series = /* S2.SeriesName*/ '[%2]'
/* SELECT FROM [dbo].[OLCT] S3 WHERE */ SET @Branch = /* S3.Location*/ '[%3]'
/* SELECT FROM [dbo].[OSLP] S4 WHERE */ SET @Exec = /* S4.SlpName*/ '[%4]'
if( @Exec ='') set @Exec ='%'
if( @Series ='') set @Series ='%'
if( @Branch ='') set @Branch ='%'
if( @Date ='') set @Date =GETDATE()
Select distinct OINV.CardName [Customer Name], ISNULL(NNM1.SeriesName ,'-')+'/'+ CAST(OINV.DocNum as varchar) [Bill No.],
OINV.DocDate [Bill Date],INV1.Dscription,INV1.Quantity,
OINV.DocTotal - OINV.PaidToDate [Out Standing Amount],
DATEDIFF(dd,OINV.DocDate,@Date)[No of Days] from OINV
inner join INV1 on OINV.DocEntry = INV1.DocEntry
inner join OLCT on INV1.LocCode = OLCT.Code
inner join NNM1 on OINV.Series = NNM1.Series
inner join OSLP on OINV.SlpCode = OSLP.SlpCode
where OINV.DocType ='I' and (OINV.DocTotal - OINV.PaidToDate)>0
and NNM1.SeriesName like @Series and OINV.DocDate<= @Date
and OLCT.Location like @Branch and OSLP.SlpName like @Exec -
Help needed in query for Materialized View
Hi,
I want to create a materialized view which has some precalcultaed values.
I have four dimension tables out of which one is a Time Dimension table with levels as Year->Quarter->Month.
The precalculations are the moving averages and cummulative values of Sales Amt on the dimension values over a period of 4 Months.
The dimension tables are Clients, Products, Channel, Time.
Fact Table is Sales_Fact which will have the sales amount for different members of the dimension.
Since my fact table is very huge, i want to create a materialized view where i could store the required calculated measures, here Moving Average of Sales Amt for each Client, Product, Channel dimensions over a period of 4 Months.
Can anybody help with writing the query for this..Any help in this regard will be appreciated..
Please give me suggestions for this..Check this link.
http://download.oracle.com/docs/cd/B19306_01/server.102/b14223/aggreg.htm#sthref1612
Regards
Raj -
Query for Item wise sales report
Hi Guys,
Below is the query i have used to run Sales Register.
But we need Item wise sales register and those Excise Duty calculations are needed for item wise instead of total document wise. Pls update the query ...
SELECT M.DocNum AS 'Inv.No ', M.DocDate as 'Date', M.CardName as 'Customer Name',L.Dscription,L.Quantity,L.Price,
(Select Sum(LineTotal) FROM INV1 L Where L.DocEntry=M.DocEntry) as 'Base Amt.(Rs.)',
(SELECT Avg(TaxRate) FROM INV4 where statype=1 and DocEntry=M.DocEntry) as ' VAT % ',
(SELECT Sum(TaxSum) FROM INV4 where statype=1 and DocEntry=M.DocEntry) as ' VAT (Rs.) ',
(SELECT Avg(TaxRate) FROM INV4 where statype=4 and DocEntry=M.DocEntry) as ' CST % ',
(SELECT Sum(TaxSum) FROM INV4 where statype=4 and DocEntry=M.DocEntry) as ' CST (Rs.) ',
(SELECT Avg(TaxRate) FROM INV4 where statype=7 and DocEntry=M.DocEntry) as ' TAXEXEMPT % ',
(SELECT Sum(TaxSum) FROM INV4 where statype=7 and DocEntry=M.DocEntry) as ' TAXEXEMPT ',
(SELECT Avg(TaxRate) FROM INV4 where statype=8 and DocEntry=M.DocEntry) as ' VAT% ',
(SELECT Sum(TaxSum) FROM INV4 where statype=8 and DocEntry=M.DocEntry) as 'VAT12.5 ',
(SELECT Avg(TaxRate) FROM INV4 where statype=9 and DocEntry=M.DocEntry) as ' CST 2% ',
(SELECT Sum(TaxSum) FROM INV4 where statype=9 and DocEntry=M.DocEntry) as ' CST @2 ',
(SELECT Avg(TaxRate) FROM INV4 where statype=11 and DocEntry=M.DocEntry) as ' CENVCST % ',
(SELECT Sum(TaxSum) FROM INV4 where statype=11 and DocEntry=M.DocEntry) as ' CENVCST ',
(SELECT Avg(TaxRate) FROM INV4 where statype=-90 and DocEntry=M.DocEntry) as ' BED % ',
(SELECT Sum(TaxSum) FROM INV4 where statype=-90 and DocEntry=M.DocEntry) as ' BED ',
(SELECT Avg(TaxRate) FROM INV4 where statype=-60 and DocEntry=M.DocEntry) as ' Cess% ',
(SELECT Sum(TaxSum) FROM INV4 where statype=-60 and DocEntry=M.DocEntry) as ' Cess ',
(SELECT Avg(TaxRate) FROM INV4 where statype=-55 and DocEntry=M.DocEntry) as ' HCess % ',
(SELECT Sum(TaxSum) FROM INV4 where statype=-55 and DocEntry=M.DocEntry) as ' Hcess ', L.LineTotal as 'Row Total (Rs.)',M.DocTotal as 'Doc Total'
FROM OINV M LEFT OUTER JOIN INV1 L on L.DocEntry=M.DocEntry LEFT OUTER JOIN INV4 T on T.DocEntry=L.DocEntry and L.LineNum=T.LineNum LEFT OUTER JOIN INV5 J ON M.DocEntry = J.AbsEntry LEFT OUTER JOIN INV3 Q ON M.DocEntry = Q.DocEntry
WHERE (M.DocDate >= '[%0]' AND M.DocDate <= '[%1]') AND TargetType ! = 14
GROUP BY M.DocNum,M.DocDate,M.CardName,M.NumAtCard,M.DocEntry,M.DiscSum,M.WTSum,L.Dscription,L.Quantity,L.Price,L.LineTotal,M.DocTotal
ORDER BY M.DocNum,M.DocDate,M.CardName,M.NumAtCard,M.DocEntry,M.DiscSum,M.WTSum,L.Dscription,L.Quantity,L.Price,L.LineTotal,M.DocTotalHi experts..
Pls Update the Query -
Query for Item wise Sales.......
*Hi Guys, Below is the query i have used to run Sales Register. But we need Item wise sales register and those Excise Duty calculations are needed for item wise instead of total document wise.
Pls update the query ...*
SELECT M.DocNum AS 'Inv.No ', M.DocDate as 'Date', M.CardName as 'Customer Name',L.Dscription,L.Quantity,L.Price, (Select Sum(LineTotal) FROM INV1 L Where L.DocEntry=M.DocEntry) as 'Base Amt.(Rs.)', (SELECT Avg(TaxRate) FROM INV4 where statype=1 and DocEntry=M.DocEntry) as ' VAT % ', (SELECT Sum(TaxSum) FROM INV4 where statype=1 and DocEntry=M.DocEntry) as ' VAT (Rs.) ', (SELECT Avg(TaxRate) FROM INV4 where statype=4 and DocEntry=M.DocEntry) as ' CST % ', (SELECT Sum(TaxSum) FROM INV4 where statype=4 and DocEntry=M.DocEntry) as ' CST (Rs.) ', (SELECT Avg(TaxRate) FROM INV4 where statype=7 and DocEntry=M.DocEntry) as ' TAXEXEMPT % ', (SELECT Sum(TaxSum) FROM INV4 where statype=7 and DocEntry=M.DocEntry) as ' TAXEXEMPT ', (SELECT Avg(TaxRate) FROM INV4 where statype=8 and DocEntry=M.DocEntry) as ' VAT% ', (SELECT Sum(TaxSum) FROM INV4 where statype=8 and DocEntry=M.DocEntry) as 'VAT12.5 ', (SELECT Avg(TaxRate) FROM INV4 where statype=9 and DocEntry=M.DocEntry) as ' CST 2% ', (SELECT Sum(TaxSum) FROM INV4 where statype=9 and DocEntry=M.DocEntry) as ' CST @2 ', (SELECT Avg(TaxRate) FROM INV4 where statype=11 and DocEntry=M.DocEntry) as ' CENVCST % ', (SELECT Sum(TaxSum) FROM INV4 where statype=11 and DocEntry=M.DocEntry) as ' CENVCST ', (SELECT Avg(TaxRate) FROM INV4 where statype=-90 and DocEntry=M.DocEntry) as ' BED % ', (SELECT Sum(TaxSum) FROM INV4 where statype=-90 and DocEntry=M.DocEntry) as ' BED ', (SELECT Avg(TaxRate) FROM INV4 where statype=-60 and DocEntry=M.DocEntry) as ' Cess% ', (SELECT Sum(TaxSum) FROM INV4 where statype=-60 and DocEntry=M.DocEntry) as ' Cess ', (SELECT Avg(TaxRate) FROM INV4 where statype=-55 and DocEntry=M.DocEntry) as ' HCess % ', (SELECT Sum(TaxSum) FROM INV4 where statype=-55 and DocEntry=M.DocEntry) as ' Hcess ', L.LineTotal as 'Row Total (Rs.)',M.DocTotal as 'Doc Total' FROM OINV M LEFT OUTER JOIN INV1 L on L.DocEntry=M.DocEntry LEFT OUTER JOIN INV4 T on T.DocEntry=L.DocEntry and L.LineNum=T.LineNum LEFT OUTER JOIN INV5 J ON M.DocEntry = J.AbsEntry LEFT OUTER JOIN INV3 Q ON M.DocEntry = Q.DocEntry WHERE (M.DocDate >= '[%0]' AND M.DocDate <= '[%1]') AND TargetType ! = 14 GROUP BY M.DocNum,M.DocDate,M.CardName,M.NumAtCard,M.DocEntry,M.DiscSum,M.WTSum,L.Dscription,L.Quantity,L.Price,L.LineTotal,M.DocTotal ORDER BY M.DocNum,M.DocDate,M.CardName,M.NumAtCard,M.DocEntry,M.DiscSum,M.WTSum,L.Dscription,L.Quantity,L.Price,L.LineTotal,M.DocTotalClosing this ...
Edited by: Parimis on Jun 25, 2010 5:44 PM -
Query for Material Received Vs Material Return
Good Afternoon Experts,
How much cumulative Qty received update date for a particular warehouse -- Item Wise and returned Qty from a particular warehouse vice versa. Please help me in writing this Query.
Regards,
Umamahesh.Hi Uma,
As Julie said, try to use System's report.
Since querying OINM table requires more system resources if your database size is large.
If not so, then you can try this query,
SELECT T0.[ItemCode], max(T0.[Dscription]), T0.[DocDate], sum(isnull(T0.[InQty],0)) [Receipt], sum(isnull(T0.[OutQTY],0)) [Issue],T0.[Warehouse] FROM OINM T0 where T0.DocDate >= [%0] and T0.DocDate <= [%1]
Group by T0.[ItemCode], T0.[DocDate], T0.[Warehouse]
Order by T0.[ItemCode], T0.[Warehouse], T0.[DocDate]
Regards,
Bala -
Need detailed report for Material wise cost components??
HI
I can only view one material at a time for the ck80_99 cost component report. Is there a way to view more materials from the same report. we have a option to give multiple material numbers but its not executing the report at that point, it first display all the materials with the costing variant when we further execute the reprt it is generating for only one material. Please help me on its urgent.
If standard report is not available, can we go customized report for this?
Thanks,HI Siva,
Thanks for quick reply. Yeah, in S_ALR_87013047 i can compare only two materials. but i am looking for a report for group of materials for forecasting. Can we create acustomised report for this.
Please let me know.
Thanks
vamshi -
Datasource for material wise production data
Hi Gurus,
I need to extract daily production data from ECC material & plantwise. So which datasource I need to use for it? Its for a steel industry.
Of the below ones which datasources can I use? & which DSO & Cube can I consider?\
2LIS_04_P_COMP
2LIS_04_P_MATNR
2LIS_04_P_ARBPL
Rgds,
Vandana.Hi Did you try these below DSs.
0MAT_PLANT_ATTR
0MAT_ST_LOC_ATTR
Have you had any issues in trying these ds?
Regards,
Rambabu -
Opening for material vendor wise
Hi all..
I need opening for material by vendor wise. from which table I get it??
By MARD and S033 i m able to get material wise opening.not vendor wise..
Plz help me.solved
-
Pricing table for Material pricing Group
Hi everyone
I have a problem related to pricing. In ECC, if we create a condition table for material pricing group, assign it to the Access sequence PR00 and then download the customizing data to CRM, the access sequence appears in CRM but without this table.
Could you please provide any clue to this??
Also, I had created another table with the Material/Material Prc Grp, assigned it to another Z-Access sequence and assigned the access seq to a Condition type. Again I had downloaded the customizing and in this case, only the Condition type has arrived. Neither the access sequence nor the table has come.
Could you please guide me as to what needs to be done??
Please help!!
Regards
DebolinaHello,
Please check your replication object e.g. DNL_CUST_CNDALL and see if you have filters defined there.
You might have put filters which are preventing the download.
Also, you have to define the new field mappings in CRM before you download the tables.
V_CND_MAP_CNVFLD (transaction SM30).: This view contains the mapping between R/3 data structure (maintained in CND_MAPT_ACS_REM_CUST) to CRM data structure (Field Catalog).
The relationship between R/3 field names and CRM field names must be defined in either CND_MAPC_CNV_FLM or CND_MAPM_CNV_FLM
Let me know if still issues.
Koshal -
Query for calculating raw material requirements for the remaining quantities in sale order.
Dear SAP Experts,
Clients requirement :
Client wish to know the quantities of raw materials needs to run the production order inorder to complete the remaining quantities in sale order.
Need Clarification:
I"m using the below query for this requirement. I wish to know whether this query suits for my clients requirement or not. If its so, I need to know how to group by T4.[Code] (Raw material Name) and need to get the sum of T4.[Quantity] (BOM quantity) and (T1.[OpenQty]*T4.[Quantity]) as TOTALQTY under each raw material group
SELECT T0.[DocNum], T0.[DocDate], T0.[CardCode],T0.[CardName], T1.[ItemCode], T1.[Dscription], T1.[Quantity] as salesorderQty , T1.[OpenQty], T2.onhand, T4.[Code] as Raw material Name,T4.[Quantity] as BOMQTY, (T1.[OpenQty]*T4.[Quantity]) as TOTALQTY FROM ORDR T0 INNER JOIN RDR1 T1 ON T0.[DocEntry] = T1.[DocEntry] INNER JOIN OITM T2 ON T1.[ItemCode] = T2.[ItemCode] INNER JOIN OITT T3 ON T2.[ItemCode] = T3.[Code] INNER JOIN ITT1 T4 ON T3.[Code] = T4.[Father] WHERE T0.[DocStatus] ='o'You're posting in the Portuguese B1 space.
You might want to post in the English one: SAP Business One Application -
Report for material which not consumed during C015
HI ALL,
"I required a report for material which material are not
consumed at C015 production confirmation time against actual consumation (order wise , part no wise & date wise )"
its v urgent
good suggesstion reward with valuable points.Amit,
I think your problem is that you want to monitor when users are deleting the goods issue while confirmation. So you would have to know if for a confirmation qty of 100, the planned consumption should have been 100 but the actual consuption is 50.
So you would want to relate the confirmation qty with the planned and actual consumption.
In COOIS Remt, qty and Withdrawal qty will show the total reqmt and actual withdrwal. Hope this will not be helpful if I understand correctly.
You have to create a simple query joining tables AFVV with RESB. Calculate the planned consuption for the confirmation qty. This along with the actual consuption will help to give what you are looking for.
I am right ?
Ram -
Report for material and alternative UOM
Hi Guru's
is there ant transaction/standard report where i can see the list of materials and alternative UOM
ThankyouHi,
No such standard report available in SAP to see for many materials. in MM03 under Additional Data, you can see but material wise.
Better use table MARM to see the same and create an ABAP Query of Report using this table. -
Data is not linked to material wise
Hi experts,
In this Report data is not linked to material wise.
it comming merge the all the materials in one material.
TYPE-POOLS: SLIS.
TABLES: MKPF,LFA1,MSEG,EKET,T001L,MAKT,S031,S032,MARA,LIPS,LIKP,T001W.
DATA FLAG TYPE I.
DATA : MENGE_RE LIKE MSEG-MENGE,
MENGE_IS LIKE MSEG-MENGE,
MENGE_O LIKE MSEG-MENGE,
MENGE_BAL LIKE MSEG-MENGE.
DATA MAGBB LIKE S031-MAGBB.
DATA : F_LNO LIKE SY-LINNO,
S_LNO LIKE SY-LINNO,
V_LNO LIKE SY-LINNO.
DATA MZUBB LIKE S031-MZUBB.
DATA V_MONTH LIKE S031-SPMON.
DATA XBLNR LIKE MKPF-XBLNR.
DATA : BEGIN OF ITAB1 OCCURS 100,
MATNR LIKE MAKT-MATNR,
END OF ITAB1.
DATA : BEGIN OF ITAB2 OCCURS 100,
MATNR LIKE MAKT-MATNR,
WERKS LIKE MARD-WERKS,
LGORT LIKE MARD-LGORT,
BUSTW LIKE MSEG-BUSTW,
BWART LIKE MSEG-BWART,
SHKZG LIKE MSEG-SHKZG,
MENGE LIKE MSEG-MENGE,
END OF ITAB2.
DATA: PAGNO(5) TYPE C.
DATA : PAGENO LIKE SY-PAGNO.
DATA: STR1 TYPE DATS,
STR2(14) TYPE C,
STR3(10) TYPE C.
DATA : V_MONUM LIKE T015M-MONUM,
V_MONAM LIKE T015M-MONAM.
DATA : V_PAGENO LIKE SY-PAGNO.
TYPES: FARBE TYPE SLIS_T_SPECIALCOL_ALV.
DATA V_STOCK LIKE MSEG-MENGE.
DATA V_STOCK1 LIKE MSEG-MENGE.
DATA: V_MONTH1 LIKE S031-SPMON.
DATA: OSTOCK LIKE MSEG-MENGE.
DATA : FLAG6 TYPE C,
V_PAGENO1 LIKE SY-PAGNO,
V_PAGENO2 LIKE SY-PAGNO.
DATA: FLD(15).
DATA: TXT(50).
DATA: FLAG5.
I N I T I A L I Z A T I O N
*GT_REPID = SY-REPID.
PAGNO = SY-PAGNO.
A T S E L E C T I O N S C R E E N
AT SELECTION-SCREEN.
*AT SELECTION-SCREEN ON BUDAT.
PERFORM VALIDATION.
S T A R T O F S E L E C T I O N
START-OF-SELECTION.
SET MARGIN 5.
PERFORM FETCH_DATA.
PERFORM WRITE_REPORT.
PERFORM STOCK.
E N D O F S E L E C T I O N
END-OF-SELECTION.
Report Selections
DATA: BEGIN OF IT_HEADER OCCURS 10,
WERKS LIKE MSEG-WERKS,
NAME1 LIKE T001W-NAME1,
MAKTX LIKE MAKT-MAKTX,
MATNR LIKE MSEG-MATNR,
MENGE_O LIKE MSEG-MENGE,
END OF IT_HEADER.
DATA: BEGIN OF ITAB OCCURS 50,
WERKS LIKE MSEG-WERKS,
MATNR LIKE MSEG-MATNR,
BWART LIKE MSEG-BWART,
LGORT LIKE MSEG-LGORT,
EBELN LIKE MSEG-EBELN,
XBLNR LIKE MKPF-XBLNR,
BUDAT LIKE MKPF-BUDAT,
MBLNR LIKE MSEG-MBLNR,
MENGE LIKE MSEG-MENGE,
MAKTX LIKE MAKT-MAKTX,
XAUTO LIKE MSEG-XAUTO,
NAME1 LIKE T001W-NAME1,
MENGE_O LIKE MSEG-MENGE,
SHKZG LIKE MSEG-SHKZG,
MENGE_IS LIKE MSEG-MENGE,
MENGE_RE LIKE MSEG-MENGE,
END OF ITAB.
DATA: BEGIN OF INT_DATA OCCURS 50,
WERKS LIKE MSEG-WERKS,
MATNR LIKE MSEG-MATNR,
BWART LIKE MSEG-BWART,
XBLNR LIKE MKPF-XBLNR,
MBLNR LIKE MSEG-MBLNR,
BUDAT LIKE MKPF-BUDAT,
MAKTX LIKE MAKT-MAKTX,
MENGE_O LIKE MSEG-MENGE,
MENGE_R LIKE MSEG-MENGE,
MENGE_TO LIKE MSEG-MENGE,
MENGE_TI LIKE MSEG-MENGE,
MENGE_S LIKE MSEG-MENGE,
MENGE_ST LIKE MSEG-MENGE,
MENGE_AD LIKE MSEG-MENGE,
MENGE_RT LIKE MSEG-MENGE,
MENGE_C LIKE MSEG-MENGE,
MENGE_CL LIKE MSEG-MENGE,
MENGE_BAL LIKE MSEG-MENGE,
MENGE_CR LIKE MSEG-MENGE,
NAME1 LIKE T001W-NAME1,
MENGE_RE LIKE MSEG-MENGE,
MENGE_IS LIKE MSEG-MENGE,
MENGE_BAL1 LIKE MSEG-MENGE,
SHKZG LIKE MSEG-SHKZG,
MENGE LIKE MSEG-MENGE,
LGORT LIKE MSEG-LGORT,
END OF INT_DATA.
DATA: BEGIN OF INT_DATA1 OCCURS 50,
WERKS LIKE MSEG-WERKS,
MATNR LIKE MSEG-MATNR,
BWART LIKE MSEG-BWART,
MENGE_ST LIKE MSEG-MENGE,
MENGE_O LIKE MSEG-MENGE,
WAMNG LIKE EKET-WAMNG,
WEMNG LIKE EKET-WEMNG,
MENGE LIKE MSEG-MENGE,
RETPO LIKE EKPO-RETPO,
UMREN LIKE EKPO-UMREN,
UMREZ LIKE EKPO-UMREZ,
BSTMG LIKE EKPO-MENGE,
XBLNR LIKE MKPF-XBLNR,
END OF INT_DATA1.
DATA: BEGIN OF INT_DATA2 OCCURS 50,
WERKS LIKE MSEG-WERKS,
LGORT LIKE S031-LGORT,
MATNR LIKE MSEG-MATNR,
BWART LIKE MSEG-BWART,
MENGE_IS LIKE MSEG-MENGE,
MBWBEST LIKE S032-MBWBEST,
MAKTX LIKE MAKT-MAKTX,
END OF INT_DATA2.
DATA:V_GJAHR LIKE MKPF-BUDAT.
SELECTION-SCREEN BEGIN OF BLOCK 0 WITH FRAME TITLE TEXT-064.
SELECT-OPTIONS:
MATNR FOR MSEG-MATNR,
MATKL FOR MARA-MATKL OBLIGATORY,
WERKS FOR MSEG-WERKS OBLIGATORY,
LGORT FOR MSEG-LGORT,
*CHARG FOR MSEG-CHARG,
BWART FOR MSEG-BWART,
*LIFNR FOR LFA1-LIFNR,
*WADAT FOR LIKP-WADAT_IST,
S_DATE FOR MKPF-BUDAT.
SELECTION-SCREEN END OF BLOCK 0.
TOP-OF-PAGE.
PERFORM HEADER_WRITE.
FORM FETCH_DATA .
SELECT
MATNR " Material Number
WERKS " Plant
INTO TABLE IT_HEADER
FROM MSEG
WHERE MATNR = IT_HEADER-MATNR AND
WERKS = IT_HEADER-WERKS.
STR3 = S_DATE-LOW+0(4).
SELECT * FROM MARA INTO CORRESPONDING FIELDS OF TABLE ITAB1
WHERE MATNR IN MATNR AND
MATKL IN MATKL.
SELECT MATNR WERKS LGORT
INTO TABLE ITAB2
FROM MARD FOR ALL ENTRIES IN ITAB1
WHERE WERKS IN WERKS AND
LGORT IN LGORT AND
MATNR = ITAB1-MATNR.
SELECT SINGLE NAME1 FROM T001W INTO INT_DATA-NAME1
WHERE WERKS = INT_DATA-WERKS.
LOOP AT ITAB2.
SELECT M~MATNR M~WERKS M~LGORT M~MENGE M~MBLNR M~MJAHR M~XAUTO M~SHKZG
M~BWART M~EBELN N~BUDAT N~XBLNR S~NAME1
INTO CORRESPONDING FIELDS OF ITAB
FROM MSEG AS M INNER JOIN MKPF AS N ON
M~MBLNR = N~MBLNR
AND M~MJAHR = N~MJAHR
INNER JOIN T001W AS S ON
M~WERKS = S~WERKS
WHERE N~BUDAT IN S_DATE AND
M~WERKS = ITAB2-WERKS AND
M~LGORT = ITAB2-LGORT AND
M~MATNR = ITAB2-MATNR AND
M~BWART IN BWART.
APPEND ITAB.
CLEAR ITAB.
ENDSELECT.
IF SY-SUBRC NE 0.
ITAB-MATNR = ITAB2-MATNR.
ITAB-WERKS = ITAB2-WERKS.
ITAB-LGORT = ITAB2-LGORT.
ITAB-BWART = ITAB2-BWART.
APPEND ITAB.
ENDIF.
CLEAR: ITAB2,ITAB.
ENDLOOP.
DELETE ADJACENT DUPLICATES FROM ITAB2 COMPARING MATNR WERKS .
V_MONTH = S_DATE-LOW+0(6).
SELECT * INTO CORRESPONDING FIELDS OF TABLE INT_DATA2
FROM S032 FOR ALL ENTRIES IN ITAB2
WHERE MATNR = ITAB2-MATNR
AND WERKS = ITAB2-WERKS
AND LGORT = SPACE
AND MBWBEST <> SPACE.
LOOP AT INT_DATA2 .
SELECT SINGLE * FROM S031
WHERE MATNR = INT_DATA2-MATNR AND
WERKS = INT_DATA2-WERKS AND
LGORT = SPACE AND
SPMON GT V_MONTH.
MODIFY INT_DATA2.
CLEAR: INT_DATA2, S031.
ENDLOOP.
DELETE INT_DATA WHERE MENGE_O IS INITIAL .
DELETE ADJACENT DUPLICATES FROM INT_DATA COMPARING XBLNR MATNR MAKTX.
V_MONTH1 = S_DATE-LOW+0(6).
SORT ITAB BY MATNR WERKS XBLNR .
LOOP AT ITAB.
XBLNR = ITAB-XBLNR.
INT_DATA-MENGE = ITAB-MENGE.
INT_DATA-BWART = ITAB-BWART.
INT_DATA-XBLNR = ITAB-XBLNR.
INT_DATA-BUDAT = ITAB-BUDAT.
INT_DATA-MATNR = ITAB-MATNR.
INT_DATA-MBLNR = ITAB-MBLNR.
INT_DATA-MENGE = ITAB-MENGE.
INT_DATA-SHKZG = ITAB-SHKZG.
INT_DATA-MENGE_IS = ITAB-MENGE_IS.
INT_DATA-MENGE_RE = ITAB-MENGE_RE.
INT_DATA-MENGE_O = ITAB-MENGE_O.
INT_DATA-NAME1 = ITAB-NAME1.
IF FLAG = 1.
PERFORM GET_OPENING_STOCK.
ENDIF.
INT_DATA-MENGE_O = OSTOCK.
CASE ITAB-BWART.
WHEN '101'.
IF INT_DATA-SHKZG = 'S'.
INT_DATA-MENGE_R = INT_DATA-MENGE_R + ITAB-MENGE.
ENDIF.
WHEN '453'.
IF INT_DATA-SHKZG = 'S'.
IF ITAB-XAUTO = 'X'.
INT_DATA-MENGE_RT = INT_DATA-MENGE_RT + ITAB-MENGE.
ENDIF.
ENDIF.
WHEN '351' OR '641'.
IF ITAB-LGORT = 0.
INT_DATA-MENGE_R = INT_DATA-MENGE_R + ITAB-MENGE.
ELSE.
INT_DATA-MENGE_TO = INT_DATA-MENGE_TO + ITAB-MENGE.
ENDIF.
WHEN '602' OR '642'.
IF INT_DATA-SHKZG = 'S'.
IF ITAB-LGORT = 0.
INT_DATA-MENGE_CL = INT_DATA-MENGE_CL + ITAB-MENGE.
ENDIF.
ENDIF.
WHEN '552' OR '310'.
IF INT_DATA-SHKZG = 'S'.
INT_DATA-MENGE_AD = INT_DATA-MENGE_AD - ITAB-MENGE.
ENDIF.
WHEN '601'.
IF INT_DATA-SHKZG = 'H'.
INT_DATA-MENGE_S = INT_DATA-MENGE_S + ITAB-MENGE.
ENDIF.
WHEN '641' .
IF INT_DATA-SHKZG = 'H'.
IF ITAB-LGORT = 0.
INT_DATA-MENGE_TO = INT_DATA-MENGE_TO + ITAB-MENGE.
ENDIF.
ENDIF.
WHEN '454' OR '102'.
IF INT_DATA-SHKZG = 'H'.
IF ITAB-XAUTO = 'X'.
INT_DATA-MENGE_CR = INT_DATA-MENGE_CR - ITAB-MENGE.
ENDIF.
ENDIF.
WHEN '551' OR '309'.
IF INT_DATA-SHKZG = 'H'.
INT_DATA-MENGE_AD = INT_DATA-MENGE_AD + ITAB-MENGE.
ENDIF.
ENDCASE.
PERFORM BALANCE.
COLLECT INT_DATA.
CLEAR: INT_DATA,XBLNR, FLAG, OSTOCK.
IF INT_DATA-SHKZG = 'S'.
MENGE_RE = INT_DATA-MENGE_R + INT_DATA-MENGE_RT + INT_DATA-MENGE_CL
+ INT_DATA-MENGE_AD.
ENDIF.
IF INT_DATA-SHKZG = 'H'.
MENGE_IS = INT_DATA-MENGE_S + INT_DATA-MENGE_TO +
INT_DATA-MENGE_CR + INT_DATA-MENGE_AD.
ENDIF.
ENDLOOP.
SORT INT_DATA BY XBLNR BUDAT WERKS MATNR.
LOOP AT INT_DATA.
AT NEW MATNR.
FLAG = 1.
IT_HEADER-MATNR = INT_DATA-MATNR.
SELECT SINGLE MAKTX FROM MAKT INTO IT_HEADER-MAKTX WHERE
MATNR = IT_HEADER-MATNR and spras = 'E'.
APPEND IT_HEADER.
CLEAR IT_HEADER.
endat.
ENDLOOP.
LOOP AT INT_DATA.
READ TABLE INT_DATA2 WITH KEY MATNR = INT_DATA-MATNR
WERKS = INT_DATA-WERKS.
SELECT SINGLE * FROM MAKT WHERE MATNR = INT_DATA-MATNR.
INT_DATA-MAKTX = MAKT-MAKTX.
MODIFY INT_DATA.
CLEAR: INT_DATA, INT_DATA2.
ENDLOOP.
LOOP AT INT_DATA WHERE MENGE_O = 0 AND MENGE_RT = 0 AND
MENGE_CL = 0 AND MENGE_AD = 0 AND
MENGE_S = 0 AND MENGE_TO = 0 AND
MENGE_CR = 0 AND MENGE_R = 0 AND MENGE_BAL = 0.
DELETE IT_HEADER WHERE MATNR = INT_DATA-MATNR.
ENDLOOP.
DELETE INT_DATA WHERE MENGE_O = 0 AND MENGE_RT = 0 AND
MENGE_CL = 0 AND MENGE_AD = 0 AND
MENGE_S = 0 AND MENGE_TO = 0 AND
MENGE_CR = 0 AND MENGE_R = 0 AND MENGE_BAL = 0.
PERFORM WRITE_REPORT.
INT_DATA-MENGE_O = OSTOCK.
PERFORM GET_OPENING_STOCK.
FORMAT COLOR 4 INTENSIFIED OFF.
WRITE:/1 SY-VLINE,
106 'Opening Balance' CENTERED,
130 SY-VLINE,
156 SY-VLINE.
WRITE: 130(8) OSTOCK.
WRITE:/1(156) SY-ULINE.
FORMAT RESET.
LOOP AT INT_DATA.
FORMAT COLOR 2 INTENSIFIED OFF.
WRITE:/1 SY-VLINE,
2 INT_DATA-XBLNR,
14 SY-VLINE,
15 INT_DATA-BUDAT,
27 SY-VLINE,
28 INT_DATA-BWART,
40 SY-VLINE,
43(9) INT_DATA-MENGE_R,
51 SY-VLINE,
52(9) INT_DATA-MENGE_RT,
65 SY-VLINE,
66(9) INT_DATA-MENGE_CL,
82 SY-VLINE,
83(7) INT_DATA-MENGE_AD,
89 SY-VLINE,
90(9) INT_DATA-MENGE_S,
97 SY-VLINE,
98(9) INT_DATA-MENGE_TO,
106 SY-VLINE,
107(9) INT_DATA-MENGE_CR,
120 SY-VLINE,
121(9) INT_DATA-MENGE_AD,
130 SY-VLINE,
131(9) INT_DATA-MENGE_BAL,
144 SY-VLINE,
145 INT_DATA-MBLNR,
156 SY-VLINE.
FORMAT RESET.
ENDLOOP.
WRITE:/1(156) SY-ULINE.
ENDFORM.
FORM WRITE_REPORT.
SORT IT_HEADER BY MATNR.
LOOP AT IT_HEADER.
SKIP .
AT NEW MATNR.
WRITE:/1(60) SY-ULINE.
READ TABLE IT_HEADER INDEX SY-TABIX.
WRITE:/1 SY-VLINE,
2 'Material :'(006),14(7) IT_HEADER-MATNR NO-GAP,'-',
IT_HEADER-MAKTX,
60 SY-VLINE.
WRITE:/1(60) SY-ULINE.
SKIP.
SET LEFT SCROLL-BOUNDARY COLUMN 50.
WRITE:/1(156) SY-ULINE.
FORMAT COLOR 1 INTENSIFIED OFF.
WRITE:/1 SY-VLINE,
2 'Doc. No' CENTERED,
14 SY-VLINE,
15(14) 'Doc.Date' CENTERED,
27 SY-VLINE,
28(10) 'MVT' CENTERED,
40 SY-VLINE,
41(57) 'Receipts' CENTERED,
89 SY-VLINE, 90(47) 'Issues' CENTERED,130 SY-VLINE,131(12) 'Balance' CENTERED,144 SY-VLINE,
145 'MAT.DOC NO' CENTERED,156 SY-VLINE,
/41 SY-VLINE,1 SY-VLINE,14 SY-VLINE,27 SY-VLINE,40 SY-VLINE,89 SY-VLINE,130 SY-VLINE,144 SY-VLINE,156 SY-VLINE,
40 SY-ULINE,
/40 SY-VLINE,
43 'STO-In' CENTERED , 51 SY-VLINE,
52 'Sales Returns' CENTERED , 65 SY-VLINE,
66 'Canc of Invoice' CENTERED, 82 SY-VLINE,
83 'Adj' CENTERED, 89 SY-VLINE,
90 'Sales' CENTERED, 97 SY-VLINE,
98 'STO-Out' CENTERED, 106 SY-VLINE,
107 'Canc of Sales' CENTERED, 120 SY-VLINE,
121 'Adj' CENTERED, 130 SY-VLINE,144 SY-VLINE,156 SY-VLINE,
1 SY-VLINE,14 SY-VLINE,27 SY-VLINE,40 SY-VLINE.
WRITE:/1(156) SY-ULINE.
*LOOP AT INT_DATA.
*PERFORM GET_OPENING_STOCK.
*APPEND INT_DATA.
*ENDLOOP.
FORMAT RESET.
ENDAT.
ENDLOOP.
ENDFORM.
*& Form BALANCE
text
--> p1 text
<-- p2 text
FORM BALANCE.
IF INT_DATA-SHKZG = 'S'.
MENGE_RE = INT_DATA-MENGE_O + INT_DATA-MENGE.
INT_DATA-MENGE_BAL = MENGE_RE.
INT_DATA-MENGE_RE = INT_DATA-MENGE.
ELSEIF INT_DATA-SHKZG = 'H'.
MENGE_RE = MENGE_RE - INT_DATA-MENGE.
INT_DATA-MENGE_BAL = MENGE_RE.
INT_DATA-MENGE_IS = INT_DATA-MENGE.
ENDIF.
ENDFORM. " BALANCE
FORM HEADER_WRITE.
SKIP.
WRITE: /1(156) SY-ULINE.
WRITE: /1 SY-VLINE,
2(144) 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
INTENSIFIED CENTERED," INVERSE ON
156 SY-VLINE.
WRITE: /1(156) SY-ULINE.
WRITE: /1 SY-VLINE,
2(156) 'STOCK LEDGER' INTENSIFIED CENTERED,
"INVERSE ON,
156 SY-VLINE.
WRITE: /1(156) SY-ULINE.
SELECT SINGLE * FROM T001W WHERE
WERKS IN WERKS.
IF WERKS-HIGH EQ SPACE.
CONCATENATE 'Plant : ' WERKS-LOW INTO TXT.
ELSE.
CONCATENATE 'FROM PLANT : ' WERKS-LOW 'TO PLANT : ' WERKS-HIGH INTO TXT SEPARATED BY SPACE.
ENDIF.
WRITE:/ 'Plant :', WERKS-LOW,SPACE ,'-', T001W-NAME1,
82 'As Of Date :', 95 sy-datum.
IF NOT S_DATE IS INITIAL.
WRITE: / 'From:'(004), S_DATE-LOW, SPACE, 'To:'(006), S_DATE-HIGH,82 'PAGE No:', 91 SY-PAGNO..
ENDIF.
*IF FLAG5 = 'E'.
PERFORM WRITE_REPORT.
*ENDIF.
FORMAT RESET.
endform.
*& Form GET_OPENING_STOCK
text
FORM GET_OPENING_STOCK.
SELECT SUM( MZUBB ) SUM( MAGBB ) INTO (V_STOCK, V_STOCK1)
FROM S031 WHERE MATNR = ITAB-MATNR AND
WERKS = ITAB-WERKS AND
SPMON LT V_MONTH1 AND LGORT = ITAB-LGORT.
OSTOCK = V_STOCK1 - V_STOCK.
IF OSTOCK < 0.
OSTOCK = OSTOCK * -1.
ENDIF.
ENDFORM. " GET_OPENING_STOCK
Thanks & Regards,
Sreedhar.Hi,
Check if the data is there in the data target on which your report is based.
Check to see if this data is available for reporting.
Check to see if you have auth to view this data.
Check if there are any filters or restrictions in the query that would prevent the data from being displayed.
Check the data through LISTCUBE transaction.
Hope this helps...
Maybe you are looking for
-
How can I change an embedded link to a website in a pdf in Pro XI
How can I change an embedded link to a website in a pdf in Pro XI for Mac?
-
Error while apply oracle patch 10.2.0.4
hi.. i am applying oracle patch 10.2.0.4 on my Production system , it generating error E:\oracle\R3D\102\OPatch>opatch apply Invoking OPatch 10.2.0.2.0 Oracle interim Patch Installer version 10.2.0.2.0 Copyright (c) 2005, Oracle Corporation. All rig
-
List problem of birthdays in the calendar application
Hi, I have an iPhone4 and an iPad. When using the list view in the calendar aplication in the iPad, then all birthday dates are one day too early, but when opening for example the week view then the date is correct. In my iPhone4 the dates of the bir
-
How To Setup A Local Exchange Server Integrated With Office365 For A Single Mailbox
Hello, We recently migrated to Office365 but had an issue since we need more than 16 simultaneous connections to a single mailbox. Because of this, we need to deploy a local Exchange Server that will be used to host a single mailbox that requires up
-
Maximum number of items for an FI document ('999') has been exceded
Hi, I have try to move some materials from one storage location to another using MB1B transaction. And i receive following error: Maximum number of items for an FI document ('999') has been exceded. Please someone help me. Thank you.