ABAP development for production planning

  • PP-DEV & EWB Do it yourself


PP-DEV & EWB Do it yourself

As of Release 4.6B, the Engineering Workbench (EWB) is available for the task list and BOM processing. The EWB is based on an API (Application Programming Interface) which provides good service functions for the task list and BOM processing. Many problems in the area of the automation of processing steps or mass processing which cannot be solved with SAP standard programs can be solved based on the EWB-API with the help of customer-specific programs.

Overview of the function groups

  1. Object/class            Abbreviation Table    Function group
  2. Task list header          TSK        PLKO      CPCL_TSK
  3. Sequence                  SEQ        PLFL      CPCL_SEQ
  4. Operation                OPR         PLPO/PLAS CPCL
  5. Material-BOM assignment   MBM         MAST      CSCL_BOM
  6. BOM header                BOM        STKO      CSCL_BOM
  7. BOM item                  ITM        STPO/STAS CSCL
  8. Production resource/tool  PRT        PLFH      CFCL
  9. Inspection characteristic CHA         PLMK/PLMW CQCL
  10. Component assignment      COM        PLMZ      CMCL
  11. Matl-task list allocation MTK        MAPL      CZCL
  12. Class-independent methods                      CPCC

Only use the public methods from these function groups. These modules have an _S_ in the function module name (S=service function).

Typical structure of a program

1. Loading of existing BOMs/task lists into the EWB buffer using the function modules (for an explanation of the focus concept, see the online help for the EWB):
CP_CC_S_LOAD_COMPLEX_BY_BOM (BOM header focus)
CP_CC_S_LOAD_COMPLEX_BY_ITM (BOM item focus)
CP_CC_S_LOAD_COMPLEX_BY_TSK (Task list header focus)
CP_CC_S_LOAD_COMPLEX_BY_OPR (Operation focus).
           If you only want to create new objects, you can also initialize the EWB- API using function module CP_CC_S_SESSION_DATA_UPDATE.

2. Changing/creating/deleting/copying objects using the corresponding function modules:
CP_CL_S_OPR_CREATE    Creation
CP_CL_S_OPR_CHANGE    Change
CP_CL_S_OPR_COPY      Copying
CP_CC_S_DELETE_BY_OPR Deletion.
                    During the change, the corresponding objects must be locked first. This is carried out via RELOAD modules. For operations, for example, this is function module CP_CC_S_RELOAD_BY_OPR. As an alternative, you can also lock the objects during loading immediately. To achieve this, transfer a work area (I_WORK_AREA) which provides automatic locking to the LOAD_COMPLEX function modules modules .

3. Update of the changed data via CP_CC_S_SAVE

Scenarios

Delete component in the production order 

  1. Lock a production order
  2. CALL FUNCTION 'CO_XT_COMPONENT_FIND'
  3. CALL FUNCTION 'CO_XT_COMPONENTS_DELETE'
  4. CALL FUNCTION 'CO_XT_ORDER_PREPARE_COMMIT'
  5. CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
  6. CALL FUNCTION 'CO_XT_ORDER_INITIALIZE'.
  7. Unlock the production order

Change the component in the production order

  1. Lock production order
  2. CALL FUNCTION 'CO_XT_COMPONENT_FIND'
  3. CALL FUNCTION 'CO_XT_COMPONENT_CHANGE'
  4. CALL FUNCTION 'CO_XT_ORDER_PREPARE_COMMIT'
  5. CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
  6. CALL FUNCTION 'CO_XT_ORDER_INITIALIZE'.
  7. Unlock the production order

Add a new component for the production order 

  1. Lock production order
  2. CALL FUNCTION 'CO_XT_COMPONENT_FIND'
  3. CALL FUNCTION 'CO_XT_COMPONENT_ADD'
  4. CALL FUNCTION 'CO_XT_ORDER_PREPARE_COMMIT'
  5. CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
  6. CALL FUNCTION 'CO_XT_ORDER_INITIALIZE'.
  7. Unlock the production order

Delete the new component in the service order 

 INSERT VALUE #( refnumber = '000001' objecttype = 'COMPONENT' method = 'DELETE' objectkey = <ls_component>-order_number ) INTO TABLE lt_methods.
      INSERT VALUE #( method = 'SAVE' objectkey = <ls_component>-order_number ) INTO TABLE lt_methods.
      INSERT VALUE #( reserv_no = <ls_component>-reservation_number
                      res_item = <ls_component>-reservation_item
                      res_type = <ls_component>-reservation_type
                      activity = <ls_component>-activity
                      ) INTO TABLE lt_component.
 CALL FUNCTION 'BAPI_ALM_ORDER_MAINTAIN'

Change the new component in the service order 

INSERT VALUE #( refnumber = '000001' objecttype = 'COMPONENT' method = 'CHANGE' objectkey = <ls_component>-order_number ) INTO TABLE lt_methods.
INSERT VALUE #( method = 'SAVE' objectkey = <ls_component>-order_number ) INTO TABLE lt_methods.

CALL FUNCTION 'BAPI_ALM_ORDER_MAINTAIN'

Add a new component in the service order 

INSERT VALUE #( refnumber = '000001' objecttype = 'COMPONENT' method = 'CREATE' objectkey = <ls_component>-order_number ) INTO TABLE lt_methods.
INSERT VALUE #( method = 'SAVE' objectkey = <ls_component>-order_number ) INTO TABLE lt_methods.

CALL FUNCTION 'BAPI_ALM_ORDER_MAINTAIN'

Create routing 

The BAPI BAPI_ROUTING_CREATE is only used to create routings.

SAP notes

  • 488765 - Do-it-yourself EWB programming

List of BAPI-s

Routing

BAPI_ROUTING_CREATE Creation of a routing
BAPI_ROUTING_EXISTENCE_CHECK Check existence of object

Reference operation set

BAPI_REFSETOFOPERATIONS_CREATE Creation of a reference operation set
BAPI_REFSETOFOPR_EXISTENCE_CHK Check existence of reference operation set

Planned order

BAPI_PLANNEDORDER_CHANGE Change Planned Order
BAPI_PLANNEDORDER_CREATE Create Planned Order
BAPI_PLANNEDORDER_DELETE Delete Planned Order
BAPI_PLANNEDORDER_EXIST_CHECK Check Existence of Object
BAPI_PLANNEDORDER_GET_DETAIL Get Details for Planned Order
BAPI_PLANNEDORDER_GET_DET_LIST Get Detailed List

Planned Independent Requirement

BAPI_REQUIREMENTS_CHANGE Change Planned Independent Requirement
BAPI_REQUIREMENTS_CREATE Create Planned Independent Requirement
BAPI_REQUIREMENTS_GETDETAIL Display detail of P.I.R

Production order

BAPI_PRODORD_WM_MAT_STAGING WM Material Staging
BAPI_PRODORD_SETUSERSTATUS Set User Status
BAPI_PRODORD_SET_DEL_INDICATOR Set Deletion Indicator
BAPI_PRODORD_SET_DELETION_FLAG Set Deletion Indicator
BAPI_PRODORD_SCHEDULE Carry Out Scheduling
BAPI_PRODORD_REVOKEUSERSTATUS Cancel User Status
BAPI_PRODORD_RELEASE Release
BAPI_PRODORD_GET_LIST List of Order Headers
BAPI_PRODORD_GET_DETAIL Order Detail Data
BAPI_PRODORD_EXIST_CHECK Existence Check
BAPI_PRODORD_CREATE_FROM_REF Create with Template
BAPI_PRODORD_CREATE_FROM_PLORD Create with Planned Order
BAPI_PRODORD_CREATE_CAP_REQ Generate Capacity Requirement
BAPI_PRODORD_CREATE Create Production Order
BAPI_PRODORD_COSTING Create Cost Estimate
BAPI_PRODORD_COMPLETE_TECH Complete Technically
BAPI_PRODORD_CLOSE Close Order
BAPI_PRODORD_CHECK_MAT_AVAIL Check Material Availability
BAPI_PRODORD_CHANGE Change Production Order

Production order confirmation

BAPI_PRODORDCONF_GET_TT_PROP Propose data for time ticket confirmation
BAPI_PRODORDCONF_GET_TE_PROP Propose data for time event confirmation
BAPI_PRODORDCONF_GETLIST Confirmation lists
BAPI_PRODORDCONF_GETDETAIL Detailed data for production order confirmation
BAPI_PRODORDCONF_GET_HDR_PROP Propose data for order confirmation
BAPI_PRODORDCONF_EXIST_CHK Check existence of object
BAPI_PRODORDCONF_CREATE_TT Enter time ticket confirmation
BAPI_PRODORDCONF_CREATE_TE Enter time ticket confirmation
BAPI_PRODORDCONF_PDC_UPLOAD_TT Transfer time ticket confirmations from PDC system
BAPI_PRODORDCONF_PDC_UPLOAD_TE Transfer time ticket confirmations from PDC system
BAPI_PRODORDCONF_CREATE_HDR Enter order confirmations
BAPI_PRODORDCONF_CREATE_ACT Enter activity confirmation
BAPI_PRODORDCONF_CANCEL Cancel production order confirmation

BDC Download & Upload for production order

BAPI_RCVPRORDCF_RECEIVEPRODORD PP-PDC: Download production orders
BAPI_RCVPRORDCF_RECEIVEWORKC PP-PDC: Download work centers
BAPI_RCVPRODCF_REQUEST_CONF PP-PDC: Upload request

KANBAN

BAPI_KANBAN_CHANGE Change Kanban Data
BAPI_KANBAN_CHANGESTATUS Change status of a kanban
BAPI_KANBAN_CHANGESTATUS1 Change status of a kanban
BAPI_KANBAN_GETLIST Determination of Kanbans Matching Selection Criteria
BAPI_KANBAN_GETLIST_ALL Determination of Kanbans Matching Selection Criteria
BAPI_KANBAN_GETLISTFORSUPPLIE1 Determination of Kanbans Matching Selection Criteria
BAPI_KANBAN_GETLISTFORSUPPLIER Provide Kanban data for vendors
BAPI_KANBAN_SETINPROCESS Provide Kanban data for vendors

KANBAN CONTROL CYCLE

BAPI_KANBANCC_ADDEVENTDRKANBAN Create Event-Driven KANBAN for Control Cycle
BAPI_KANBANCC_CHANGE Change Control Cycle
BAPI_KANBANCC_CREATE Create Control Cycle
BAPI_KANBANCC_DELETE Delete Control Cycles
BAPI_KANBANCC_EXISTCHECK Check Existence of Control Cycle
BAPI_KANBANCC_GETLIST Determine Kanban Control Cycles with Selection Criteria
BAPI_KANBANCC_GETLIST_ALL Determine Kanban Control Cycles with Selection Criteria
BAPI_KANBANCC_WITHDRAWQUANTITY Quantity Signal for Kanban Control Cycle

REM Confirmation


BAPI_REPMANCONF_CANCEL Reverse REM Backflush
BAPI_REPMANCONF_CREATE_MTO Execute Backflush in Sales Order Scenario
BAPI_REPMANCONF_CREATE_PLOT Execute Backflush in Production Lot Scenario
BAPI_REPMANCONF_CREATE_MTS Execute Backflush in Production Lot Scenario
BAPI_REPMANCONF_EXIST_CHK Check Existence of Object

REM Confirmation1


BAPI_REPMANCONF1_CANCEL Reverse REM Backflush
BAPI_REPMANCONF1_CREATE_MTO Execute Backflush in Sales Order Scenario
BAPI_REPMANCONF1_CREATE_MTP Execute Backflush in Production Lot Scenario
BAPI_REPMANCONF1_CREATE_MTS Execute Backflush in Stock Scenario
BAPI_REPMANCONF1_EXIST_CHK Check Existence of Object

Process order PI

BAPI_PROCORD_WM_MAT_STAGING WM Material Staging
BAPI_PROCORD_SETUSERSTATUS Set User Status
BAPI_PROCORD_SET_DEL_INDICATOR Set Deletion Indicator
BAPI_PROCORD_SET_DELETION_FLAG Set Deletion Indicator
BAPI_PROCORD_SCHEDULE Carry Out Scheduling
BAPI_PROCORD_REVOKEUSERSTATUS Cancel User Status
BAPI_PROCORD_RELEASE Release
BAPI_PROCORD_GET_LIST List of Order Headers
BAPI_PROCORD_GET_DETAIL List of Order Headers
BAPI_PROCORD_EXIST_CHECK Existence Check
BAPI_PROCORD_CREATE_FROM_REF Create with Template
BAPI_PROCORD_CREATE_FROM_PLORD Create with Planned Order
BAPI_PROCORD_CREATE_CAP_REQ Generate Capacity Requirement
BAPI_PROCORD_CREATE Create Process Order
BAPI_PROCORD_COSTING Create Cost Estimate
BAPI_PROCORD_COMPLETE_TECH Complete Technically
BAPI_PROCORD_CLOSE Close Order
BAPI_PROCORD_CHECK_MAT_AVAIL Check Material Availability
BAPI_PROCORD_CHANGE Change Process Order

Process Order Confirmation

BAPI_PROCORDCONF_CANCEL Cancel Process Order Confirmation
BAPI_PROCORDCONF_CREATE_ACT Enter Activity Confirmation
BAPI_PROCORDCONF_CREATE_HDR Enter Order Confirmations
BAPI_PROCORDCONF_CREATE_TE Enter Confirmation Time Events
BAPI_PROCORDCONF_CREATE_TT Enter Time Ticket Confirmation
BAPI_PROCORDCONF_EXIST_CHK Check Existence of Object
BAPI_PROCORDCONF_GET_HDR_PROP Propose Data for Order Confirmation
BAPI_PROCORDCONF_GETDETAIL Detail Data for Process Order Confirmation
BAPI_PROCORDCONF_GETLIST List of Confirmations for Process Orders
BAPI_PROCORDCONF_GET_TE_PROP Propose Data for Time Event Confirmation
BAPI_PROCORDCONF_GET_TT_PROP Propose Data for Time Ticket Confirmation

Process Characteristic PI

BAPI_PROC_CHAR_GET_HELPVALUES Get Allowed Values for Process Characteristic
BAPI_PROC_CHAR_GET_LIST Read Characteristic List Incl. Details

Process Message PI

BAPI_PROCESS_MESSAGE_CREATEMLT Create process messages
BAPI_PROCESS_MESSAGE_CHK_EXIST Check process message existence

Control Recipe

BAPI_CONTROL_RECIPE_GET_LIST Read control recipe list
BAPI_CONTROL_RECIPE_REQUEST Request and transfer control recipes

Comments