cancel
Showing results for 
Search instead for 
Did you mean: 

Problem in validity of Cost Run

ankit_agarwal8
Contributor
0 Kudos

Hi,

We have a material for which I have a cost estimate valid from 01/06/2014 to 30/06/2014. But I if a create a production order on today i.e. 01/08/2014, I am able to create the production order.

As per my understanding system should not allow me to create production order for this material, if I have no valid cost estimate on 01/08/2014.In material master also,it is showing me the cost estimate is related to month 6.

Is any configuration is missing or something else. Please guide.

Regards,.

Ankit Agarwal

Accepted Solutions (1)

Accepted Solutions (1)

former_member195434
Contributor
0 Kudos

Hi Ankit,

Your understanding is wrong.

You can create a produciton order even if there is no valid std cost estimate for the material as on that date.

The only issue will be that your variance will not be captured accurately since your cost estimate is not up-to-date.

BR

Abhi

Answers (3)

Answers (3)

former_member191939
Active Contributor
0 Kudos

Hi Ankit,

As experts have already given their views and they are very right in what they have said and suggested.

I would like to throw some light on the same issue which you are facing,because even I had the same problem which was resolved by using USER EXIT-PPCO0001.


Try this user exit and see if it solves your purpose.


Hope this will help you

Regards

Eugene

ankit_agarwal8
Contributor
0 Kudos

Hi Ranu,

Thanks for your kind response.

What type of logic you have used in USER EXIT-PPCO0001. Can you please give me some details regarding this.

Regards,

Ankit Agarwal

former_member191939
Active Contributor
0 Kudos

Hi Ankit,

Please find the logic below and for implementing it Please take help of your ABAPER.

IF SY-TCODE = 'CO01' OR SY-TCODE = 'CO40'. "or Sy-Tcode = 'CO41'.   TABLES : CAUFVD .   DATA : F_LPLPR TYPE CK_LPLPR .   DATA : V_BUPER TYPE BUPER,         V_PERIOD TYPE BUPER,         V_PRD TYPE BUPER,         V_PLNUM TYPE PLNUM,         V_PSTTR TYPE PSTTR,         V_MONAT TYPE MONAT,         V_GJAHR TYPE GJAHR.   TYPES : BEGIN OF TY_MBEW,           MATNR TYPE MATNR,           BWKEY TYPE BWKEY,           PPRDL TYPE CK_PPRDL,           PDATL TYPE CK_PDATL,           END OF TY_MBEW.   DATA : IT_MBEW TYPE STANDARD TABLE OF TY_MBEW INITIAL SIZE 0,         WA_MBEW TYPE TY_MBEW.   DATA : IT_DYNPFIELDS  TYPE STANDARD TABLE OF DYNPREAD  ,         WA_DYNPFIELDS  TYPE DYNPREAD ,         WA1_DYNPFIELDS TYPE DYNPREAD ,         WA2_DYNPFIELDS TYPE DYNPREAD ,         WA3_DYNPFIELDS TYPE DYNPREAD .   WA_DYNPFIELDS-FIELDNAME = 'CAUFVD-AUART' .   APPEND WA_DYNPFIELDS TO IT_DYNPFIELDS .   WA_DYNPFIELDS-FIELDNAME = 'CAUFVD-MATNR' .   APPEND WA_DYNPFIELDS TO IT_DYNPFIELDS .   WA_DYNPFIELDS-FIELDNAME = 'CAUFVD-WERKS' .   APPEND WA_DYNPFIELDS TO IT_DYNPFIELDS .   GET PARAMETER ID 'PAF' FIELD V_PLNUM.   SELECT SINGLE PSTTR FROM PLAF INTO V_PSTTR WHERE PLNUM = V_PLNUM.   CALL FUNCTION 'GET_CURRENT_YEAR'     EXPORTING       BUKRS = 'HNGL'       DATE  = V_PSTTR     IMPORTING       CURRM = V_MONAT       CURRY = V_GJAHR *    PREVM = *    PREVY =     .   CONCATENATE V_MONAT V_GJAHR INTO V_BUPER.   CALL FUNCTION 'DYNP_VALUES_READ'     EXPORTING       DYNAME    = 'SAPLCOKO1'       DYNUMB    = '0115'     TABLES       DYNPFIELDS = IT_DYNPFIELDS     EXCEPTIONS       OTHERS    = 1.   IF SY-SUBRC <> 0.     MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.   ENDIF.   LOOP AT IT_DYNPFIELDS INTO WA_DYNPFIELDS .     IF WA_DYNPFIELDS-FIELDNAME = 'CAUFVD-AUART' AND ( WA_DYNPFIELDS-FIELDVALUE = 'BEER' OR WA_DYNPFIELDS-FIELDVALUE = 'FODA' OR                                                       WA_DYNPFIELDS-FIELDVALUE = 'HOUH' OR WA_DYNPFIELDS-FIELDVALUE = 'LIQR' OR                                                       WA_DYNPFIELDS-FIELDVALUE = 'PHRM' OR WA_DYNPFIELDS-FIELDVALUE = 'SOFD' OR                                                       WA_DYNPFIELDS-FIELDVALUE = 'TOIL' OR WA_DYNPFIELDS-FIELDVALUE = 'WAIL' OR                                                       WA_DYNPFIELDS-FIELDVALUE = 'WIAL' OR WA_DYNPFIELDS-FIELDVALUE = 'PRFD' OR                                                       WA_DYNPFIELDS-FIELDVALUE = 'CLQR'). *      V_BUPER = V_PSTTR+0(6).       READ TABLE IT_DYNPFIELDS INTO WA2_DYNPFIELDS WITH KEY FIELDNAME = 'CAUFVD-MATNR' .       READ TABLE IT_DYNPFIELDS INTO WA3_DYNPFIELDS WITH KEY FIELDNAME = 'CAUFVD-WERKS' .       SELECT SINGLE LPLPR FROM MBEW INTO F_LPLPR WHERE MATNR = WA2_DYNPFIELDS-FIELDVALUE  AND                                                       BWKEY = WA3_DYNPFIELDS-FIELDVALUE .       SELECT MATNR             BWKEY             PPRDL             PDATL FROM MBEW INTO TABLE IT_MBEW WHERE MATNR = WA2_DYNPFIELDS-FIELDVALUE AND                                                       BWKEY = WA3_DYNPFIELDS-FIELDVALUE .       LOOP AT IT_MBEW INTO WA_MBEW.         SHIFT WA_MBEW-PPRDL LEFT DELETING LEADING '0'.         CONCATENATE '0' WA_MBEW-PPRDL INTO V_PRD.         CONCATENATE V_PRD WA_MBEW-PDATL INTO V_PERIOD.       ENDLOOP.       IF V_PERIOD NE V_BUPER.         MESSAGE 'Cost Run Not Completed for Current period' TYPE 'E'.       ENDIF.       IF F_LPLPR EQ 0.         MESSAGE 'Cost Run Not Completed for Current period' TYPE 'E'.       ENDIF. *      IF SY-SUBRC = 0 . *        IF F_LPLPR = 0 . *          MESSAGE '  Current Planned Price is 0.00 for the Material , Production Order cannot be created ' TYPE 'E' . *          NO_UPDATE = 'X' . *        ENDIF. *      ENDIF.     ENDIF .   ENDLOOP. ENDIF.

Hope this will help you.

Regards Eugene

rajneesh_saxena
Active Contributor
0 Kudos

Dear Ankit

I agree with Abhinav and Ravan both.

To add Abhinav's reply I would say that even if there is no standard cost for the header material, system is not going to stop you from making production order. And even you will be able to do GR also but at the time of GR no FI document will be generated as the SC is zero. However if you are in Prod cost by period scenario, then you have a check in standard system through REM profile.

To add Ravan's reply, there are several custom checks (BADIs) available which you can use for this purpose at various processes. You can see the document posted by Mr. Ajay Maheshwari on this. For your convenience a link is given below:

Regards

Rajneesh Saxena

Former Member
0 Kudos

Hi Ankith.

There is no such a standard functionality to stop production order without cost estimate for current period

you can use BADI work order update

Here you can find two methods 1.At saving level 2.At Releasing level

Apply this ABAP code check field MBEW-LPLPR <> 0

Regards.

Ravan