Fonction SAP BAPI_SALESDOCU_CREATEWITHDIA - Creating a Sales and Distribution Document

Paramètre Reférence Type Long. Valeur par déf. Facultatif Description
BINARY_RELATIONSHIPTYPE BAPIRELTYPE-RELTYPE C 4 'VORL' X Binary Relationship Type (Private)
CONVERT_PARVW_AUART BAPIFLAG-BAPIFLAG C 1 SPACE X Conversion of Partner Function + Order Type
INT_NUMBER_ASSIGNMENT BAPIFLAG-BAPIFLAG C 1 SPACE X Internal Item Number Assignment
MESSAGE_TYPE BAPIFLAG-BAPIFLAG C 1 'S' X Message Type in SAVE
SALESDOCUMENT BAPIVBELN-VBELN C 10 X Sales and Distribution Document Number
SALES_HEADER_IN BAPISDHEAD1 u 768 Document Header Data
SALES_HEADER_INX BAPISDHEAD1X u 102 X Checkbox for Header Data
SENDER BAPI_SENDER u 10 X Logical System - Sender
SYNCHRONOUS BAPIFLAG-BAPIFLAG C 1 SPACE X Single-Character Indicator

Paramètre Reférence Type Long. Description
SALESDOCUMENT_EX BAPIVBELN-VBELN C 10 Number of Generated Document

Paramètre Reférence Long. Facultatif Description
PARTNERADDRESSES BAPIADDR1 1574 X BAPI Reference Structure for Addresses (Organization/Company)
RETURN BAPIRET2 548 X Return Messages
SALES_CCARD BAPICCARD 268 X Credit Card Data
SALES_CFGS_BLOB BAPICUBLB 256 X Configuration: BLOB Internal 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_VALUE BAPICUVAL 276 X Configuration: Characteristic values
SALES_CONDITIONS_IN BAPICONDITION 248 X Conditions
SALES_CONDITIONS_INX BAPICONDITIONX 20 X Conditions Checkbox
SALES_ITEMS_IN BAPISDITEM 1131 X Item Data
SALES_ITEMS_INX BAPISDITEMX 149 X Item Data Checkboxes
SALES_PARTNERS BAPIPARTNR 594 X Document Partner
SALES_SCHEDULES_IN BAPISCHEDULE 182 X Schedule Line Data
SALES_SCHEDULES_INX BAPISCHEDULEX 105 X Checkbox Schedule Line Data

Functionality
Using this method, you can create sales documents with items, schedulelines and item conditions.
You must enter at least sales order header data (via the structureORDER_HEADER_IN) and partner data (via the table ORDER_PARTNERS).
Enter the item data via the table ORDER_ITEMS_IN. You can enter the itemnumber manually, by filling in the relevant fields, or automatically,corresponding to Customizing, by leaving the relevant fields blank. Ifyou decide to enter item numbers using mySAP ERP, no schedule lines orconditions can be entered, as these cannot be linked to thecorresponding item.
If you are dealing with configurable items, you must enter theconfiguration data in the tables ORDER_CFGS_REF, ORDER_CFGS_INST,ORDER_CFGS_PART_OF, ORDER_CFGS_VALUE and ORDER_CFGS_BLOB.
The scheduling data can be published via the structureSALES_SCHEDULE_IN.
Document condtions to be created can be entered via the structureSALES_CONDITIONS_IN.
Credit card data can be published via the structure SALES_CCARD, cardidentification data on the one hand, data on an authorization that hastaken place in an external system on the other.
Once you have created the sales document successfully, you will receivethe document number (field SALESDOCUMENT_EX). (Feld SALESDOCUMENT_EX).
Errors which might occur will be announced via the parameter RETURN.
Using the checkbox:
You can generate the individual components for a sales document with orwithout a checkbox. If you decide on the first possibility, only fieldswith unequal SPACE will be copied. In the second case (fieldUPDATEFLAG), only fields which have an 'X' in the box are copied. As aresult, fields, which are preassigned to default values by the system,can be set on SPACE again.

Notes
If no object references are to be written, the following fields(parameters) should be initialized:
BINARY_RELATIONSHIPTYPE
SALES_HEADER_IN-REFOBJECTTYPE
SALES_HEADER_IN-REFOBJECTKEY
SALES_HEADER_IN-REFDOCTYPE

Description
The parameter sends back the sales document number, which has beengenerated by the BAPI.
INCLUDE SD_BAPI_CONVERT_PARVW_AUART OBJECT DOKU ID TX
INCLUDE SD_BAPIVBELN_DOCU OBJECT DOKU ID TX

Description
This parameter contains data on the sales document header.
INCLUDE SD_BAPISDHEADX1_DOCU OBJECT DOKU ID TX

Description
In this structure,the Return code for the function module is sent back.
How the structure is organized
TYPE Declaration type : S Success, E Error, W Warning, IInformation
CODE Message code
MESSAGE Message text
LOG_NO Application log: Log number
LOG_MSG_NO Application log: Message number

Value range
If no error occurs, the Return parameter remains blank. Otherwise, the
relevant error messages are entered with short text.

Description
The table contains credit card data, data for identification andauthorization.
It is necessary to enter the currency in order that currency conversionof amount fields is correct.
INCLUDE SD_BAPICONDITION_DOCU OBJECT DOKU ID TX

Description
This parameter is used for the following two tasks:
Controlling the processing functionality using the value in theUPDATEFLAG field (change indicator).
The following entries are possible for this:
Space: Create new credit card data
I: Create new credit card data
U: Change existing credit card data
D: Delete existing credit card data
Controlling field entry using checkboxes
If the UPDATEFLAG field is set, only the fields for the
SALES_CONDITIONS_IN parameter whose checkbox is filled with 'X'are copied.

Description
This parameter contains item input data for the sales document.
INCLUDE SD_BAPISDITEMX_DOCU OBJECT DOKU ID TX
INCLUDE SD_BAPIPARTNR_DOCU OBJECT DOKU ID TX

Description
This parameter contains the schedule line data
INCLUDE SD_BAPISCHEDULEX_DOCU OBJECT DOKU ID TX

915052FAQ: BAPI and credit cards
625611No CAM address for BAPI_SALESDOCU_CREATEWITHDIA
545055Report SDWTKTNA returns incorrect released value
495964Check incorrect date in the BAPI