Error  -10  while closing a Production Order with DI API

I've been trying to close some production orders using this code:
Dim oProdOrder As SAPbobsCOM.ProductionOrders
            oProdOrder = Me.Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oProductionOrders)
            If oProdOrder.GetByKey(intDocEntry) Then
                oProdOrder.ProductionOrderStatus = SAPbobsCOM.BoProductionOrderStatusEnum.boposClosed
                If oProdOrder.Update <> 0 Then
                    Me.Company.GetLastError(intError, sErrMsg)
                    If (0 <> intError) Then
                        sErrorMsg = sErrorMsg & "Production Order Close Error: " & CStr(intError) & "," & sErrMsg & _
                            ". DocEntry: " & oProdOrder.ProductionOrderOriginEntry & vbCrLf
                    End If
                End If
            End If
...But I keep getting the same error every time I try: -10,Date out of reference date range, '_SYS00000005340'
The error doesn't show when I close the Order with BO's Form. And I've checked the exchange rate for the posting and due date of the document (and also for my current date) and there seems to be no problem with it.
I'm currently working with SAP BO 2004A PL 45.
Anybody has a suggestion? a workaround?
I'll appreciate any help you can give me.
Thanks in advance...

just in case,
what is the previous state of the production order (planned, released,...)?
before you try to close the order, update the status to released:
If oProdOrder.GetByKey(newID) Then
'Cambio di stato dell'ordine da 'Planned' a 'Released'
                oProdOrder.ProductionOrderStatus = boposReleased
I found this code in a DI API application written for 2004A. It was commented out so I suspect it didn't work.
'Chiusura dell 'ordine
        'SelProductionOrder.ProductionOrderStatus = boposClosed
        'ret = SelProductionOrder.Update
        'If ret <> 0 Then
        '    sboCompany.GetLastError nErr, errMsg
        '    MsgBox "Errore " & nErr & " - " & errMsg
        'End If
Hope this helps

Similar Messages

  • Closing the Production Order with status PCNF

    Hi Experts,
    May I kindly ask if I can close an order with status Partially confirmed? If not, how can I cancel the confirmation if I had already reversed the goods movement in the confirmation thereby flagging an error of a deficit in the material quantity during cancellation of the confirmation?
    I really need your help since I need to close the production orders with this case.
    Hoping so much for your replies.
    Many thanks in advance.

    I am not so clear about the exact situation.
    When you say you have reversed the goods movement with MIGO, is it reversal of the documents posted with confirmation or the individual documents?
    You can only cancle the document with MIGO which are independent of the confirmation.
    The  documents which are with the confirmation can not be reversed in any case with MIGO.
    I suggets you go this way,
    1. Check why system is giving you error as 'Deficit......'. The one thing I suspect that you must have performed auto GR & moved out the stock of FG from that location.
    If it's so then bring back the stock to it's original location & cancel the confirmation.
    While cancelling the confirmation where you might have executed goods issue with backflush this error won't arise as the stock will be bring back to storage location form the order.
    Don't reverse the cancellation of the of the documents youhave performed with MIGO for independent material posting on the order. Keep it as it is.
    This way the cancellation of confirmation & material movement will be done & now cost on the order will be zero.
    You can assign the status CLSD as well as DLFL to the order.
    2. In case you find the above activities can not be carried out for some reason then give status TECO to the order.
    Sttle the order so that the cost on the order will be zero, then give status CLSD.
    As far as possible stick to solution no. 1 only.
    Go for solution no. 2 when you don't have any other option.
    Hope this helps you.

  • Error while Closing the Production order.

    Hi ,
      We are doing operation Subcontracting Process. This process works on the basis of Production order, once the Production order generated automatically system generates a Purchase requisition which we are converting to Purchase order  and doing the sub contracting process.
    Now i have received all the material from the Subcontractor ( GRN and MIRO ) has been completed , for the Production order all the confimration and Delivery has also been completed , now i have done Technically completion for that order , now i am closing the Order ( Functions -Restrict processing - close ) , while closing it gives me an error saying that Purchase order still exists .
    Wat is this error ?? why is it coming so ??

    You have to ensure that the order is not having any WIP, if you have any WIP for that order you have to complete the order and then only you could abale to clsoe the order.
    Check the WIP for the order thorugh KKAX.
    Rama Mohan

  • Error while closing a production order

       I have raised a production order for 10 products.I have a confirmed yeild of 11 products.I have a overdue tolerance of 10% for that semi finished good.Even then it is not allowing to TECO the order.Why

    Actual problem in my case is like
    1. there are 4 operations in the semi finished good that is produced
    2.In first operation some products are produced in extra then actually required
    3.In second operation the extra quantity produced is scrapped
    4.The final quantity confirmed for the required product is same as the ordered quantiy
    Even then it is showing an error message GR quantity is more than confirmed quantity when trying to TECO the order.
    how to correct this error

  • Error when doing GR for production order with serial number

    I'm not familiar with serial number and equipment management but I'm trying to help my user resolve this issue.
    This product is returned from customer site.
    I saw that this material is being reset in IQ02 from status in warehouse to become Available when the material is consumed in the production order via 261 movement type. So now the status is available. Then the user went to change a new serial number. Later, GR for production order is done in MB31. Errors are encountered when prompted to enter the new serial number.
    Configurations XX01 and XX02 are different
    Message no. CX126
    Configuration of serial number SN02 incompatible with document item
    Message no. IO226

    Can you please explain in detail, I facing same problem, while assigning unrestricted stock to sales order.
    Sumit Pukale

  • Error message while creating production order with KMAT material strategy25

    Hi PP Gurus I am running variant configuration cycle...Strategy 25, Custermer Req KEK (KMAT Matrl)
    Sales order & MRP Picked the components correctly as per the dependencies
    written. So Planned order generated against sale order.
    When I tried to convert planned order to Production order...I am getting the
    below error message..
    Error Message:
    You cannot make an assignment to make-to-order stock Message no. CO684
    Diagnosis The component cannot be allocated to an individual stock because
    make-to-order production and engineer-to-order production cannot be executed
    with this order.
    A possible cause is that you are trying to create an order with reference to a
    sales-order/project, where an account assignment to a sales order/project is not
    allowed in the settlement profile that is assigned to the chosen order type.
    This is inconsistant.
    System response The following responses are possible:
    Order processing is cancelled.
    The system resets the special stock indicator back to the original value.
    Procedure Choose another order type.
    I used order type with SD1 as settelement profile.
    OVZG: default 046, settlement profile = SD1
    OPJH: Settlement profile = SD1
    Plz through some light on this if u have worked on Variant Configuration/MTO
    1) Is creation of production order with KMAT material supported by SAP?
    2) If yes, why the above error occurs?
    Waiting for Ur reply
    With Best Regards

    Dear R.Brahmankar,
    I have check on the note, but it is not relevant to ecc6. The current system default setting is :
    Standrad setting for reqt class 046
    Special Stock E
    Acct Assgt Cat. M
    Valuation M
    Settlmt Profile SD1
    However if I change the Acct Assgt Cat. from M to E. It resolve the problem. I would like to know is this the right solution?
    Config in Acct Assgt M
    Consumption Posting = E
    Config in Acct Assgt E
    Consumption Posting = '  '
    In F1 key of Consumption Posting field it shown following:
    To flag the sales order item as cost- and revenue-carrying, enter an "E" (settlement via sales order).
    If you do not wish to flag the sales order item as cost- and revenue-carrying, do not enter anything.
    If you are working with nonvaluated sales order stock, always flag the sales order item as cost- and revenue-carrying.
    If you are working with valuated sales order stock:
      In the case of complex make-to-order production, flag the sales order item as cost- and revenue-carrying
      In the case of sales-order-related mass production, do not flag the sales order item as cost- and revenue-carrying
    Should we change to E?

  • Serial number error while creating the production order

    Hello frds,
    I am getting the following error while creating the production order.
    "Item 000000 requires exactly 100 serial numbers for the asset".
    If i give 100 serial numbers in the order, the error is solved. But i do not want to assign 100 serial numbers, i want to assign only 2 numbers.
    I have tried using the new serial number profile also, but it is giving same error.
    Kindly guide.
    Narendra Bora

    Dear Narendra
    Select the serial number profile and go to serialization procedure and set the ser. usage status 02 - Optional as below.
    Procd Procedure description Ser.Usage
    PPRL PP order release 02
    since the serail number creation is optional for order relase this will allow you to relase with out error and with serail number assigned in partial.

  • Run time error while closing the CRM Order using BAPI

    Hi Experts,
    Need your invaluable suggestions here.Apologies for the lengthy mail, intention is to give clear idea of the issue.
    I am facing an issue while closing the CRM orders. According to our business process, when an issue is solved we will keep the order in resolved status only. We will not directly close the order from the CRM tool, instead we have created a custom program for the same purpose.
    For the custom program we will give input as the order number and execute it, this will close the order.
    Here close the order means assigning it to Close status as well assign the reason code.
    We have created some reason codes for closed status.
    So when the program is run the Order moves from resolved status to closed status along with reason code.
    But of late we are facing some problems with this program, it is giving run time error for some CRM orders.
    Run time error message : The ABAP/4 Open SQL array insert results in duplicate database records.
    The exception, which is assigned to class 'CX_SY_OPEN_SQL_DB', was not caught in procedure "CRM_SERVICE_OS_UPD_OST_DU" "(FUNCTION)", nor was it propagated by a RAISING clause.
    Please find my code which have used in the custom program
    Closing the resolved SOs in the system
              objnr                     = iv_guid
              user_status          = lc_status_closed
             object_not_found          = 1
             status_inconsistent       = 2
             status_not_allowed       = 3
             OTHERS                        = 4.
        IF sy-subrc <> 0.
          WRITE :  'Error at maintaining status'.
    Set reason code
    build lt_subject
        ls_subject-ref_guid = iv_guid.
        ls_subject-katalogart = 'A2'.
        ls_subject-codegruppe = 'ZR000003'.
        ls_subject-code       = 'ZR33'.                      " Reason code
        ls_subject-mode       = 'A'.
        APPEND ls_subject TO lt_subject.
    build lt_ossset
        ls_osset-ref_guid        = iv_guid.
        ls_osset-subject_profile = 'ZREASON03'.
        ls_osset-profile_type    = 'G'.
        ls_osset-subject         = lt_subject.
        APPEND ls_osset TO lt_osset.
    build lt_service_os
        ls_service_os-ref_guid  = iv_guid.
        ls_service_os-ref_kind  = 'A'.
        ls_service_os-osset     = lt_osset.
        APPEND ls_service_os TO lt_service_os.
    build lt_input_fields
        REFRESH: lt_input_fields, lt_field_names.
        CLEAR  : ls_input_fields, ls_field_names.
        ls_field_names-fieldname    = 'CODE'.
        APPEND ls_field_names TO lt_field_names.
        ls_field_names-fieldname    = 'CODEGRUPPE'.
        APPEND ls_field_names TO lt_field_names.
        ls_field_names-fieldname    = 'KATALOGART'.
        APPEND ls_field_names TO lt_field_names.
        ls_field_names-fieldname    = 'SERVICE_PROFILE'.
        APPEND ls_field_names TO lt_field_names.
        ls_input_fields-ref_guid    = iv_guid.
        ls_input_fields-ref_kind    = 'A'.
        ls_input_fields-objectname  = 'SERVICE_OS'.
        ls_input_fields-field_names = lt_field_names.
        APPEND ls_input_fields TO lt_input_fields.
            it_service_os     = lt_service_os
            ct_input_fields   = lt_input_fields
            error_occurred    = 1
            document_locked   = 2
            no_change_allowed = 3
            no_authority      = 4
            OTHERS            = 5.
        IF sy-subrc <> 0.
          WRITE :  'Error at maintaining reason'.
            it_objects_to_save   = lt_header_guid
            iv_update_task_local = lv_update_task_local
            et_saved_objects     = lt_saved_objects
            document_not_saved   = 1
            OTHERS               = 2.
        IF sy-subrc <> 0.
          WRITE : 'Error at saving'.
          WRITE : 'Successfully Closed'.
    Run time error is coming at COMMIT WORK AND WAIT statement.
    Please let me know any corrections are required in the above program.
    When I analyzed the run time error I have found that it trying to insert the record in CRMD_SRV_OSSET for that CRM order, but already one record is present in the table for the same CRM order number.
    For most of the CRM orders there is no entry in this table so they are closing successfully but for a few orders for which there is an entry we are getting the above run time error.
    There is nothing wrong with the orders which have an entry already in the table CRMD_SRV_OSSET, I need to close these kind of orders with out run time error.
    Kindly provide your feedback.

    Hi Dinakar,
    You posted this in APO PPDS forum. This question should go to PP forum where someone could answer it.
    Please close this thread and open a new thread in PP forum so that you could get help quickly from the relevant experts.
    Regards - Pawan

  • Error While saving the Production Order

    Dear Experts
    Pls let me know why am getting the below error while saving the production order after release..
    PSFC_STD_LAYOUT does not exist
    Message no. SSFCOMPOSER004

    Please check have you assigned the scheduling profile in work scheduling view of materail master?
    Then go to OPKP check the same scheduling profile where you have activited the On realese execute printing remove this tick mark and then try with new order.
    Or you can do the configuration in Tocde :OPK8 here assign the PSFC_STD_LAYOUT in forum.

  • Error while release of production order u201CNext period is not openu201D

    Hi Experts,
    Need your opinions on this issue where my client is facing a problem while create and release a production Order on the last day of the month (Last day of period change).
    While create and release of production order for Plant xxxx, system uses to give the error; period Next (e.g. 12) is not open. Same thing if I have created the order using T. code CO01; but when I tried to release and save the order through T. code CO02 then it gave me the same error (Next period is not Open), it checks for the next period to open.
    The above scenario happens only on last day of the month. Earlier this kind of error was not there so the question is why the period check is happening while saving the production order.
    After speaking to the user, it is determined that they are facing this problem since upgrade (Since last 8 month). Hence need to check what additional check has been implemented with upgrade from R/3 4.7 to ECC 6.
    Error Message No F5201
    Appreciate your help how to dig up this issue.
    With Regards

    Hi Guys,
    Please throw some light why on the last day of the month (Last day of period change) at the time of release the order user is getting error: Period Next (FI Next period) is not open ( message No. F5201).
    My question is why system carried out period checks at the time of release of Production Order.
    With Regards

  • Error while creating the sales order with billing reference

    hi alll
    i am getting error while creating the sales order with billing reference.The line items are coming in grey.I am not able to change the items as well as the quantity field.Can u guide me

    Dear SAP SD 007
    I can confidently tell that an enhancement or an user exit has been applied in your scenario
    You have to check that
    Normally when creating a sales order with respect or referring billing documents the qty will be in editable mode and it is standard problem
    Your people has solved the standard problem by enhancement
    Usually OR--LF-PGI----F2 (SAY THE QTY IS 25 UNITS)
    Now you are creating returns order with reference to F2 in the return order type Re there is a standard issue that user can edit the qty to 30 from the original 25
    To solve this only your people have used userexit
    Line items and qty greyed out means definately there is some enhancement or user exit applied
    You have to check that

  • Transacciu00F3n MFN1 - Error KA465: Production order with an actual activity up

    Hi Exerts,
    I am executing transaction MFN1 with "Update of Activity Consumption in the Quantity Structure" = 2 and the following error ocurrs: "KA465 Production order with an actual activity update.".
    I changed the customizing "Update of Activity Consumption in the Quantity Structure" to "Activity update not relevant to price determination", after this I exectuted transaction MFN1 again and the error didn't occur.
    I need to understand what is the impact of changing this customizing, and if I set the "Update of Activity Consumption..." equal 2, the activity actual values are revaluated in the CKM3N? If the answer is yes, in what point of the CKMLCP this value is revaluated?.

    please check CKM9 for the relevant plant how you define the Activity update. Please note KA465 is justified to avoid posting the credits and debits twice if the indicator is '2'.
    If you are using activity update '2', the differences between planned and actual activity prices are not distributed to the orders but via multilevel price determination directly to the materials.
    The system determines the actual prices by means of the multi-level price determination in the actual calculation.
    In the actual calculation, the system also already debits the materials and credits the cost centers or vice versa.
    In this case, the revaluation must not be executed because otherwise the system posts the debits and credits twice. In this case, the system ought to display error message KA465.
    Note 686588 explains under what circumstances error KA465 may be raised, that is, if you have activated Material Ledger/Actual Costing with Activity Consumption '2'. Please check your Material Ledger settings in relation to note 686588.
    If you use activity update '1' then revaluation is done via the orders and no longer via Material Ledger.

  • Production order with reference to sales order

    Hi experts,
    I have created one sales order.
    I am getting an error as "sales order has no CO object" while creating production order with reference to that sales order. Can anyone help me on this ?
    Thanks in advance.

    Dear singh,
    pls check this given by yadav
    T. Code: OKKP - Maintaining Controlloing Area
    Select your Controlling Area and Click: Activate components/control indicators (left-hand Dialog Structure)
    Here, Under Tab: Activate, check Boxes: Sales Order, Cost Objects, etc..
    Check whether Strategy Group is maintained in Material Master (MM02) --> View: MRP3.
    T. Code: VA02/ VA03 --> Tab: Procurement -> Column: RqTy
    There, Check whether requirement type is relevant for MTO.
    More information:
    Req. type: KE (if, Reqmts class: 040 Mke-to-ord.w/o cons. - possible to create Production order)
    Req. type: KEK (If, Reqmts class: 020)
    Req. type: KSV (used for Make to stock - Planning with Assembly Planning Strategy 40 is being used in the MRP3 view of the material)
    Also, Check other relevant settings in:
    SPRO --> IMG --> Sales & Distribution --> Basic Functions --> Availability Check and Transfer of Requirements --> Transfer of Requirements
    Best Regards,

  • Error in cost calculation for production order

    Dear All,
    I got error of cost calculation while release of Production Order due to price of some material is not mantain .
    What will happen if I release , save the Order with error & do Good Issue ???

    Dear Ishwar,
    Check the log's created for costing and rectify the same.
    I feel its better to rectify the cost related errors and then release the production order and proceed to Good's Issue.
    Check whether there is a MAP for all the Raw-materials and an origin group in costing 1 view.
    The Finished product must be having a standard cost estimate that's valid for the current period.
    Revert back in case of any more help needed.

  • Variance calculation for production order with settlement receiver as SDI

    I have one query reference to Variance calculation for production order with settlement receiver as SDI(Sales document item).
    I am working on Varaint configuration with strategy 25(Make-to-order for configurable material) with requirement class 046.
    I have created sales order ref. to configurable material,subsequently created planned order & then converted to production order.
    In production order settlement receiver is SDI(Sales document item).
    While doing production confirmation ,variance has been created.
    Now during variance calculation KKS2, I have got error message as no suitable settlement rule found for object Order no.
    Is there any way to come out of this?Or variance calculation KKS2 is not applicable with settlement receiver as SDI(Sales document item).
    Pl. guide

    In case of non valuated material, concept of variance does not apply...
    Variance is Actual Cost - Cost of Goods receipt posted in stock.. If the later value is zero, your entire actual cost is variance... That is one way of saying it
    But, in SAP, var not calculated in case of non valuated material and that makes sense as well.. Since you are in MTO scenario, it would make sense to analyse costs vs revenues @ sale order level as each SO will be unique in itself
    Ajay M

Maybe you are looking for

  • Substr function fails

    hi there, can anyone tell me why a simple substr would throw an error if the target varchar assignment isn't three characters larger than the length provided to the substr function? can anyone tell me why this: declare v_legal varchar2(200); v_disp_t

  • Why can not I call the Sysprep on the MDT Task sequence created ?

    Good afternoon gentlemen, Please help me ! I'm days trying to unravel this problem , any task that I create and call on the relevant equipment, is the right procedure for all steps and ends with the successfully completed task window, nothing happens

  • ALV buttons - Changed size

    Has anyone encountered that after upgrading to SAP Enterprise 6.2 and/or to SAP Gui (level 49), that user toolbar buttons in ALV grid have enlarged dramatically in size ? We have had this problem after our upgrade, but haven't found any information o

  • Lens Blur in After Effects

    In einem Tutorial auf Englisch wird der Effekt "Lens Blur" in After Effects verwendent. In AE CS4 hiess dieser Effekt auf Deutsch "Verwackeln". In der Version von CS5 finde ich den "Verwackeln" Effekt nicht mehr. Wie heisst der "Lens Blur" Effekt im

  • How to turn off the welcome screen in Illustrator.

    Can it be done? If so, how? Thanks