SAP Function BS01_SALESDOCUMENT_CHANGE - BAPI Change Sales Document

Parameter Reference Type Length Default Optional Text
BEHAVE_WHEN_ERROR BAPIFLAG-BAPIFLAG C 1 SPACE X Error Handling
BUSINESS_OBJECT BAPIUSW01-OBJTYPE C 10 SPACE Business object
DEL_OLD_COST_ITEMS XFLAG C 1 SPACE X Delete Flag for Costing
INT_NUMBER_ASSIGNMENT BAPIFLAG-BAPIFLAG C 1 SPACE X Internal Item Number Assignment
LOGIC_SWITCH BAPISDLS u 5 SPACE X SD Checkbox for the Logic Switch
ORDER_HEADER_IN BAPISDHD1 u 918 Sales Document Header
ORDER_HEADER_INX BAPISDHD1X u 120 Sales Document Header Checkbox
SALESDOCUMENT BAPIVBELN-VBELN C 10 X Document number of Sales and Distribution Document
SIMULATION BAPIFLAG-BAPIFLAG C 1 SPACE X Simulation mode

Parameter Reference Length Optional Text
CONDITIONS_IN BAPICOND 336 X Conditions
CONDITIONS_INX BAPICONDX 46 X Conditions Checkbox
EXTENSIONIN BAPIPAREX 990 X Customer Enhancment Import
ITEM_IN BAPISDITMBOS 1267 X Sales and Distribution Document Item
ITEM_INX BAPISDITMXBOS 167 X Sales Document Item Checkbox
PARTNERADDRESSES BAPIADDR1 1574 X BAPI Reference Structure for Addresses (Org./Company)
PARTNERCHANGES BAPIPARNRC 149 X Partner changes
PARTNERS BAPIPARNR 664 X Communications Fields: SD Document Partner: WWW
RETURN BAPIRET2 548 Return code
SALES_CFGS_BLOB BAPICUBLB 256 X Internal configuration data (SCE)
SALES_CFGS_INST BAPICUINS 233 X Configuration: Instances
SALES_CFGS_PART_OF BAPICUPRT 123 X Configuration: Part-of specifications
SALES_CFGS_REF BAPICUCFG 397 X Configuration: Reference data
SALES_CFGS_REFINST BAPICUREF 20 X Configuration: Reference item / instance
SALES_CFGS_VALUE BAPICUVAL 276 X Configuration: Characteristic values
SALES_CFGS_VK BAPICUVK 55 X Configuration: Variant condition key
SALES_CONTRACT_IN BAPICTR 129 X Contract data
SALES_CONTRACT_INX BAPICTRX 28 X Checkbox structure: Contract data
SALES_KEYS BAPISDKEY 189 X Output Table of Reference Keys
SALES_SERVICES_COND BAPIBOSCD 296 X Communication Fields to Maintain Service Line Condition
SALES_SERVICES_CONDX BAPIBOSCDX 40 X Checkbox Structure: Maintain Service Line Conditions
SALES_SERVICES_COST_ITEMS BAPIBOSCOST 444 X Communication Fields: Sales Document Item With BOS & Costing
SALES_SERVICES_COST_MODEL BAPIBOSCOSTMODEL 36 X Communication Fields: Sales Document Item With BOS & Costing
SALES_SERVICES_MODEL_VAL BAPIBOSCOSTMODEL_CHARA_VALUE 311 X BOS ECP : Structure for Characteristic Value Assignment
SALES_TEXT BAPISDTEXT 160 X Texts
SCHEDULE_IN BAPISCHDL 198 X Schedule lines
SCHEDULE_INX BAPISCHDLX 109 X Schedule Line Checkbox
SERVICES BAPISDESLLCBOS 554 X Communication Structure: Create Service Line
SERVICESX BAPISDESLLCBOSX 69 X Communication Structure Change Service LIne
SERVICES_TEXT BAPIESLLTX 158 X BAPI Services Long Text

Functionality
You can change and delete SD documents with this method.
You can change header, item, schedule line and configuration data.
Generally speaking, the following applies:
1. Only the fields to be changed should be entered.
2. These should be marked in the appropriate checkbox structure with an
"X".
3. Field UPDATEFLAG should be filled with a "U".
4. Key fields should always be entered when a change is made, even in
the checkbox structure.
5. Exception: configuration. If the configuration is changed, it must
be filled completely.
6. Quantities and dates have to be maintained via the schedule line
data.
7. Possible UPDATEFLAGS: U= change
D= delete
I= insert/create

Example
Here are a few examples of how the parameters should be filled:
1. Delete a complete SD document
- SALESDOCUMENT = document number
- ORDER_HEADER_INX-UPDATEFLAG = D
2. Delete an SD document item
- SALESDOCUMENT = document number
- ORDER_HEADER_INX-UPDATEFLAG = U
- ITEM_IN-ITM_NUMBER = item to be deleted
- ITEM_INX-ITM_NUMBER = item to be deleted
- ITEM_INX-UPDATEFLAG = D
3. Change SD document
4. Change configuration

Notes
Minimum entries:
The SD document number at least must be entered in structureSALESDOCUMENT. Key fields must always be entered when a change is made.
The update indicator in ORDER_HEADER_INX must always be entered.
Commit Control:
The BAPI does not perform a database commit. This means that the
calling application has to exit the Commit so that changes can be made
on the database. BAPI "BAPI_TRANSACTION_COMMIT" is available for this.
The BAPI should be tested in a test sequence that contains the BAPI andBAPI_TRANSACTION_COMMIT (with transaction se37). The database committakes place and the changes can be checked with a display transaction.
INCLUDE SD_BEHAVE_WHEN_ERROR OBJECT DOKU ID TX
INCLUDE SD_BAPIVBELN_DOCU OBJECT DOKU ID TX