Functionality This Business ApplicationProgramming Interface> (BAPI) is used to change maintenance or serviceorders and their subobjects. The following objects of an order can beprocessed (restrictions are listed at the end of the documentation):
- Order header
- Partner
- User status
- Order operations
- Relationships
- Components
- Long text for order header, operations, and components
- Settlement rules
- Object list
- Object list links
- Production resources/tools
Function Calling this BAPI once allows you to perform all the operations. Forthis the system supplies the function module with a method tablecontaining the methods to be performed. The entries in the method tablerefer to data records in the optionally filled-out data tables. All themethods from the method table are performed. Alternatively, justsubobjects of existing orders can be changed, without changing theheader. You can process the transferred data with theBusiness Add-In> (BAdI)IBAPI_ALM_ORD_MODIFY to, for example, merge data from the externalsystem with data from the SAP system. The BAdI is called as soon as thetransferred data is converted to the internal formats. The checks thentake place after this. INCLUDE BAPI_COMMIT OBJECT DOKU ID TXStructure of Method Table>
- REFNUMBER,,Reference number for linking object method to attributes
The reference number is the line of the database which contains thecorresponding data. The data table is determined by the object type.
- OBJECTTYPE,,Object type
The object category specifies which object from the order should beprocessed. The key words listed here are not language-dependent and mustbe transferred exactly as they are. The following objects exist: HEADER,,,,Order header PARTNER,,,,Partner data USERSTATUS,,User status OPERATION,,,,Operation data RELATION,,,,Relationships COMPONENT,,Component TEXT,,,,Long texts SRULE,,,,Settlement rule OBJECTLIST,,,,Object list OLISTRELATION,,,,Object list links TASKLIST,,,,General maintenance task list PRT,,,,,,Production resources/tools (Blank),,,,,,General BAPI functions (Save)
- METHOD,,,,Method
The methods with which the data is to be processed. The followingfunctions exist: CREATE,,,,,,Create objects CREATETONOTIF,,,,,,Create notifications CHANGE,,,,,,Change objects DELETE,,,,,,Delete objects RELEASE,,,,,,Release TECHNICALCOMPLETE,,Technically complete ATPCHECK,,,,,,Availability check CALCULATE,,,,,,Estimate costs SCHEDULE,,,,,,Schedule DELELTEDSEX,,,,Delete the status for external scheduling at operationlevel ADD,,,,,,Add (only possible for object TASKLIST) SAVE,,,,,,Save all data DIALOG,,,,,,Dialog call. See explanation below. TRACE,,,,,,Write trace file to the specified file at the front end
- OBJECTKEY,,,,SAP-external object key
This key is for assigning the lower-level objects correctly to thecorresponding objects, as there is always just one key in the datatable. The key must have the following structure: 1-12,,,,Order number When creating orders with internal number assignment, a reference numberbeginning with % must be entered here. The BAPI then returns this numberand the number actually assigned. 13-16,,Operation number 17-20,,Suboperation number For relationships, the key is structured as follows: 1-12,,,,Order number from 13-16,,Operation number from 17-28,,Order number to 29-32,,Operation number to INCLUDE BAPI_ALM_ORDER_MAINTAIN OBJECT DOKU ID TXData Tables and Update Tables The objects have one or more data tables. For some objects you canspecify which of the fields specified in the structure should bechanged. For this you must set the field in the corresponding table toX> as in the data table. If no update table is transferred, thenonly those fields are set that have a value that is not initial>.This simplifies the transfer data. However, this means it is notpossible to delete fields. If an update structure should only bespecified for some data records, the table with the update fields mustnonetheless have the same number of lines as the data table. The emptylines are then treated as if no update structure was transferred. Theobjects "Partner", "User Status", "Text", and "Task List" have no updatetables. The whole data record is always copied here.References The objects use the field REFNUMBER> from the method table torefer to the lines in the data table. Counting always begins with 1. Indoing this, REFNUMBER> also refers to the update table. However,in the method table there is a second reference to the higher-levelobject for subobjects. The field OBJECTKEY> must be filled withorder number, operation number, and suboperation number, as specifiedabove. If subobjects of a newly created order should be changed, thenyou must enter a temporary order number that must begin with %. Severalorders can be numbered consecutively, for example, with %00000000001,%00000000002. For external number assignment, the external order numbermust be used here. The following objects have special handling for REFNUMBER>:
- Partner
Partners have an order number in the data table. During processing ofthe method table, all those entries in the data table are processed thathave an order number that is the same as that in the line to which themethod refers. Thus, through just one entry in the method table, severalpartners can be changed.
- Texts
Texts are composed of two tables. The first table (IT_TEXT) is made upof the header data of the text. Here you must specify the object and thefirst and last line of the text table (both inclusive, counting from 1).This specifies a line segment in the text line table (IT_TEXT_LINES).Special Features in Processing The BAPI processes the transferred methods in a particular sequence >, which need not correspond to the sequence in the methods table.
- Write trace file
- Change user status time 1
- Delete objects (dependent first)
- Create new objects
- Change existing or newly created objects
- Change user status time 2
- Status change of order
- Save data
The methods are performed such that subobjects can also be assigned tonewly created objects. For example, first the operations are created,and then the components. Long texts can also be created for the objects. Components> have an exceptional position. Components are createdthrough the assignment to an operation, that is, using the "key" order/operation (item number). However, as this is not the unique componentkey, you can only access the components to change them, delete them, oradd long texts by using the reservation number/item, which is only givenafter saving. This means that, for example, you cannot create a longtext when you create the component. For settlement rules> the following account assignment types aresupported:
- Cost center
- Order
- WBS element
- Asset
- G/L account
- Sales document
User status changes> can take place at two different time points.Time point 1 is before the object changes, time point 2 is after theobject changes and before the status change of the system. These timepoints should be defined in the transfer table in the CHANGE_EVENT > field. The field documentation contains the possible values. The external scheduling> is offered by the BAPI as a specialfunction. The BAPI can set the date field directly at the operationlevel, and select the operation with the status DSEX (Date set byexternal system)>. This status prevents any further scheduling of theoperation. The transferred dates are retained. For this, set thecategory X> in the restriction categories. When reading theoperation, this category is also returned, independent of the categoryof restriction set in the dialog. To delete the status, you can call upthe method DELETEDSEX for the object operation. The external schedulingcannot be influenced in dialog. All changes to the schedulingrestrictions in the dialog are saved, but they are not relevant forscheduling as long as the status DSEX> is active. A SAVE> or DIALOG> method must be transferred in every callof the BAPI. Usually, the BAPI call is thought of as a transaction. Alldata that is changed in the BAPI should also be saved immediately to thedatabase. The BAPI checks whether a SAVE method exists. Otherwise, itterminates processing. A test run of the BAPI consists of a standardcall with SAVE method, followed by a BAPI_TRANSACTION_ROLLBACK. To callthe BAPI without the SAVE method, for example, to realize dialogtransactions, the BAPI can be called with the DIALOG method. Thisswitches off the check for the SAVE method. The caller must then ensurethat later either a SAVE method or a BAPI_TRANSACTION_ROLLBACK iscalled. A BAPI_TRANSACTION_COMMIT without SAVE method terminates processing inthe update to ensure that no inconsistent data is written to thedatabase. The caller that called the BAPI does not receive anyconfirmation of the termination of the update in the target system. Thislogic is necessary as the order data was flagged for updating withBAPI_TRANSACTION_COMMIT through the SAVE method. However, the statusinformation was already flagged for updating when the BAPI was called. ABAPI_TRANSACTION_COMMIT without SAVE method then just saves the statusinformation and would generate inconsistent orders, if the updating wasnot terminated. The TRACE method> is used to save an XML trace file on the frontend under the file name specified in the OBJECTKEY> field. Thisfile can only be written if the BAPI is called from the dialog, that is,from the SAP GUI. The file is not written if background processing isused, nor is it written if the call originates in a different system.This file can be used by SAP for analysis purposes. SAP does not intendto use this data productively.Customer Enhancement The BAdI IBAPI_ALM_ORD_MODIFY> can be used to change thetransferred data. The BAdI is called up after the conversion of thetransfer structure into the structures used internally. Additional datacan be transferred using the table EXTENSION_IN. Only then is the datachecked.Refurbishment Order BAPI BAPI_ALM_ORDER_MAINTAIN also supports the creation and change ofrefurbishment orders. Refurbishment-order-specific header data, item (component) data, andserial number data is always created and updated together with the orderheader data even though it is passed to the BAPI separately. In order to support refurbishment-order-specific data, the interface ofthe BAPI has been enhanced by the following table parameters:
|