Material cost Valuation Exit: COPCP005(EXIT_SAPLCK21_002)
Hi Experts,
I am using this Enhancement COPCP005(EXIT_SAPLCK21_002) for material costing using valuation strategy U . When i try to cost a material which is a header BOM in CK11n the costing is done by info records for the header material. Configuration settings are already done in OKKN for valuation strategy U. When we tried to put a break point in user exit...it is getting triggered only for the component. i.e i am able to change the value of the component, but not for header.
Please let know if inputs you have..
Regards,
Rahul
Hi,
I have found the solution for this.
Regards,
Rahul
Similar Messages
-
Raw material costing - Valuation strategy with info-rec. "L" - Consignment
Hi all,
I want to implement raw material costing for all our raw material.
I created a new costing variant which use strategy "L" (price from purchasing info-record). My sub-strategy is 9 - Effective Price from PO followed by 5 - Effective price from info-record.
Everything works well except for consignment with vendor.
I have a raw that is procured from a vendor. The price for the raw is stored in the purchasing info-record and has condition types associated with it. This PIR is of CONSIGNMENT type. However, When costing the raw in CK11N the price for this consignment material is not pulled into the estimate.
I have seen in note 552486 that "For the valuation with a price from the info record, the system can basically only consider info records with category 'N' (normal) and 'L' (subcontracting). "
Have any of you come accross this situation? if yes, how did you resolve it?
Thanks in advanceHi,
any other idea about this ? I want to use strategy "L" but want to know if I can make it work with consignment.
Thanks -
Exit for Material Costing CK11N
Hello Experts ,
I used Function exit EXIT_SAPLCK21_002 for material costing for CK11N .
Its giving wrong value in valuation and effected in wrong Cost element or GL .
please suggest me which parameter shoul i used to get correct value and affected in
correct GL .
Becuase when i enter fixed value opf EXP_PRICE_COMPONENTS_TABLE then five different value and wittout this then different .
Thanks
Gaurav sharmaHello ,
How can get Material no which we enter on intial screen of CK11N in Exit EXIT_SAPLCK21_002 ?
Is there any enhancement for that ?
Thanks & Regards
Gaurav Sharma -
Error in quantity translation in CO-PA valuation using material costing
Dear SAP Gurus,
While releasing the billing document to accounting I am getting the following error:
Error in quantity translation in CO-PA valuation using material costing
Message no. K/821
Diagnosis
In Profitability Analysis (CO-PA), the system tried to use a material cost estimate to translate the unit KG for the material KG into the base unit of measure EA for that material.
The system could not do this.
System Response
The document cannot be processed further.
Procedure
Check the quantity entered in the affected CO-PA quantity field &V4 .
If necessary, change the material master to allow the unit KG as an alternative unit for the material 970000000000000016.
Can anyone provide me with a solution to the said problem.
Regards
NikitHi Piet,
That does not seem to be the solution as i cant define for all the materials how many units EA = how many kgs. Thanks for the reply anyway -
Valuation with material cost estimate: error with product
Hi Experts,
Message no. KE350, Valuation with material cost estimate: error with product "2286940000". Please suggest me to resolve this issue.
Points will be provided for good solution.
Regards,
JayHi Jaya
This means that your customization is wrong then...
In KE4J or KEPC you have assigned costing keys to your material types or some other combination... You should have done this config in a way that costing key is not called for in the case of non valuated materials...
In Ke40 you have defined costing key where in you have specified "Issue error msg if no cost estimate found".. This costing key is assigned in KE4J or KEPC in a way that it is getting called even in case of non valuated materials...
Do you have a separate mat type for non valuated material? If yes, remove this mat type from KE4J/KEPC..
If you dont have separate mat type i.e. in the same mat type if you have both valuated and non valuated, then you have a problem.. You would get stuck in that case
Regards
Ajay M -
Valuation using material cost estimate
Ciao a tutti,
We have create a material cost
estimate without standard structure(unit costing) not FOR ALL MATERIALS, but only for ONE
VARIANT of generic material (retail solution) (because the other variant have the same price, and because we have to reproduced 5000 BOM in unit cost for just
one variant with transaction KKPA LSMW)
So, now we have to valuated the material cost estimate when the customer create the billing document and put the split of the cost estimate in co-pa
Our prolem is : we have calculate standard cost estimate for 5000
variant not for all variant (because our customer crete the BOM in unit
costing with transaction KKPA and LSMW, and they refuced the idea to
calculate 30000 cost estimate with lsmw) so when we crete a billing
document with a variant that haven't cost estimate created the system doesn't
valuated the cost estimate (the system works well), but how I can change the variant in the valuation and put the variant that have the cost
estimate calculate?
Wiht the transaction "Assign Costing Keys to Any Characteristics" I think
is not possible.
I must to use enhance COPA0002?
Thank you very much
Paolo Artini
tel: +393299223804Hi All,
I am also facing the problem for Sales Order Cost Estimate. and the Costing Status is VO(Marked without errors).
I have done the following
created the Costing Key (sales order cost estimate)
assigned costing key to the material type.
assigned to the respective value fields
sales order cost estimate,
Run the RA
Settlement done.
But in COPA, cost estimates are not being split up based on the cost component (like Material, Labour and Over head) and it is getting posted to COGS only.
Do we need to change the costing status to FR, if yes, but how to do ?
Regards
Ramesh KR
+91 9884020411 -
Split Valuation Material Cost Estimate into COPA
Hi all,
Is there any way how we can transfer the split valuation material cost estimate into COPA?
I checked the actual line items, there is no "valuation type / batch" characteristics there.
Is this the main cause?
Please kindly suggest on the best way to solve this issue
Thank you very much
Regards, ErwinHi, Ajay
Does this mean that, even though i manage to create the valuation type as characteristic in COPA, i won't be able to get 2 different cost estimate based on valuation type into COPA?
Hm, then, are there any solutions which can be done to solve this issue?
The client needs a COPA report which can show the breakdown of the sold materials cost estimates
As usual, thank you very much for your help
Regards, Erwin -
Valuation with material cost estimate: error with product "117122"
Hi people,
We have the error:
=====================
Valuation with material cost estimate: error with product "117122"
Diagnosis
In Profitability Analysis (CO-PA), the system tried to valuate a line item using the current standard cost estimate.
In order to determine the current plan period, the system needs to read the valuation segment of the material master.
The system has found that the current plan period is not filled forproduct "117122" in plant "UBE1".
We have the follow configuration in trans.: KE40:
. Determine material cost estimate
. Transf. Standard Cost Estimate
. Costing Variant
. Control Data for Standard Cost Estimate
. Period Indicator = "Current Standard Cost Estimate acc. to entry in mat master
. Addiitonal data CO-PC
. Transfer cost estimate in controlling area currency "activated"
We think the reason about our error is because the field above is activated and some configuration more is necessary for this case. For examplo: Trans.: OKYW and this one was not configurated yet.
Do you know what happend?
If we need to configure some transation, or sonly process the cost estimate?
Thanks,
Rosana.Hello Guido
Thank you very much for your return.
It is happenning in a Client that some people are doing the configuration.
Before we didin't have in KE40, the fiel "Transfer cost estimate in controlling area currency" activated.
And now, the people activate that in this new Client and I don't know the impact about that.
I think we have to make the configuration in OKYW.
The other transation you told me, we don't have any information.
Could you tell me some other idea what happend?
Message error is just "Message no. KE350"
Abou claculate the cost:
It was calculated by trans.: CK11N for future planning and the real wasn't not possible to release because this material already have moviments.
Could you tell us is there is some thing more to do?
Thanks,
Rosana. -
Valuation with material cost estimate: error with product " 200038 "
Hi,
I am getting an error:
Valuation with material cost estimate: error with product " 200038 " (Message KE350).
Kindly assist on the same?If this material is mto material go to t.code KE40 and maintain define access to standard cost estimate define cost key with
"Transfer sales orde cost estimatex".
If it is mts material define costing key with Transfer std cost estimate and in costing data
costing variant : ppc1
costing verstion: 1
period indicator: Release std cost estimate matching with goods issue or material costing matching posting date.
This will resolve ur problem. -
Valuation with Material cost estimate
Hi,
I am getting an error: "Valuation with material cost estimate:error with product 003443434(material number)
Does anyone know which transaction is used to correct this error?
ThanksHi,
Go to MM02. Select the views of the materials i.e. accounting 1 & 2 , costing 1 & 2 . Look at the valuation class u have maintained for the same material in the view Accounting 1.
Hope u will get ur problem solved..Assign points, if helpful.
Satya -
About Material Cost Estimatite Valuation Strategy
Material PPC001 have three purchase info record, it's price is 4.27/CNY,3.68/CNYand 2.56/CNY. Price 4.27/CNY and 2.56/CNY have invalid. Material of moving average price is 3.14/CNY. When I create the material cost estimate,in the material valuation, system use moving average price to calculate cost price. But in last month, I create the cost estimate, the material vaulation is use Price form purchase info record. I dont know what the material still has valid price 3.68/CNY, why system use moving average price to calculate cost price? How to work about the material valuation Strategy?
My material valuation variants priority strategy sequence is 1.Price form Purchasing Info Record,2.Moving Average Price,3.Standard Price in Previous Period.Hi Jack,
This forum is specific to SAP Master Data Management and your query is related to MM I guess. Post your query on below link to get it solved quickly.
SAP ERP - Logistics Materials Management (SAP MM)
Regards,
Jitesh Talreja -
Split valuation / material costing
Hi all
I am valuating a raw material twice since in-house production( 50 INR) and external procurement(100 INR). Material code is same as usual. This material is used to make a fert material and is to be included in costing. If then, which valuation type will the system take?
Yuvi.costing depends on the usage of the material with split valuation
Eg . Material : AAA
Inhouse material cost -- Rs 50 -valuation type :XXX
External procurment - Rs 100-Valuation Type :YYY
you are assembling this material AAA and FERT is made
Fert Material : CCC
BBB :inhouse machining cost -Rs 25.00
costing of CCC:if you
inhouse material then -> 50+25.00-75.00
External procurement -100+25.00->125.00
Hope it is clear
G.Ganesh Kumar -
Re: create material cost estimate with ck11n without
hi gurus,
i need to do create material cost estimate with ck11n without cost result but before i need to check the BOM with material component 11111, and also instruct me how to correct maintain BOM list to get the standard cost
if anybody do the same scenoria giveme your golden inputs
thanks in advance,
kumar.bHi,
As note 351835 explains, calculation needs an inforecord to calculate prices from purchasing. Prices from outline agreements are generally not taken into account. According to note 499699, the system may consider entries in the source but it will ignore entered agreements (before this correction, any source list entries with agreement were ignored).
Prices from agreements could only be considered either via a modification or by using the user exit for material valuation (COPCP005).
This unfortuntely is a restriction resulting as a side-effect from note 499699. As soon as an agreement is entered in the source list, the fixed indicator will not be considered anymore.
You therefore have two options to overcome this.
1) You create a second source list entry without an agreement; then the fix indicator will be reflected; report Z_CREATE_EORD from note 409960 could be used to do this automatically
2) You are using user-exit EXIT_SAPLMEQR_001 in order to 'overrule' the standard search for source of supply (enhancement LMEQR001)
regards
Waman -
Unit costing for materials assigned to activity - for material cost plannin
The requirement is that material cost to the company will vary depending upon the project/customer. Eg.: Material cost = basic material cost + a % for P&F + 2 % for Clearance + a % for excise + 2 % for insurance + a % for Customs
It can be a % or a lump-sum value. It can be all the components listed or part of them. This will be project specific.
Hence the following preference for material cost planning is required:
1. Material cost based on quotation or Purchase order - If quote/PO is not available, then
2.Material cost based on unit costing done for the material in the project - If this is not available, then
3. material cost from material master depending on price indicator i.e. Std cost or Moving average price
We are working with valuated project stock.
SAP Help says"
"Prices are calculated in one of the following ways:
u2022 Using the strategy in the valuation variant
u2022 Manually, using the invoicing plan
u2022 Using unit costing"
But how to get the cost as per the priority required when these three options are there is not clear.
I have tried to work with valuation variant in the costing variant assigned to Network. No valuation strategy explicitly refers to unit costing of material.
During various testings, at times, unit costing of material gets updated as planned cost; at times not. What triggers in also not clear.
Pl. clarify
Thanks and regards
A.SaravananHi All
I have psoted to service market place and got the reply; we have implemented also.
there were 2 suggestiosn:
1. Valuation price with user exit - (EXIT_SAPLCK21_002) - This user exit has to be implemented; we have implemented - it is working. But this is taking effect when overhead calculation is done - this we rae managing that way now
2. Alternatively you can try to use BAdI VALUATION_CK.: This BADI is not editable by us now; SAP has not released for our editing!
The problem is solved although
There is one more clarification required:
As SAP Help documentation: -> Unit costing is used instead of strategy sequence, but not in between steps of strategy.
How to get this done ? right now we are using the strategy - inbetween steps of strategy with user exit
Thanks and regards
A.Saravanan -
Hi,
any one can help in this issue.
i am not getting the raw materila cost & manfacture conversion cost for for the bom of FG - SFG - SFG - SFG- RAW
FG - finished goods,
SFG - semi finished goods
RAW - raw material.
plz provide the solution.
raw material and manfacture conversion cost is calculated in PERFORM z_process_data. subroutine.
REPORT z_co_production_cost_nsk.
TABLES: afko, bkpf, t001w , caufv.
TYPE-POOLS: kkblo,
slis.
DATA: d_datefrom LIKE sy-datum,
d_dateto LIKE sy-datum,
d_repid LIKE sy-repid,
d_uname LIKE sy-uname,
d_returncode TYPE i,
d_tabix TYPE i,
d_kokrs LIKE tka01-kokrs,
d_waers LIKE tka01-waers,
wa_fieldcatalog TYPE slis_fieldcat_main,
wa_listevents TYPE slis_alv_event,
wa_listlayout TYPE slis_layout_alv,
wa_print_info TYPE slis_print_alv,
wa_listheader TYPE slis_listheader,
d_headerlines TYPE i.
DATA: BEGIN OF t_caufv OCCURS 0,
aufnr TYPE caufv-aufnr,
werks TYPE caufv-werks,
objnr TYPE covp-objnr,
gamng TYPE caufv-gamng,
plnbez TYPE caufv-plnbez,
rsnum TYPE caufv-rsnum,
END OF t_caufv.
*Added by Anand Bothra on 24/11/2003
DATA: t_ab_caufv LIKE t_caufv OCCURS 0 WITH HEADER LINE.
DATA: t_temp_caufv LIKE t_caufv OCCURS 0 WITH HEADER LINE.
DATA: BEGIN OF t_afpo OCCURS 0,
aufnr TYPE afpo-aufnr,
posnr TYPE afpo-posnr,
wemng TYPE afpo-wemng,
amein TYPE afpo-amein,
charg TYPE afpo-charg,
END OF t_afpo.
DATA: BEGIN OF t_afpo1 OCCURS 0,
aufnr TYPE afpo-aufnr,
refaufnr TYPE afpo-aufnr,
objnr TYPE caufv-objnr,
rsnum TYPE afko-rsnum,
wemng TYPE afpo-wemng,
werks TYPE afpo-dwerk,
charg TYPE afpo-charg,
END OF t_afpo1.
DATA: BEGIN OF t_makt OCCURS 0,
matnr TYPE makt-matnr,
maktx TYPE makt-maktx,
END OF t_makt.
DATA: t_fieldcatalog TYPE slis_t_fieldcat_alv,
t_listevents TYPE slis_t_event,
t_sortsequence TYPE slis_t_sortinfo_alv,
t_listheader TYPE slis_t_listheader.
DATA: BEGIN OF t_production_costs OCCURS 0,
objnr TYPE covp-objnr, " Object Number
kstar TYPE covp-kstar, " Cost Element
wkgbtr TYPE covp-wkgbtr, " Cost of Line Item in CO area curr
mbgbtr TYPE covp-mbgbtr, " Quantity of Line Item
matnr TYPE covp-matnr, " Material Number
kokrs TYPE covp-kokrs, " Controlling Area
belnr TYPE covp-belnr, " Cost Accounting Document
buzei TYPE covp-buzei, " Item Number in Document
END OF t_production_costs.
DATA: BEGIN OF t_production_costs1 OCCURS 0,
objnr TYPE covp-objnr, " Object Number
kstar TYPE covp-kstar, " Cost Element
wkgbtr TYPE covp-wkgbtr, " Cost of Line Item in CO area curr
mbgbtr TYPE covp-mbgbtr, " Quantity of Line Item
kokrs TYPE covp-kokrs, " Controlling Area
belnr TYPE covp-belnr, " Cost Accounting Document
buzei TYPE covp-buzei, " Item Number in Document
END OF t_production_costs1.
DATA t_production_costs2 LIKE t_production_costs1
OCCURS 0 WITH HEADER LINE.
DATA: BEGIN OF t_suborders OCCURS 0,
aufnr TYPE caufv-aufnr,
prevaufnr TYPE caufv-aufnr,
objnr TYPE covp-objnr,
rsnum TYPE caufv-rsnum,
END OF t_suborders.
DATA: BEGIN OF t_outputtab OCCURS 0,
plnbez LIKE afko-plnbez, " Material Number
objnr LIKE caufv-objnr, " Object Number
maktx LIKE makt-maktx, " Material Description
charg LIKE afpo-charg, " Batch Number
aufnr LIKE afko-aufnr, " Production Order Number
gamng LIKE caufv-gamng, " Total Order Quantity
wemng LIKE afpo-wemng, " Goods Receipt Quantity
amein LIKE afpo-amein, " Unit of Measure
yield TYPE p DECIMALS 2, " Percentage Yield
totalrmcost TYPE p DECIMALS 2, " Total Raw Material Cost
totalpmcost TYPE p DECIMALS 2, " Total Packing Mat. Cost
mfgconvcost TYPE p DECIMALS 2, " Manu. Conversion Cost
pkgconvcost TYPE p DECIMALS 2, " Packing Conv. Cost
rmperunit TYPE p DECIMALS 2, " Raw Cost per unit
pmperunit TYPE p DECIMALS 2, " Pack Mat cost per unit
ccperunit TYPE p DECIMALS 2, " Conv Cost per unit
totperunit TYPE p DECIMALS 2, " Total Cost per unit
waers LIKE tka01-waers, " Currency Key for CO Area
END OF t_outputtab.
*Added by Anand Bothra on 24/11/2003.
DATA: t_ab_outputtab LIKE t_outputtab OCCURS 0 WITH HEADER LINE,
t_temp_outputtab LIKE t_outputtab OCCURS 0 WITH HEADER LINE.
BEGIN OF INSERTION VIP110703
DATA:wa_prev_outputtab LIKE LINE OF t_outputtab,
wa_production_costs LIKE LINE OF t_production_costs.
DATA:prev_totmatqty TYPE p DECIMALS 2,
prev_tot_mfgconv_cst TYPE p DECIMALS 2,
grand_mat_qty TYPE p DECIMALS 2 ,
tmp_aufnr TYPE caufv-aufnr.
DATA: BEGIN OF t_suborders_propcost OCCURS 0,
aufnr TYPE caufv-aufnr,
prevaufnr TYPE caufv-aufnr,
objnr TYPE covp-objnr,
rsnum TYPE caufv-rsnum,
proprmcost TYPE p DECIMALS 2,
prop_mfg_convcost TYPE p DECIMALS 2,
END OF t_suborders_propcost.
DATA: wa_suborders LIKE LINE OF t_suborders.
END OF INSERTION VIP110703
BEGIN OF INSERTION VIP111003
DATA: prev_aufnr TYPE caufv-aufnr,
prev_matnr TYPE mara-matnr,
curr_matnr TYPE mara-matnr.
DATA: bln_suborder ,
ratio TYPE p DECIMALS 5.
BEGIN OF INSERTION VIP111003
*Added by Anand Bothra on 28/11/2003
DATA: d_flag TYPE c.
SELECTION-SCREEN BEGIN OF BLOCK zblock1 WITH FRAME TITLE text-001.
SELECT-OPTIONS: s_plnbez FOR afko-plnbez,
s_aufnr FOR afko-aufnr,
"Added By Vivek on 29.11.2005
s_auart FOR caufv-auart obligatory.
PARAMETERS p_werks LIKE t001w-werks OBLIGATORY.
SELECTION-SCREEN END OF BLOCK zblock1.
SELECTION-SCREEN BEGIN OF BLOCK zblock2 WITH FRAME TITLE text-002.
SELECT-OPTIONS: s_monat FOR bkpf-monat NO-EXTENSION OBLIGATORY.
PARAMETERS p_gjahr LIKE bkpf-gjahr OBLIGATORY.
SELECTION-SCREEN END OF BLOCK zblock2.
SELECTION-SCREEN BEGIN OF BLOCK zblock3 WITH FRAME TITLE text-022.
PARAMETERS: p_detsum RADIOBUTTON GROUP rad,
p_sum RADIOBUTTON GROUP rad.
SELECTION-SCREEN END OF BLOCK zblock3.
INITIALIZATION.
d_repid = sy-repid.
d_uname = sy-uname.
p_werks = 'G001'.
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF screen-name EQ 'P_WERKS'.
screen-input = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
AT SELECTION-SCREEN ON s_monat.
IF s_monat-high IS INITIAL.
IF NOT ( s_monat-low BETWEEN 1 AND 12 ).
MESSAGE e398(00) WITH text-023 text-024 space space.
ENDIF.
ELSE.
IF ( ( s_monat-low LT 1 ) OR ( s_monat-high GT 12 ) ).
MESSAGE e398(00) WITH text-023 text-024 text-025 space.
ENDIF.
ENDIF.
START-OF-SELECTION.
PERFORM z_get_period_dates.
PERFORM z_select_prod_orders.
PERFORM z_select_prod_costs.
PERFORM z_select_addl_prod_costs.
PERFORM z_select_mat_desc.
END-OF-SELECTION.
IF d_returncode EQ 0.
PERFORM z_process_data.
*Added by Anand Bothra on 24/11/2004.
PERFORM z_select_to_print.
PERFORM z_prepare_fieldcat.
PERFORM z_get_alv_events.
PERFORM z_define_sortsequence.
PERFORM z_define_layout.
PERFORM z_display_list.
*Added by Anand Botra on 25/11/2003.
PERFORM z_export_to_excel.
PERFORM z_send_mail_and_download.
ELSE.
MESSAGE i017(p5).
ENDIF.
*& Form Z_GET_PERIOD_DATES
text
--> p1 text
<-- p2 text
FORM z_get_period_dates.
Determine the date range from the fiscal period range and
fiscal year entered on the selection screen
DATA: d_firstdate LIKE sy-datum,
d_lastdate LIKE sy-datum,
t_dates LIKE scscp_period_str OCCURS 0 WITH HEADER LINE.
CALL FUNCTION 'FIRST_AND_LAST_DAY_IN_YEAR_GET'
EXPORTING
i_gjahr = p_gjahr
i_periv = 'V3'
IMPORTING
e_first_day = d_firstdate
e_last_day = d_lastdate
EXCEPTIONS
input_false = 1
t009_notfound = 2
t009b_notfound = 3
OTHERS = 4.
CALL FUNCTION 'CSCP_PARA1_GET_PERIODS'
EXPORTING
i_datuv = d_firstdate
i_datub = d_lastdate
i_timeunit = 'M'
TABLES
et_dates = t_dates.
SORT t_dates BY sindex.
DELETE t_dates INDEX 1.
LOOP AT t_dates.
SUBTRACT: 1 FROM t_dates-sindex,
1 FROM t_dates-datub.
MODIFY t_dates TRANSPORTING sindex datub.
ENDLOOP.
CLEAR: d_datefrom,
t_dates.
READ TABLE t_dates WITH KEY sindex = s_monat-low.
d_datefrom = t_dates-datuv.
CLEAR d_dateto.
IF s_monat-high IS INITIAL.
d_dateto = t_dates-datub.
ELSE.
CLEAR t_dates.
READ TABLE t_dates WITH KEY sindex = s_monat-high.
d_dateto = t_dates-datub.
ENDIF.
ENDFORM. " Z_GET_PERIOD_DATES
*& Form Z_SELECT_PROD_ORDERS
text
--> p1 text
<-- p2 text
FORM z_select_prod_orders.
Select all production orders as per the selection criteria provided
DATA: d_dlv_code LIKE jstat-stat,
d_teco_code LIKE jstat-stat,
t_status LIKE jstat OCCURS 0 WITH HEADER LINE.
SELECT SINGLE name1 INTO t001w-name1 FROM t001w WHERE werks = p_werks.
if s_plnbez-low eq space and s_plnbez-high eq space.
endif.
SELECT aufnr werks objnr gamng rsnum plnbez
INTO CORRESPONDING FIELDS OF
TABLE t_caufv FROM caufv
WHERE aufnr IN s_aufnr
AND auart IN ('PP01', 'LL02') : BY VIVEK
AND auart in s_auart " Added By Vivek on 29.11.2005
AND werks = p_werks
AND plnbez IN s_plnbez
AND getri BETWEEN d_datefrom AND d_dateto
ORDER BY aufnr.
d_returncode = sy-subrc.
IF d_returncode NE 0.
STOP.
ENDIF.
Filter out only those production orders that have a status
DLV (Delivered) or TECO (Technically Confirmed).
CLEAR: d_dlv_code,
d_teco_code.
PERFORM z_get_status_code USING 'DLV' CHANGING d_dlv_code.
PERFORM z_get_status_code USING 'TECO' CHANGING d_teco_code.
LOOP AT t_caufv.
REFRESH t_status.
CALL FUNCTION 'STATUS_READ'
EXPORTING
CLIENT = SY-MANDT
objnr = t_caufv-objnr
only_active = 'X'
IMPORTING
OBTYP =
STSMA =
STONR =
TABLES
status = t_status
EXCEPTIONS
object_not_found = 1
OTHERS = 2
IF sy-subrc EQ 0.
CLEAR t_status.
READ TABLE t_status WITH KEY stat = d_dlv_code.
IF sy-subrc NE 0.
CLEAR t_status.
READ TABLE t_status WITH KEY stat = d_teco_code.
IF sy-subrc NE 0.
DELETE t_caufv.
ENDIF.
ENDIF.
ELSE.
DELETE t_caufv.
ENDIF.
ENDLOOP.
IF t_caufv[] IS INITIAL.
d_returncode = 4.
STOP.
ENDIF.
Added by Anand Bothra on 24/11/2003**********
t_ab_caufv[] = t_caufv[].
Added by Anand Bothra on 28/11/2003.
IF ( s_plnbez-low EQ space AND s_plnbez-high EQ space ).
IF ( s_aufnr-low EQ space AND s_aufnr-high EQ space ).
d_flag = 'N'.
ELSE.
d_flag = 'Y'.
ENDIF.
ELSE.
d_flag = 'Y'.
ENDIF.
IF d_flag = 'Y'.
Added by Anand Bothra on 21/11/2003.**********
*Get the batch number of the entered order
DATA: itab_afpo LIKE afpo OCCURS 100 WITH HEADER LINE.
DATA: BEGIN OF t_ab_charg OCCURS 0,
*Added by Anand on 27/11/2003
aufnr LIKE afpo-aufnr,
charg LIKE afpo-charg,
END OF t_ab_charg.
LOOP AT t_caufv.
SELECT aufnr charg FROM afpo INTO t_ab_charg WHERE aufnr =
t_caufv-aufnr.
APPEND t_ab_charg.
CLEAR t_ab_charg.
ENDSELECT.
ENDLOOP.
IF sy-subrc = 0.
SELECT * FROM afpo INTO TABLE itab_afpo WHERE charg = d_ab_charg.
ENDIF.
LOOP AT t_ab_charg.
SELECT * FROM afpo INTO itab_afpo WHERE charg = t_ab_charg-charg.
APPEND itab_afpo.
CLEAR itab_afpo.
ENDSELECT.
ENDLOOP.
CLEAR t_caufv.
REFRESH t_caufv.
*Get all the orders with the same batch number.
LOOP AT itab_afpo.
SELECT aufnr werks objnr gamng rsnum plnbez
INTO CORRESPONDING FIELDS OF
t_caufv FROM caufv WHERE aufnr = itab_afpo-aufnr.
APPEND t_caufv.
ENDSELECT.
ENDLOOP.
CLEAR t_caufv.
SORT t_caufv BY aufnr.
delete adjacent duplicates from t_caufv comparing all fields.
ENDIF.
SELECT aufnr posnr wemng amein charg INTO TABLE t_afpo
FROM afpo FOR ALL ENTRIES IN t_caufv
WHERE aufnr = t_caufv-aufnr.
d_returncode = sy-subrc.
IF d_returncode NE 0.
STOP.
ENDIF.
SORT t_afpo BY aufnr.
ENDFORM. " Z_SELECT_PROD_ORDERS
*& Form Z_SELECT_MAT_DESC
text
--> p1 text
<-- p2 text
FORM z_select_mat_desc.
Get the Description of all materials
SELECT matnr maktx INTO TABLE t_makt FROM makt
FOR ALL ENTRIES IN t_caufv
WHERE matnr = t_caufv-plnbez
AND spras = sy-langu.
ENDFORM. " Z_SELECT_MAT_DESC
*& Form Z_PROCESS_DATA
text
--> p1 text
<-- p2 text
FORM z_process_data.
Process the data from all production orders and prepare the output
table for display appropriately
DATA: d_mbgbtr TYPE p DECIMALS 3,
loop_cnt TYPE i.
REFRESH t_outputtab.
LOOP AT t_caufv.
CLEAR t_outputtab.
MOVE-CORRESPONDING t_caufv TO t_outputtab.
CLEAR t_makt.
READ TABLE t_makt WITH KEY matnr = t_caufv-plnbez.
IF sy-subrc EQ 0.
MOVE t_makt-maktx TO t_outputtab-maktx.
ENDIF.
CLEAR t_afpo.
READ TABLE t_afpo WITH KEY aufnr = t_caufv-aufnr.
IF sy-subrc EQ 0.
MOVE: t_afpo-wemng TO t_outputtab-wemng,
t_afpo-amein TO t_outputtab-amein,
t_afpo-charg TO t_outputtab-charg.
ENDIF.
IF t_outputtab-gamng NE 0.
COMPUTE t_outputtab-yield =
( t_outputtab-wemng / t_outputtab-gamng ) * 100.
ENDIF.
APPEND t_outputtab.
ENDLOOP.
SORT t_production_costs BY objnr kstar.
LOOP AT t_production_costs.
AT NEW objnr.
CLEAR: d_mbgbtr, d_tabix, t_outputtab.
READ TABLE t_outputtab WITH KEY objnr = t_production_costs-objnr.
MOVE sy-tabix TO d_tabix.
" Add up the Raw Material and Manufacturing Conversion
" Costs from the previous stage production order
CLEAR loop_cnt .
LOOP AT t_suborders WHERE aufnr = t_outputtab-aufnr.
commented by anand bothra on 20/11/2003
ADD 1 TO loop_cnt.
IF loop_cnt > 1.
EXIT.
ENDIF.
LOOP AT t_production_costs1 WHERE objnr = t_suborders-objnr.
CASE t_production_costs1-kstar.
WHEN '0005000000' OR '0005010000'. " Raw Material Cost
BEGIN OF deletion VIP110703
ADD t_production_costs1-wkgbtr TO t_outputtab-totalrmcost.
END OF deletion VIP110703
ADD t_production_costs1-wkgbtr TO prev_totmatqty.
WHEN '0000500100'. " Manufacturing Conversion Cost
ADD t_production_costs1-wkgbtr TO prev_tot_mfgconv_cst.
BEGIN OF deletion VIP110703
ADD t_production_costs1-wkgbtr TO t_outputtab-mfgconvcost.
END OF deletion VIP110703
ENDCASE.
ENDLOOP.
BEGIN OF INSERTION VIP110703
READ TABLE t_production_costs INTO wa_production_costs
WITH KEY objnr = t_production_costs-objnr
matnr = wa_prev_outputtab-plnbez.
IF sy-subrc = 0.
IF ( wa_production_costs-mbgbtr NE
wa_prev_outputtab-wemng ) .
prev_totmatqty = ( prev_totmatqty /
wa_prev_outputtab-wemng ) *
wa_production_costs-mbgbtr.
prev_tot_mfgconv_cst = ( prev_tot_mfgconv_cst /
wa_prev_outputtab-wemng ) *
wa_production_costs-mbgbtr.
ENDIF.
ENDIF.
LOOP AT t_suborders_propcost
WHERE prevaufnr = wa_prev_outputtab-aufnr.
t_suborders_propcost-proprmcost = prev_totmatqty.
t_suborders_propcost-prop_mfg_convcost = prev_tot_mfgconv_cst
MODIFY t_suborders_propcost.
ENDLOOP.
clear: prev_totmatqty,
prev_tot_mfgconv_cst.
END OF INSERTION VIP110703
BEGIN OF INSERTION VIP111003
CLEAR: wa_prev_outputtab,
wa_production_costs.
READ TABLE t_outputtab INTO wa_prev_outputtab
WITH KEY aufnr = t_suborders-prevaufnr.
ratio = 1.
IF sy-subrc = 0.
READ TABLE t_production_costs INTO wa_production_costs
WITH KEY objnr = t_outputtab-objnr
matnr = wa_prev_outputtab-plnbez.
IF sy-subrc = 0.
IF ( wa_production_costs-mbgbtr NE
wa_prev_outputtab-wemng ) .
ratio = wa_production_costs-mbgbtr /
wa_prev_outputtab-wemng.
prev_totmatqty = ( prev_totmatqty /
wa_prev_outputtab-wemng ) *
wa_production_costs-mbgbtr.
prev_tot_mfgconv_cst = ( prev_tot_mfgconv_cst /
wa_prev_outputtab-wemng ) *
wa_production_costs-mbgbtr.
ENDIF.
ENDIF.
ENDIF.
LOOP AT t_suborders_propcost
WHERE prevaufnr = wa_prev_outputtab-aufnr
AND aufnr = t_outputtab-aufnr.
t_suborders_propcost-proprmcost = prev_totmatqty.
t_suborders_propcost-prop_mfg_convcost = prev_tot_mfgconv_cst.
MODIFY t_suborders_propcost.
ENDLOOP.
*Commented by Anand Bothra on 20/11/2003.
CLEAR: prev_totmatqty,
prev_tot_mfgconv_cst.
BEGIN OF INSERTION VIP111003
ENDLOOP.
ENDAT.
AT END OF kstar.
SUM.
CASE t_production_costs-kstar.
WHEN '0000500200'. " Packing Conversion Costs
t_outputtab-pkgconvcost = t_production_costs-wkgbtr.
WHEN '0005000500'. " Semi-Finished Cost/Quantity
MOVE t_production_costs-mbgbtr TO d_mbgbtr.
WHEN '0005050000' OR '0005050001' OR '0005050002'.
" Packing Mat Costs
ADD t_production_costs-wkgbtr TO t_outputtab-totalpmcost.
WHEN '0005000000' OR '0005010000'.
ADD t_production_costs-wkgbtr TO t_outputtab-totalrmcost.
WHEN '0000500100'. " Manufacturing Conversion Cost
ADD t_production_costs-wkgbtr TO t_outputtab-mfgconvcost.
ENDCASE.
ENDAT.
AT END OF objnr.
MOVE d_waers TO t_outputtab-waers.
Calculations for the Production Order
" Determine the RM Cost/Unit and Mfg Conv Cost/Unit
CLEAR t_afpo1.
READ TABLE t_afpo1 WITH KEY aufnr = t_outputtab-aufnr.
IF ( ( sy-subrc EQ 0 ) AND ( t_afpo1-wemng NE 0 ) ).
BEGIN OF insertion VIP110703
tmp_aufnr = t_production_costs-objnr+2(12).
LOOP AT t_suborders_propcost
WHERE aufnr = tmp_aufnr .
ADD t_suborders_propcost-proprmcost TO t_outputtab-totalrmcost
ADD t_suborders_propcost-prop_mfg_convcost TO
t_outputtab-mfgconvcost.
ENDLOOP.
END OF insertion VIP110703
BEGIN OF insertion VIP111003
CLEAR: t_suborders_propcost , tmp_aufnr.
READ TABLE t_suborders_propcost
WITH KEY aufnr = t_outputtab-aufnr.
IF sy-subrc = 0.
t_suborders_propcost-proprmcost =
t_suborders_propcost-proprmcost * ratio.
ADD t_suborders_propcost-proprmcost
TO t_outputtab-totalrmcost.
t_suborders_propcost-prop_mfg_convcost =
t_suborders_propcost-prop_mfg_convcost * ratio.
ADD t_suborders_propcost-prop_mfg_convcost
TO t_outputtab-mfgconvcost.
tmp_aufnr = t_suborders_propcost-prevaufnr.
bln_suborder = 'T'.
WHILE bln_suborder = 'T'.
CLEAR: t_suborders_propcost .
READ TABLE t_suborders_propcost
WITH KEY aufnr = tmp_aufnr.
IF sy-subrc = 0.
t_suborders_propcost-proprmcost =
t_suborders_propcost-proprmcost * ratio.
ADD t_suborders_propcost-proprmcost
TO t_outputtab-totalrmcost.
t_suborders_propcost-prop_mfg_convcost =
t_suborders_propcost-prop_mfg_convcost * ratio.
ADD t_suborders_propcost-prop_mfg_convcost
TO t_outputtab-mfgconvcost.
tmp_aufnr = t_suborders_propcost-prevaufnr.
ELSE.
bln_suborder = 'F'.
CLEAR tmp_aufnr.
ENDIF.
ENDWHILE.
ENDIF.
END OF insertion VIP111003
END OF deletion VIP110703
t_outputtab-mfgconvcost = ( t_outputtab-mfgconvcost /
t_afpo1-wemng ) * d_mbgbtr.
t_outputtab-totalrmcost = ( t_outputtab-totalrmcost /
t_afpo1-wemng ) * d_mbgbtr.
END OF deletion VIP110703
ENDIF.
IF t_outputtab-wemng NE 0.
t_outputtab-rmperunit = t_outputtab-totalrmcost /
t_outputtab-wemng.
" PM Cost Per Unit = Total PM Cost / Quantity Delivered
t_outputtab-pmperunit = t_outputtab-totalpmcost
/ t_outputtab-wemng.
" Conv Cost Cost Per Unit = (Manu Conv Cost + Pack Conv Cost)
" / Qty Delv
t_outputtab-ccperunit = ( t_outputtab-mfgconvcost
+ t_outputtab-pkgconvcost )
/ t_outputtab-wemng.
ENDIF.
" Total Cost Per Unit = (RM Cost per unit + PM Cost per Unit
" + Conv Cost per unit)
t_outputtab-totperunit = t_outputtab-rmperunit
+ t_outputtab-pmperunit
+ t_outputtab-ccperunit.
Update the calculated values in the internal table
CHECK d_tabix GT 0.
MODIFY t_outputtab INDEX d_tabix
TRANSPORTING totalrmcost totalpmcost
mfgconvcost pkgconvcost
rmperunit pmperunit
ccperunit totperunit waers.
BEGIN OF DELETION VIP110703
MOVE t_outputtab TO wa_prev_outputtab.
END OF DELETION VIP110703
ENDAT.
ENDLOOP.
ENDFORM. " Z_PROCESS_DATA
*& Form Z_DISPLAY_LIST
text
--> p1 text
<-- p2 text
FORM z_display_list.
Display the Report
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
i_callback_program = d_repid
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_STRUCTURE_NAME =
is_layout = wa_listlayout
it_fieldcat = t_fieldcatalog
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
it_sort = t_sortsequence
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT = ' '
it_events = t_listevents
IT_EVENT_EXIT =
is_print = wa_print_info
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = t_outputtab
EXCEPTIONS
program_error = 1
OTHERS = 2
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
SET PF-STATUS 'Z_AB_STANDARD'.
ENDFORM. " Z_DISPLAY_LIST
*& Form Z_FILL_FIELDCATALOG
text
--> p1 text
<-- p2 text
FORM z_fill_fieldcatalog USING p_rownum LIKE sy-curow
p_colnum LIKE sy-cucol
p_fieldname TYPE slis_fieldname
p_tabname TYPE slis_tabname
p_reffield TYPE dd03p-fieldname
p_reftable TYPE dd03p-tabname
p_qfield TYPE slis_fieldname
p_qtab TYPE slis_tabname
p_sum
p_stext
p_mtext
p_ltext
p_datatype
p_outputlen.
Prepare the fields for ALV list output
CLEAR wa_fieldcatalog.
wa_fieldcatalog-row_pos = p_rownum.
wa_fieldcatalog-col_pos = p_colnum.
wa_fieldcatalog-fieldname = p_fieldname.
wa_fieldcatalog-tabname = p_tabname.
wa_fieldcatalog-ref_fieldname = p_reffield.
wa_fieldcatalog-ref_tabname = p_reftable.
wa_fieldcatalog-qfieldname = p_qfield.
wa_fieldcatalog-qtabname = p_qtab.
wa_fieldcatalog-do_sum = p_sum.
wa_fieldcatalog-seltext_s = p_stext.
wa_fieldcatalog-seltext_m = p_mtext.
wa_fieldcatalog-seltext_l = p_ltext.
wa_fieldcatalog-datatype = p_datatype.
wa_fieldcatalog-outputlen = p_outputlen.
APPEND wa_fieldcatalog TO t_fieldcatalog.
ENDFORM. " Z_FILL_FIELDCATALOG
*& Form Z_PREPARE_FIELDCAT
text
--> p1 text
<-- p2 text
FORM z_prepare_fieldcat.
Append all the display fields into the field catalog internal table
First Row
PERFORM z_fill_fieldcatalog USING 1 1 'PLNBEZ' 'T_OUTPUTTAB'
space 'AFKO' space space
space space space space space
0.
PERFORM z_fill_fieldcatalog USING 1 2 'MAKTX' 'T_OUTPUTTAB'
space 'MAKT' space space
space space space space space
0.
PERFORM z_fill_fieldcatalog USING 1 3 'CHARG' 'T_OUTPUTTAB'
space 'AFPO' space space
space space space space space
0.
Second Row
PERFORM z_fill_fieldcatalog USING 2 1 'AUFNR' 'T_OUTPUTTAB'
space 'AFKO' space space
space space space space space
0.
PERFORM z_fill_fieldcatalog USING 2 2 'GAMNG' 'T_OUTPUTTAB'
space 'CAUFV' 'AMEIN' space
'X' space space space space
0.
PERFORM z_fill_fieldcatalog USING 2 3 'WEMNG' 'T_OUTPUTTAB'
space 'AFPO' 'AMEIN' space
'X' space space space space
0.
PERFORM z_fill_fieldcatalog USING 2 4 'AMEIN' 'T_OUTPUTTAB'
space 'AFPO' space space
space space space space space
0.
PERFORM z_fill_fieldcatalog USING 2 5 'YIELD' 'T_OUTPUTTAB'
space space space space
space text-010 text-010 text-010
'QUAN' 17.
Third Row
PERFORM z_fill_fieldcatalog USING 3 1 'TOTALRMCOST' 'T_OUTPUTTAB'
space space space space
'X' text-011 text-011 text-011
'CURR' 21.
PERFORM z_fill_fieldcatalog USING 3 2 'TOTALPMCOST' 'T_OUTPUTTAB'
space space space space
'X' text-012 text-012 text-012
'CURR' 21.
PERFORM z_fill_fieldcatalog USING 3 3 'MFGCONVCOST' 'T_OUTPUTTAB'
space space space space
'X' text-013 text-013 text-013
'CURR' 21.
PERFORM z_fill_fieldcatalog USING 3 4 'PKGCONVCOST' 'T_OUTPUTTAB'
space space space space
'X' text-014 text-014 text-014
'CURR' 21.
Fourth Row
PERFORM z_fill_fieldcatalog USING 4 1 'RMPERUNIT' 'T_OUTPUTTAB'
space space space space
space text-015 text-015 text-015
'CURR' 21.
PERFORM z_fill_fieldcatalog USING 4 2 'PMPERUNIT' 'T_OUTPUTTAB'
space space space space
space text-016 text-016 text-016
'CURR' 21.
PERFORM z_fill_fieldcatalog USING 4 3 'CCPERUNIT' 'T_OUTPUTTAB'
space space space space
space text-017 text-017 text-017
'CURR' 21.
PERFORM z_fill_fieldcatalog USING 4 4 'TOTPERUNIT' 'T_OUTPUTTAB'
space space space space
space text-018 text-018 text-018
'CURR' 21.
ENDFORM. " Z_PREPARE_FIELDCAT
*& Form Z_GET_ALV_EVENTS
text
--> p1 text
<-- p2 text
FORM z_get_alv_events.
Returns table of possible events for a list type
REFRESH t_listevents.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
et_events = t_listevents
EXCEPTIONS
list_type_wrong = 1
OTHERS = 2
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ELSE.
CLEAR: wa_listevents, d_tabix.
READ TABLE t_listevents WITH KEY name = slis_ev_top_of_page
INTO wa_listevents.
d_tabix = sy-tabix.Hi Sai,
You can try using MB51, use filter movement type 261. Add a filter for the posting date coverage.
Then proceed. Click on the icon DETAIL LIST.
Then click on the SUBTOTAL, add MATERIAL as a Criteria. The click the column AMOUNT IN LC.
You should see the total issuances to per material.
I hope this helps.
Heinrick Palad
Maybe you are looking for
-
In the book module of Lightroom 4 I would like to create a two-page spread with a text block
I'd like to use a single photo as a crossover through the gutter. I do not see an option to include a text block in such a layout. Am I missing something?
-
Computer slowed down a lot after downloading Mavericks 10.9.1
Hardware Information: MacBook Pro (13-inch, Late 2011) MacBook Pro - model: MacBookPro8,1 1 2.4 GHz Intel Core i5 CPU: 2 cores 4 GB RAM Video Information: Intel HD Graphics 3000 - VRAM: 384 MB System
-
If VL are there to that particular VO,Is it necessary to extend the view li
Hi Folks if VL are there to that particular VO,Is it necessary to extend the view links also while extending VO? appriciate any pointers Regards Harry
-
My ipod nano is fully charged, I put it on shuffle and the song starts, about 1 minute into the song the ipod shuts, I push the power button and it turns on to play screen I push play and song starts again where it was when it shut off. Can anyone he
-
WinFS repository content gives Internal Server Error
Hi, I am stuck with a Windows FS repository problem . The repository is displyed in KM Content with the folder hierarchy. But whichever document (xls,pdf,doc etc) that I open inside gives a "<b>Internal Server Error</b>". There are 4 repositories e