Pl correct SP code for production order

hi all,
To block production order from being closed
when completed qty < planned qty/all child items are not issued to production using Stored procedure ?
Kindly correct below SP Code.
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
ALTER proc [dbo].[SBO_SP_TransactionNotification]
@object_type nvarchar(25),                     -- SBO Object Type
@transaction_type nchar(1),     -- [A]dd, <u>pdate, [D]elete, [C]ancel, C[L]ose
@num_of_cols_in_key int,
@list_of_key_cols_tab_del nvarchar(255)= Status,
@list_of_cols_val_tab_del nvarchar(255)
AS
begin
-- Return values
declare @error  int                    -- Result (0 for no error)
declare @error_message nvarchar (200) -- Error string to be displayed
select @error = 0
select @error_message = N'Ok'
IF (@object_type = '202' AND @transaction_type= 'U' AND @list_of_key_cols_tab_del = u2018Lu2019)
BEGIN
IF EXISTS (SELECT DocNum FROM [dbo].[OWOR] WHERE (Compltqty < Plannedqty )
BEGIN
SELECT @error =1, @error_message = 'Production Order canu2019t be Closed,It is Incomplete / Send remaining Qty to Rejectedu2019
END
END
select @error, @error_message
END
Thanks
Jeyakanthan

Closing this thread.

Similar Messages

  • Specific process code for Production order message type LOIPRO

    Hello,
    Is there any specific process code for Production order message type LOIPRO.
    Request you to reply.
    Thanks
    Prashanth

    Hi Prashanth,
    sorry for last thread ... that not contain full information ...
    For message type LOIPRO you can use process code APLI.
    In IDOC PARTNER definition, the partner is linked with an IDOC TYPE and PROCESS CODE for inbound processing. This process code is in turn linked with a FUNCTION MODULE to process the IDoc such as IDOC_INPUT_INVOIC_MRM (Reff..  http://searchsap.techtarget.com/expert/KnowledgebaseAnswer/0,289625,sid21_cid519558,00.html)
    Regards,
    Amit

  • Bapi or FM or tabel or any standard transaction code for Production order linking to get child production orders based on parent production order

    Dear Guru's,
    we have a requirement i.e. user can convert planned orders in to production orders (CO41) based on those production orders we can get Route card( Z Smart form)  presently we are using manual input for that Route card. recently we got requirement for this i.e. make to automatic generation of route card for this requirement we need to get the list of child's production orders based on parent production order
    so as per my requirement i need to get all child part numbers production orders based on parent production order number and quantity i tried in MD4C and CO46 but those transactions codes are picking multiple lines also so for this requirement please give your valuable suggestions
    Regards,
    Venkat 

    Dear Friends,
    Thanks for your reply,
    My business process is MTS purely strategy 10, for route card all components with production orders we can give input as like bellow these production orders are converted from planned orders,between few components are don't have production orders those are F-30 materials,because of this reason i need link for production order to child components orders
    01
    IND1
    IND1
    A1CE2003520103-005
    55685815
    02
    IND1
    IND1
    A1CE2003520103-010
    55685814
    03
    IND1
    IND1
    A1CE2003520103-015
    55685813
    04
    IND1
    IND1
    A1CE2003520103-020
    55685812
    05
    IND1
    IND1
    A1CE2003520103-025
    55685811
    06
    IND1
    IND1
    A1CE2003520103-030
    07
    IND1
    IND1
    A1CE2003520103-035
    55685810

  • Finding T-code for production order

    Dear All
    I am having 1000 production order. Now i want to find out the T-code with which these orders are created. Please guide
    Regards
    Amit Parkhi

    Hi,
    Please check with Table AFPO & planned order ,sale order number
    Copy the Production order Numbers  to AFPO table Using multiple option.
    if it would have created from C001 = Planned Order field is Blank
    from Md04 =  u can see the planned order
    from C007 =  u can see the sale order/WBS element Number.
    Hope this solve your problem. if yes reward and close the Thread.
    Pradeep

  • Error during goods receipt of Finished goods for production order

    hi friends
    pls help me iam struggle this issue and mentioned the issue .
    when i do goods receipt for production order system getting error like
    No price could be determined for material/batch FG/ plant ZTP
         Message no. CK 465
    Diagnosis
         The system could not calculate a price for material/batch FG/ in plant
         ZTP for valuation view 0, because none of the valuation strategies in
         valuation variant 007 was successful.
    System Response
         User-defined error management enables you to specify whether the message
         is an error message, a warning message or an information message.
         o   If you have defined the message as a warning message or an
             information message, the costing item will be entered in the cost
             estimate with a value of zero.
    If you have defined the message as an error message, the cost
    estimate contains an error or errors.
    -   In the case of a material cost estimate, the system sets the
        status KF.
    -   If it is a cost estimate without quantity structure, or base
        object cost estimate (that is, a unit cost estimate),  the
        system cannot proceed with costing until you have corrected the
        errors.
    If the system issues a termination message, the cost estimate cannot
    be processed, and processing is terminated.
    procedure
        o   Check the master data for material/batch FG/ in plant ZTP.
        o   If you have authorization for Customizing, check the valuation
            strategy for materials in valuation variant 007.
        Note
        If the message is a warning message or an information message, there is
        a danger that materials with errors will be ignored by the system.
        If, because of this, you issue a warning message and at the same time
        include materials with a zero value in cost estimates, you can make the
        following settings for these materials in the costing view of the
        material master:
      1.  Enter a very low price in the planned price 1, 2 or 3 fields
          manually, for instance 0.01 USD. These prices are used for costing
          purposes only; they are not read by other applications.
      2.  Enter the highest price unit possible, for example 10000.
          Note: If you enter a new price unit that is higher than the costing
          lot size, the system increases the costing lot size accordingly.
      3.  Change the valuation strategy, such as strategy 4, where you could
          enter the planned price field in which you entered the low price.
          The system now costs as follows:
          Using the valuation strategy, the system finds planned price 1, 2 or
          3. Due to the low price and high price unit, the system rounds the
          value to zero. However, the cost estimate still obtains status KA
          (free of errors), and no error message is issued.
          This procedure can be used for all materials that have caused error
          message CK465 to be issued.
    with regards
    dinesh
    Edited by: code acess on Nov 8, 2010 4:06 AM

    hi ragavendra,
    this is dinesh .i maintained the costing view and planned price. but again i have same error.so please reply me where i missed the data
    with regards
    dinesh
    Edited by: code acess on Nov 9, 2010 4:01 AM

  • Error while doing Good Issue for Production Order using BAPI

    Hi All,
    I am facing an error like 'u2018Content of order 1011907: MDT218AJ10 transferred to interface (IMSEG): T-86410-71".
    I have written the code as below. Please let me know what is missing when using the BAPI 'BAPI_GOODSMVT_CREATE'. What is the cause of this error ?
    *Action in Transaction (GM_CODE)
    *GM Code for Goods Issue for Production Order is 03
      gs_gmcode-gm_code = '03'.
    *Header Data
    *Posting date
      gs_header-pstng_date = sy-datum.
    *Document date
      gs_header-doc_date   = sy-datum.
    *Item Data
    *Material
      gs_item-material  = zptp_s_rf_migo_261-matnr1.
    *Movement Type
      gs_item-move_type = '261'.
    *Movement Indicator
      gs_item-mvt_ind   = 'F'.
    *Stock Type
      gs_item-stck_type = 'F'.
    *Plant
      gs_item-plant     = gv_plant.
    *Storage Location
      gs_item-stge_loc  = gv_str_loc.
    *Quantity
      gs_item-entry_qnt = zptp_s_rf_migo_261-menge2.
    *Unit
      gs_item-entry_uom = gv_uom.
    *ISO code for unit of measurement
      gs_item-entry_uom_iso = gv_uom.
    *Order Number
      CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
        EXPORTING
          input  = zptp_s_rf_migo_261-aufnr
        IMPORTING
          output = gs_item-orderid.
    *Reservation Number
      gs_item-reserv_no = gv_resv_num.
    *Reservation Item
      gs_item-res_item = gv_resv_itm.
    *Reservation Type
      gs_item-res_type = gv_resv_type.
      APPEND gs_item TO gt_item.
    Calling BAPI_GOODSMVT_CREATE to create the Material Document Number
      CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
        EXPORTING
          goodsmvt_header       = gs_header
          goodsmvt_code         = gs_gmcode
        IMPORTING
          goodsmvt_headret      = gs_headret
        TABLES
          goodsmvt_item         = gt_item
          goodsmvt_serialnumber = gt_serial
          return                = gt_return.
    Thanks in Advance.

    hi,
    did you look at message ?
    System says, there are differences between the interface data and the order data. It can be anything. I think you should check
    data in the interface . 
    this is the long explanation of your message :
    Diagnosis
    When calling the function module MB_CREATE_GOODS_MOVEMENT or the BAPI GoodsMovement.CreateFromData (BAPI_GOODSMVT_CREATE) to post a goods receipt for a production order, there are differences between the interface data and the order data.
    Example: The order was created for plant 0001, but plant 0002 is passed on in the interface.
    The system checks this for the material and the order item.
    System response
    Due to this difference, the system cannot post the goods receipt.
    Procedure
    Check the data in the interface (IMSEG-WERKS, IMSEG-AUFNR). If necessary, correct the plant or the order number in the interface.
    << Moderator message - Point begging removed >>
    Edited by: Rob Burbank on Feb 6, 2012 11:24 AM

  • Authorization check for production order settlement

    Hi All,
    Production order settlement currently can be done by any user of any company code. there is a high risk involved in the same since unauthorized postings may happen. Hence we need to add authorization check for production order settlement. Can we maintain the same at the plant or the company code level?
    Waiting for your replies. Thanks in advance!
    Regards,
    Aman Goel

    hi
    What venki has told abt the exit, its absolutely correct.Even i have used the same exit
    •     From table CAUFV pick Material(PLNBEZ),Basic Start Date(GLTRP),Plant(WERKS) .
    •     Pass parameter Material(PLNBEZ) and Plant(Werks) in table MBEW in respective fields i.e. Material(MATNR) and Plant(WERKS).
    •     Pick the latest record for the current period(LFMON) and year(LFGJA).
    •     Pick Product Cost Estimate number(KALN1) from the record and pass it to table KEKO.
    •     Check if Production Order Basic Start Date(GLTRP)<= BIDAT, if NO post Error Message.
    This is the FS for EXit PPco0007
    Reward if useful
    Amit

  • Report to check open reservations for production orders where GI not posted

    Hi experts,
    Can we get reservation details from any report/ table for production order where material has not been issued, report should also display the value of the reserved material.
    I could not find desired details in RESB (it has price but not value) and MB25.
    Thanks in advance, useful ansers will be rewarded.
    Thnx
    Anand

    Hello Anand,
    there is no report but you may use the production order info system with list "components" and create a layout contaning the issued quantity and/or the final issue indicator. With a correct sorting, the list should show all orders with non-issued components at the top.
    Regards, Andreas

  • Early Inspection for a Goods Receipt for production order

    Dear Experts,
    This  is with respect  Early Inspection for a Goods Receipt for inspction type 04.( 03 is also active in material master)
    We made partial confirmation  250 qty for production order using t code co11n ( total qty of production order is 1000).
    made the usage decision with an acceptance and posted all open stocks. to unrestricted.
    Now  in second partial confirmation prodn order  of 250 qty was made . This suppose to be rejected .  but sytem will add this 250 qty directly to unrestricted stock .  how to over come this .
    Regards
    Sandeep

    Don't make the UD until all stock has been receipted?
    You basically approved the batch.  So why wouldn't the system put the stock to unrestricted?
    Why would you make a UD when you still have stock to be posted anyway?  You can post stock without without making a UD so why not just post some if you need it, and wait on making the UD?
    Craig

  • How to use the selection profile and status profile for production order?

    Hi expert,
       I want to know how to use the selection profile and status profile for production order. what's the usage for these two selection profile and status profile ?
      Please help me.
      thanks in advance.
      george.shi

    Hi George,
    There are are two types of statuses.One is system status and second one is user status.These statuses will tell us current situation of an order.
    We can't change system statuses.But we can create our own statuses through status profile.With this profile we can control user statuses.
    In this status profile,
    1.We define the sequence in which user statuses can be activated,
    2.We define initial statuses
    3. Allow or prohibit certain business transactions.
    Selection profiles are used to select the objects (say production orders) with different status combinations.We assign status profiles to selection profiles in BS42 T-Code.
    Regards,
    Raja.
    Edited by: Rajarao on Oct 30, 2008 6:21 AM
    Edited by: Rajarao on Oct 30, 2008 6:22 AM

  • BAPI_GOODSMVT_CREATE for production order,not update database

    hi guru,
    i am using BAPI_GOODSMVT_CREATE for production order.When i m testing this BAPI
    at se37 it creates one mat doc no and i m not getting any return messages.Now i m
    writing code for it at se38. but it does not update the database even though i used
    bapi_transaction_commit. here sy-subrc = 0.bt when i m checking MSEG table showing
    that mat doc no does not exists.
    please help me out  asap.
    thanks and regurds,
    manasi

    CHECK THIS CODE
    REPORT ZBAPI_GOODSMVT_CREATE.
    *DECLARING INTERNAL TABLE TO HOLD FILE DATA.
    DATA: BEGIN OF itab OCCURS 0,
              text(200),
          END OF itab.
    *DECLARING INTERNAL TABLE TO PASS FILE DATA.
    TYPES: BEGIN OF tw_goodsmvt,
                pstng_date TYPE budat,
                doc_date TYPE bldat,
                material TYPE matnr,
                plant TYPE werks_d,
                stge_loc TYPE lgort_d,
                move_type TYPE bwart,
    *            entry_qnt TYPE erfmg,
                costcenter TYPE kostl,
            END OF tw_goodsmvt,
            tt_goodsmvt TYPE STANDARD TABLE OF tw_goodsmvt.
    DATA: lt_goodsmvt TYPE tt_goodsmvt,
          lw_goodsmvt TYPE tw_goodsmvt.
    *declaring internal table of bapi structure.
    DATA:s_goodsmvt_header LIKE  bapi2017_gm_head_01,
         lt_goodsmvt_item TYPE STANDARD TABLE OF bapi2017_gm_item_create WITH HEADER LINE,
         lt_return TYPE STANDARD TABLE OF bapiret2 WITH HEADER LINE.
    DATA:str_filename TYPE string,
         gm_code TYPE gm_code,
          v_head_count TYPE i VALUE 0,
          v_prev_count TYPE i VALUE 1,
          v_qnt TYPE string,
          v_dummy.
    *selection screen
    SELECTION-SCREEN BEGIN OF BLOCK bk with frame title text_001.
    PARAMETERS:p_docdat TYPE bldat,
               p_pstdat TYPE budat,
               fname LIKE rlgrap-filename.
    SELECTION-SCREEN END OF BLOCK bk.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR fname.
    *to provide F4 functionality.
      CALL FUNCTION 'F4_FILENAME'
        EXPORTING
          program_name = syst-cprog
        IMPORTING
          file_name    = fname.
    * start of selection
    START-OF-SELECTION.
      str_filename = fname.
      gm_code = '06'.
    * to upload data
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          filename            = str_filename
          filetype            = 'ASC'
          has_field_separator = 'X'
          read_by_line        = 'X'
        TABLES
          data_tab            = itab.
    *SPLITING DATA TO INTERNAL TABLES.
      LOOP AT itab.
        IF itab+0(1) EQ 'H'.
          v_head_count =  v_head_count + 1.
          IF v_head_count GT v_prev_count.
            PERFORM bapi_upload.
          ENDIF.
          SPLIT itab-text AT ',' INTO v_dummy
                                      lw_goodsmvt-pstng_date
                                      lw_goodsmvt-doc_date.
          s_goodsmvt_header-doc_date   = lw_goodsmvt-doc_date.
          s_goodsmvt_header-pstng_date = lw_goodsmvt-pstng_date.
          v_prev_count = v_head_count.
      ELSEIF itab+0(1) EQ 'L'.
        SPLIT itab-text AT ',' INTO v_dummy
                                    lw_goodsmvt-material
                                    lw_goodsmvt-plant
                                    lw_goodsmvt-stge_loc
                                    lw_goodsmvt-move_type
                                    v_qnt
                                    lw_goodsmvt-costcenter.
    * PASSING DATA TO INTERNAL TABLE TYPE BAPI STRUCTURE.
        lt_goodsmvt_item-material = lw_goodsmvt-material.
        lt_goodsmvt_item-plant    = lw_goodsmvt-plant.
        lt_goodsmvt_item-stge_loc = lw_goodsmvt-stge_loc.
        lt_goodsmvt_item-move_type = lw_goodsmvt-move_type.
        lt_goodsmvt_item-entry_qnt = v_qnt.
        lt_goodsmvt_item-costcenter = lw_goodsmvt-costcenter.
        APPEND lt_goodsmvt_item.
      ENDIF.
      v_prev_count = v_head_count.
      ENDLOOP.
      PERFORM bapi_upload.
    *&      Form  bapi_upload
    form bapi_upload .
    CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
      EXPORTING
        goodsmvt_header             = s_goodsmvt_header
        goodsmvt_code               = gm_code
    *   TESTRUN                     = ' '
    * IMPORTING
    *   GOODSMVT_HEADRET            =
    *   MATERIALDOCUMENT            =
    *   MATDOCUMENTYEAR             =
      tables
        goodsmvt_item               = lt_goodsmvt_item
    *   GOODSMVT_SERIALNUMBER       =
        return                      = lt_return.
            PERFORM commit_work TABLES lt_return.
            CLEAR : lw_goodsmvt, s_goodsmvt_header.
            REFRESH: lt_goodsmvt[], lt_goodsmvt_item[].
    endform.                    " bapi_upload
    *&      Form  commit_work
    *       text
    *      -->P_LT_RETURN  text
    form commit_work  tables   p_lt_return structure bapiret2.
      IF NOT lt_return[] IS INITIAL.
    *error handling
    loop at lt_return.
    CALL FUNCTION 'FORMAT_MESSAGE'
    EXPORTING
       ID              = lt_return-id
       LANG            = sy-langu
       NO              = lt_return-NUMBER
       V1              = lt_return-message_v1
       V2              = lt_return-message_v2
       V3              = lt_return-message_v3
       V4              = lt_return-message_v4
    IMPORTING
       MSG             = lt_return-MESSAGE
    EXCEPTIONS
       NOT_FOUND       = 1
       OTHERS          = 2.
    WRITE: lt_return-id, lt_return-message, lt_return-message_v1, lt_return-message_v2,
                 lt_return-message_v3, lt_return-message_v4.
          CLEAR lt_return.
        ENDLOOP.
      ELSE.
    * commit work
      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    *   EXPORTING
    *     WAIT          =
       IMPORTING
         RETURN        = lt_return.
    WRITE: lt_return-id, lt_return-message, lt_return-message_v1, lt_return-message_v2,
                 lt_return-message_v3, lt_return-message_v4.
          CLEAR lt_return.
    endif.
    endform.                    " commit_work

  • Batch derivation in goods receipt for production order

    Hi all,
    i have set up batch derivation for the event 'goods receipt for production order'. The field derived is HSDAT (date of manufacture) /minimum. Although in the batch derivation monitor I can see tha the derivation was performed OK and the correct date (oldest of the components) is selected the field in the Batch is not updated. Can anyone help??

    Hi Vagia,
    Your problem sounds like derivation type issue.
    Please check your derivation type to be static for the 400 event.
    Let us know if this helped.
    Regards.
    St.Pan.

  • Transaction similar to MDVP, for Production Orders

    Hello.
    I have used transaction MDVP to perform a collective availability check on Planned Orders. Do you know of a similar one that gives me the same information on Production Orders?
    I have used CO24 to get a report of Missing parts, but I feel that MDVP shows information in a better way, so I'm looking for the equivalent of MDVP for Production Orders.
    Thank you!

    Hi,
    Use  code COHV
    Vishal

  • Production Order   : OUTPUT Type Configuration for Production Order  as EDI

    Dear SDN All ,
      OUTPUT Type Configuration for Production Order.
    <b>Doubt in third Point</b>
    We have found the IDoc " LOIPRO01 " for Production Order
    (Please confirm that this IDoc can be used for outbound IDoc for Production Order)
    And foloowing
    <b>1. Defining the Output Type for Particular Application.
       T-Code: “NACE”</b>
      A. Output type have created upder application "ME" description : "Inventory Management"
      B.  " ZEDI "  created for getting output as EDI type
         ZEDI is copied from "WF01" output type. and
         Transmision mediam as "EDI"          
         Program : RSNASTED
         Form Routine :  EDI_PROCESSING
              (Please confirm is this for IDoc creation)
    <b>2. Partner profile creation:</b>
      A. Partner profile created under logical system and
      B. and In outbound parameter declared as "LOIPRO"(This is for sending the IDoc "LOIPRO01" to XI system).
    <b>3. Customization for output type for Proction Order -- (For CO02,CO08)</b>   ---
       A. But only one functional customization is remaining to do, for getting the IDoc while saving the Production Order in T-Code "CO02" and "CO08"
            <i>For Example:
                in sales order transaction va02 (in DBI 450 client) and select any Sales order.
                & select following menu path.
                 Extras --- > Output -
    > Header -
    > output
               Here we can set our output type "that U defined in NACE Transaction-Code"</i>
    <b> Like the same way I want to set output type  for CO02, CO08 transaction.</b>
    But I couldn't find the menu Item in Co02 and Co08 for setting the output.(like VA03)
    Please help me out for setting the output type for Production Order Creation.
    Thanks in advance,
    Dhanabal T
    Message was edited by: Dhanabal T

    Hello.
    I have a similar requirement. Did you guys find the solution?

  • Error while calculating variances for production order

    Hi Gurus,
    while calculating variances for production order i am getting the following error
    "Cannot calculate scrap variances" ( Error message)
    " no standard value estimate for material" (Warning message"
    A standard cost estimate exists for the material at the date mentioned in the error in released status.
    Please give solution for the error.
    Thanks in advance n Regards
    Arul.

    Is there an <b>itemization</b>, generated for the cost estimate used to calculate the target costs?
    Does the material components listed in the BOM of the cost estimate used to calculate the target costs, <b>assigned to the operations</b> in which they are used. Otherwise it is not possible to correctly report the variances and scrap when operations are confirmed.
    Does the order for which the variances are calculated have a valid <b>variance key.</b> ?
    Does the order have the status DLV (delivered) or TECO (technically completed). If the status was withdrawn, any variances and <b>scrap variances are canceled</b>.

Maybe you are looking for

  • Report to list manual changes to conditions in sales orders and invoices

    Hi experts, Is there a Standard Report to list the manual changes of pricing conditions in sales orders and invoices? Should be a selection on the field KONV-KMPRS. Please advice. Rgds, Pri

  • Scanjet G4050 and driver 1.3.0 + Mac OSX 10.9.4

    I recently returned to the combination Vuescan/Scanjet G4050 for the first ime since March this year (after scanning several thousand negs) and found it no longer worked properly. Vuescan no longer recognised the transparancy capabilities of the scan

  • Why does PS CS5 (12.0.4) write to original file when I 'save as copy'?

    Here's the scoop: I open a PS file. I chose 'Save As' but uncheck 'Show Layers' in the dialog box. So now it's essentially a 'Save A Copy'. When the new file is saved the original file is written to (although nothing changed) and now has the same mod

  • My web start app doesn't get cached

    Many apologies if this topic has been covered before but I have extensively searched the archive and can't seem to find it. I have made my own trivial web start app and it downloads and works fine with my installed web start software. The problem I h

  • Bug on search function in this forum

    When i try to use the search function on this forum, i get the blank page with this message : The page caused an ESI processing exception Regards Pascal