SAP Function CO_SE_PRODORD_CHANGE - Change Production Order: Header, Sequences, Operations, Prod. Res./Tools

Parameter Reference Type Length Default Optional Text
IS_HEADER COSE_S_HEADER u 172 X Production Order: Header and Item Changes
IT_HDR_USER_STATUS COSE_T_HDR_USER_STAT h 5 X Production Order: Change User Status of Header
IT_OPERATION COSE_T_OPERATION h 545 X Production Order: Create/Change/Delete Operations
IT_OPR_USER_STATUS COSE_T_OPR_USER_STAT h 19 X Production Order: Change User Status
IT_PRT COSE_T_PRT h 208 X Production Order: Create/Change/Delete Production Resource/Tool
IT_SEQUENCE COSE_T_SEQUENCE h 60 X Production Order: Create/Change/Delete Sequence
IV_COMMIT COSE_COMMIT C 1 X Indicator: Perform Commit Work
IV_ORDER_NUMBER AUFNR C 12 Order Number

Parameter Reference Type Length Text
ES_RETURN BAPIRET2 u 548 Return Parameter(s)

Functionality
You can use this function module to change data relating to a productionorder. In addition to changing certain header data of the order, you candelete, change, or add the following assigned objects: sequences,operations, production resources/tools.
The individual object changes are made in the following order:
Header data (parameter IS_HEADER)
Change
Sequences (parameter IT_SEQUENCE)
Delete
Create
Change
Operations or suboperations (parameter IT_OPERATION)
Delete
Create
Change
Assignment of production resources/tools (parameter IT_PRT)
Delete
Create
Change
Furthermore, you can set or reset user statuses for the order header andfor individual operations:

  • User status order header (parameter IT_HDR_USER_STATUS )

  • The user status is set immediately after the changing of the headerdata.
    • User status operations (parameter IT_OPR_USER_STATUS)

    • The user status is set immediately after the creation/changing of anoperation.

      Example
      For an existing order, you wish to add a further parallel sequence 5with three operations. A material is assigned to the first operation asa production resource/tool. As minimum scope, the transfer parametersIT_SEQUENCE, IT_OPERATION, and IT_PRT must include values of thefollowing type in this case:
      SEQUENCE,,RETURN_OPER
      5,,0020
      SEQUENCE,,OPERATION,,CONTROL_KEY
      5,,0010,,PP01
      5,,0020,,PP01
      5,,0030,,PP01
      SEQUENCE,,OPERATION,,PRT_CATEGORY,,MATERIAL
      5,,0010,,M,,TEST_PRT

      Notes
      Authorization checks

      • Authorization object C_AFKO_AWK with

      • Order type
        Plant
        • Authorization object C_AFKO_AWA with

        • Activity 02 (Change),
          Order category 10 (production order)
          Order type
          Plant
          Initialization of document tables
          At the start of the processing, the document tables of order processingand the document tables of status management are initialized. For thisreason, a COMMIT WORK should be set off prior to invocation of thisfunction module if other BAPIs have already been invoked or there arealready entries in the document tables of order processing and in thedocument tables of status management as a result of other actions.
          Update control
          If no error occurs, update is triggered at the end of the processing. Ifthe parameter IV_COMMIT has been set, a Commit Work is set off inthe process. If the Commit Work is placed outside the function module(Parameter IV_COMMIT initial), it should take place directlybecause data consistency is otherwise lost in the event of furtherprocessing of document tables.
          Error handling
          If an error occurs, processing is immediately terminated and thecorresponding message returned in the parameter ES_RETURN. Evenif some objects have been changed correctly, these changes are notadopted. In the event of an error, the document tables of orderprocessing and status management are initialized.
          If no error occurs, the parameter ES_RETURN is returned withinitial values.
          Coaction of parameters
          • You only need to populate parameters for those objects that are actually
          • to be changed. If, for example, you wish to create/change/deleteoperations for an existing sequence but the sequence itself is not to bechanged, populate the parameter IT_OPERATION only.
            • When deleting objects, take care that their dependent objects are
            • likewise deleted or (depending on the status) a deletion flag is set.If, for example you wish to delete a sequence, you should only populatethe parameter IT_SEQUENCE. The dependent operations and and productionresource/tool assignments to be deleted are deleted at the same time andmay not be additionally included in the parameter IT_OPERATION andIT_PRT.

              Description
              The parameter passes on information and message texts relating to errorsthat have occurred.

              Default
              If no error occurs, the parameter is returned with initial values.

              Description
              You can use this parameter to change the header of the production order.

              Notes

              • If you want to make header changes only, you can alternatively use
              • BAPI_PRODORD_CHANGE.

                Description
                You can use this parameter to set or reset the user status of the orderheader.

                Notes

                • Fields:

                • USERSTAT User Status
                  INACT Indicator: Set/Reset Status
                  initial:,,Status is set
                  'X':,,Status is reset
                  • A status schema cannot be assigned or changed. Relevant is the already
                  • assigned status schema. Alternatively, take the BAPIsBAPI_PRODORD_SETUSERSTATUS and BAPI_PRODORD_REVOKEUSERSTATUS intoaccount.
                    • If a status is to be set with a status number, it is sufficient to pass
                    • on the status to be set in the table. The already active status must notbe explicitly reset. This is done automatically by the system.
                      • In the case of statuses without a status number, both the status that is
                      • to be set and the status that is to be reset must be passed on in thetable.

                        Description
                        You can use this parameter to set or reset user statuses for operations.

                        Notes
                        Key fields

                        • PLNFL Sequence

                        • If no sequence is specified, the value is prepopulated with '000000'(standard sequence).
                          • VORNR Operation

                          • UVORN Suboperation

                          • If a status is to be set/reset for a suboperation, populate this field.Otherwise it remains initial.
                            Further fields
                            USERSTAT User status
                            INACT Indicator: Set/Reset Status
                            Initial:,,Status is set
                            'X':,,Status is reset
                            Restrictions
                            • A status schema cannot be assigned or changed. Relevant is the already
                            • assigned status schema. When an operation is created, a status schemafrom Customizing for the Production Order Type.
                              • If a status is to be set with a status number, it is sufficient to pass
                              • on the status to be set in the table. The already active status need notbe explicitly reset. This is done automatically by the system.
                                • In the case of statuses without a status number, both the statuses that
                                • are to be set and the statuses that are to be reset must be passed on inthe table.

                                  Default

                                  Description
                                  You can use this parameter to create, change, and delete sequences.
                                  Different changes are supported depending on thesequence category:
                                  ,,Create ,,Change,,Delete
                                  Standard sequence,,,,X,,
                                  Parallel sequence,,X,,X,,X
                                  Alternative sequence,,,,,,X

                                  Notes
                                  Key fields

                                  • SEQUENCE Sequence

                                  • Create/change/delete control criterion
                                    • If the deletion indicator DELETION_IND is set, the sequence is
                                    • deleted together with its dependent objects.
                                      Value range DELETION_IND:
                                      'X',,Delete sequence
                                      'Initial',,Create/change sequence
                                      • Difference between create/change: If the sequence already exists, it is
                                      • changed; otherwise a new parallel sequence is created.
                                        Further transfer fields for creation/changing of a sequence
                                        • RETURN_OPER Return operation

                                        • The field is only relevant to parallel sequences. This is a mandatoryfield for new sequences that are to be created.
                                          • BRANCH_OPER Branch operation

                                          • The field is only relevant to parallel sequences.
                                            • TEXT Short text for sequence

                                            • ALIGN Alignment key for scheduling

                                            • Value range:
                                              '1',,Earliest alignment
                                              '2',,Latest alignment
                                              If you do not pass on the field for new sequences to be created, thevalue is prepopulated with '1' (earliest alignment).
                                              Indicator change relevance when sequences are changed
                                              • For some fields there are fields with the same name with an appended
                                              • '_X'. These fields are relevant when sequences are changed. Only if youset this indicator = 'X' is the associated data field taken into accountas change-relevant. This makes it possible to explicitly set fields toinitial.
                                                When sequences are created, these fields are meaningless. Data fieldsthat are not initial are taken into account automatically.

                                                Description
                                                Indicator for execution of the Commit Work instruction.

                                                Value range

                                                • IV_COMMIT

                                                • 'X':,,Commit Work is executed
                                                  initial:,,No Commit Work

                                                  Default

                                                  • IV_COMMIT = 'X'
                                                  • Description
                                                    The parameter contains the order number for unique identification of aproduction order.