SAP SD_SALESDOCUMENT_CREATE Function Module for Creating a Sales and Distribution Document









SD_SALESDOCUMENT_CREATE is a standard sd salesdocument create SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Creating a Sales and Distribution Document processing and below is the pattern details for this FM, showing its interface including any import and export parameters, exceptions etc. there is also a full "cut and paste" ABAP pattern code example, along with implementation ABAP coding, documentation and contribution comments specific to this or related objects.


See here to view full function module documentation and code listing for sd salesdocument create FM, simply by entering the name SD_SALESDOCUMENT_CREATE into the relevant SAP transaction such as SE37 or SE38.

Function Group: VBAK
Program Name: SAPLVBAK
Main Program: SAPLVBAK
Appliation area: V
Release date: N/A
Mode(Normal, Remote etc): Remote-Enabled
Update:



Function SD_SALESDOCUMENT_CREATE pattern details

In-order to call this FM within your sap programs, simply using the below ABAP pattern details to trigger the function call...or see the full ABAP code listing at the end of this article. You can simply cut and paste this code into your ABAP progrom as it is, including variable declarations.
CALL FUNCTION 'SD_SALESDOCUMENT_CREATE'"Creating a Sales and Distribution Document
EXPORTING
* SALESDOCUMENT = "Sales and Distribution Document Number
* TESTRUN = "Test Run
* CONVERT_PARVW_AUART = ' ' "Conversion of Partner Function and Order Type
* STATUS_BUFFER_REFRESH = 'X' "Initialization of Status Buffer
* CALL_ACTIVE = ' ' "
SALES_HEADER_IN = "Document Header Data
* SALES_HEADER_INX = "Header Data Checkboxes
* SENDER = "Logical System - Sender
* BINARY_RELATIONSHIPTYPE = ' ' "Binary Relationship Type (Private)
* INT_NUMBER_ASSIGNMENT = ' ' "Internal Item Number Assignment
* BEHAVE_WHEN_ERROR = ' ' "Error Handling
* LOGIC_SWITCH = ' ' "Internal Control Parameter BAPISDLS
* BUSINESS_OBJECT = ' ' "Business Object

IMPORTING
SALESDOCUMENT_EX = "Number of Generated Document
SALES_HEADER_OUT = "BAPI Structure of VBAK with English Field Names
SALES_HEADER_STATUS = "BAPI Structure of VBUK with English Field Names

TABLES
* RETURN = "Return Messages
* SALES_CFGS_INST = "Configuration: Instances
* SALES_CFGS_PART_OF = "Configuration: Part-of Specifications
* SALES_CFGS_VALUE = "Configuration: Characteristic Values
* SALES_CFGS_BLOB = "Configuration: BLOB Internal Data (SCE)
* SALES_CFGS_VK = "Configuration: Variant Condition Key
* SALES_CFGS_REFINST = "Configuration: Reference Item / Instance
* SALES_CCARD = "Credit Card Data
* SALES_TEXT = "Texts
* SALES_KEYS = "Output Table of Reference Keys
* SALES_CONTRACT_IN = "Contract Data
* SALES_ITEMS_IN = "Item Data
* SALES_CONTRACT_INX = "Checkbox: Contract Data
* EXTENSIONIN = "Customer Enhancment Import
* PARTNERADDRESSES = "BAPI Reference Structure for Addresses (Org./Company)
* SALES_SCHED_CONF_IN = "Schedule Line Data Confirmation
* ITEMS_EX = "Structure of VBAP with English Field Names
* SCHEDULE_EX = "Struture of VBEP with English Field Names
* BUSINESS_EX = "BAPI Structure of VBKD with English Field Names
* INCOMPLETE_LOG = "Communication Fields: Incompletion
* EXTENSIONEX = "Reference Structure for BAPI Parameters ExtensionIn/ExtensionOut
* CONDITIONS_EX = "Communication Fields for Maintaining Conditions in the Order
* SALES_ITEMS_INX = "Item Data Checkboxes
* PARTNERS_EX = "BAPI Structure of VBPA with English Field Names
* TEXTHEADERS_EX = "BAPI Structure of THEAD with English Field Names
* TEXTLINES_EX = "BAPI Structure for STX_LINES Structure
* BATCH_CHARC = "BAPI Transfer Structure Selection Data CRM -> ERP
* CAMPAIGN_ASGN = "BAPI Structure for Table CMPB_ASGN
* CONDITIONS_KONV_EX = "Conditions (Transaction Data)
* SALES_PARTNERS = "Document Partner
* SALES_SCHEDULES_IN = "Schedule Line Data
* SALES_SCHEDULES_INX = "Checkbox Schedule Line Data
* SALES_CONDITIONS_IN = "Conditions
* SALES_CONDITIONS_INX = "Conditions Checkbox
* SALES_CFGS_REF = "Configuration: Reference Data
.



IMPORTING Parameters details for SD_SALESDOCUMENT_CREATE

SALESDOCUMENT - Sales and Distribution Document Number

Data type: BAPIVBELN-VBELN
Optional: Yes
Call by Reference: No ( called with pass by value option)

TESTRUN - Test Run

Data type: BAPIFLAG-BAPIFLAG
Optional: Yes
Call by Reference: No ( called with pass by value option)

CONVERT_PARVW_AUART - Conversion of Partner Function and Order Type

Data type: BAPIFLAG-BAPIFLAG
Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)

STATUS_BUFFER_REFRESH - Initialization of Status Buffer

Data type: BAPIFLAG-BAPIFLAG
Default: 'X'
Optional: Yes
Call by Reference: No ( called with pass by value option)

CALL_ACTIVE -

Data type: CHAR4
Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)

SALES_HEADER_IN - Document Header Data

Data type: BAPISDHD1
Optional: No
Call by Reference: No ( called with pass by value option)

SALES_HEADER_INX - Header Data Checkboxes

Data type: BAPISDHD1X
Optional: Yes
Call by Reference: No ( called with pass by value option)

SENDER - Logical System - Sender

Data type: BDI_LOGSYS
Optional: Yes
Call by Reference: No ( called with pass by value option)

BINARY_RELATIONSHIPTYPE - Binary Relationship Type (Private)

Data type: BRELTYP-RELTYPE
Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)

INT_NUMBER_ASSIGNMENT - Internal Item Number Assignment

Data type: BAPIFLAG-BAPIFLAG
Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)

BEHAVE_WHEN_ERROR - Error Handling

Data type: BAPIFLAG-BAPIFLAG
Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)

LOGIC_SWITCH - Internal Control Parameter BAPISDLS

Data type: BAPISDLS
Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)

BUSINESS_OBJECT - Business Object

Data type: BAPIUSW01-OBJTYPE
Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)

EXPORTING Parameters details for SD_SALESDOCUMENT_CREATE

SALESDOCUMENT_EX - Number of Generated Document

Data type: BAPIVBELN-VBELN
Optional: No
Call by Reference: No ( called with pass by value option)

SALES_HEADER_OUT - BAPI Structure of VBAK with English Field Names

Data type: BAPISDHD
Optional: No
Call by Reference: No ( called with pass by value option)

SALES_HEADER_STATUS - BAPI Structure of VBUK with English Field Names

Data type: BAPISDHDST
Optional: No
Call by Reference: No ( called with pass by value option)

TABLES Parameters details for SD_SALESDOCUMENT_CREATE

RETURN - Return Messages

Data type: BAPIRET2
Optional: Yes
Call by Reference: No ( called with pass by value option)

SALES_CFGS_INST - Configuration: Instances

Data type: BAPICUINS
Optional: Yes
Call by Reference: No ( called with pass by value option)

SALES_CFGS_PART_OF - Configuration: Part-of Specifications

Data type: BAPICUPRT
Optional: Yes
Call by Reference: No ( called with pass by value option)

SALES_CFGS_VALUE - Configuration: Characteristic Values

Data type: BAPICUVAL
Optional: Yes
Call by Reference: No ( called with pass by value option)

SALES_CFGS_BLOB - Configuration: BLOB Internal Data (SCE)

Data type: BAPICUBLB
Optional: Yes
Call by Reference: No ( called with pass by value option)

SALES_CFGS_VK - Configuration: Variant Condition Key

Data type: BAPICUVK
Optional: Yes
Call by Reference: No ( called with pass by value option)

SALES_CFGS_REFINST - Configuration: Reference Item / Instance

Data type: BAPICUREF
Optional: Yes
Call by Reference: No ( called with pass by value option)

SALES_CCARD - Credit Card Data

Data type: BAPICCARD
Optional: Yes
Call by Reference: No ( called with pass by value option)

SALES_TEXT - Texts

Data type: BAPISDTEXT
Optional: Yes
Call by Reference: No ( called with pass by value option)

SALES_KEYS - Output Table of Reference Keys

Data type: BAPISDKEY
Optional: Yes
Call by Reference: No ( called with pass by value option)

SALES_CONTRACT_IN - Contract Data

Data type: BAPICTR
Optional: Yes
Call by Reference: No ( called with pass by value option)

SALES_ITEMS_IN - Item Data

Data type: BAPISDITM
Optional: Yes
Call by Reference: No ( called with pass by value option)

SALES_CONTRACT_INX - Checkbox: Contract Data

Data type: BAPICTRX
Optional: Yes
Call by Reference: No ( called with pass by value option)

EXTENSIONIN - Customer Enhancment Import

Data type: BAPIPAREX
Optional: Yes
Call by Reference: No ( called with pass by value option)

PARTNERADDRESSES - BAPI Reference Structure for Addresses (Org./Company)

Data type: BAPIADDR1
Optional: Yes
Call by Reference: Yes

SALES_SCHED_CONF_IN - Schedule Line Data Confirmation

Data type: BAPISCHDL2
Optional: Yes
Call by Reference: Yes

ITEMS_EX - Structure of VBAP with English Field Names

Data type: BAPISDIT
Optional: Yes
Call by Reference: Yes

SCHEDULE_EX - Struture of VBEP with English Field Names

Data type: BAPISDHEDU
Optional: Yes
Call by Reference: Yes

BUSINESS_EX - BAPI Structure of VBKD with English Field Names

Data type: BAPISDBUSI
Optional: Yes
Call by Reference: Yes

INCOMPLETE_LOG - Communication Fields: Incompletion

Data type: BAPIINCOMP
Optional: Yes
Call by Reference: Yes

EXTENSIONEX - Reference Structure for BAPI Parameters ExtensionIn/ExtensionOut

Data type: BAPIPAREX
Optional: Yes
Call by Reference: Yes

CONDITIONS_EX - Communication Fields for Maintaining Conditions in the Order

Data type: BAPICOND
Optional: Yes
Call by Reference: Yes

SALES_ITEMS_INX - Item Data Checkboxes

Data type: BAPISDITMX
Optional: Yes
Call by Reference: No ( called with pass by value option)

PARTNERS_EX - BAPI Structure of VBPA with English Field Names

Data type: BAPISDPART
Optional: Yes
Call by Reference: Yes

TEXTHEADERS_EX - BAPI Structure of THEAD with English Field Names

Data type: BAPISDTEHD
Optional: Yes
Call by Reference: Yes

TEXTLINES_EX - BAPI Structure for STX_LINES Structure

Data type: BAPITEXTLI
Optional: Yes
Call by Reference: Yes

BATCH_CHARC - BAPI Transfer Structure Selection Data CRM -> ERP

Data type: BAPIBTSEL
Optional: Yes
Call by Reference: Yes

CAMPAIGN_ASGN - BAPI Structure for Table CMPB_ASGN

Data type: BAPISDCA
Optional: Yes
Call by Reference: Yes

CONDITIONS_KONV_EX - Conditions (Transaction Data)

Data type: KONV
Optional: Yes
Call by Reference: Yes

SALES_PARTNERS - Document Partner

Data type: BAPIPARNR
Optional: Yes
Call by Reference: No ( called with pass by value option)

SALES_SCHEDULES_IN - Schedule Line Data

Data type: BAPISCHDL
Optional: Yes
Call by Reference: No ( called with pass by value option)

SALES_SCHEDULES_INX - Checkbox Schedule Line Data

Data type: BAPISCHDLX
Optional: Yes
Call by Reference: No ( called with pass by value option)

SALES_CONDITIONS_IN - Conditions

Data type: BAPICOND
Optional: Yes
Call by Reference: No ( called with pass by value option)

SALES_CONDITIONS_INX - Conditions Checkbox

Data type: BAPICONDX
Optional: Yes
Call by Reference: No ( called with pass by value option)

SALES_CFGS_REF - Configuration: Reference Data

Data type: BAPICUCFG
Optional: Yes
Call by Reference: No ( called with pass by value option)

Copy and paste ABAP code example for SD_SALESDOCUMENT_CREATE Function Module

The ABAP code below is a full code listing to execute function module POPUP_TO_CONFIRM including all data declarations. The code uses the original data declarations rather than the latest in-line data DECLARATION SYNTAX but I have included an ABAP code snippet at the end to show how declarations would look using the newer method of declaring data variables on the fly. This will allow you to compare and fully understand the new inline method. Please note some of the newer syntax such as the @DATA is not available until a later 4.70 service pack (SP8), which i why i have stuck to the origianl for this example.

DATA:
lt_return  TYPE STANDARD TABLE OF BAPIRET2, "   
lv_salesdocument  TYPE BAPIVBELN-VBELN, "   
lv_salesdocument_ex  TYPE BAPIVBELN-VBELN, "   
lv_testrun  TYPE BAPIFLAG-BAPIFLAG, "   
lt_sales_cfgs_inst  TYPE STANDARD TABLE OF BAPICUINS, "   
lt_sales_cfgs_part_of  TYPE STANDARD TABLE OF BAPICUPRT, "   
lv_convert_parvw_auart  TYPE BAPIFLAG-BAPIFLAG, "   SPACE
lt_sales_cfgs_value  TYPE STANDARD TABLE OF BAPICUVAL, "   
lv_status_buffer_refresh  TYPE BAPIFLAG-BAPIFLAG, "   'X'
lv_call_active  TYPE CHAR4, "   SPACE
lt_sales_cfgs_blob  TYPE STANDARD TABLE OF BAPICUBLB, "   
lt_sales_cfgs_vk  TYPE STANDARD TABLE OF BAPICUVK, "   
lt_sales_cfgs_refinst  TYPE STANDARD TABLE OF BAPICUREF, "   
lt_sales_ccard  TYPE STANDARD TABLE OF BAPICCARD, "   
lt_sales_text  TYPE STANDARD TABLE OF BAPISDTEXT, "   
lt_sales_keys  TYPE STANDARD TABLE OF BAPISDKEY, "   
lt_sales_contract_in  TYPE STANDARD TABLE OF BAPICTR, "   
lt_sales_items_in  TYPE STANDARD TABLE OF BAPISDITM, "   
lv_sales_header_in  TYPE BAPISDHD1, "   
lv_sales_header_out  TYPE BAPISDHD, "   
lt_sales_contract_inx  TYPE STANDARD TABLE OF BAPICTRX, "   
lt_extensionin  TYPE STANDARD TABLE OF BAPIPAREX, "   
lt_partneraddresses  TYPE STANDARD TABLE OF BAPIADDR1, "   
lt_sales_sched_conf_in  TYPE STANDARD TABLE OF BAPISCHDL2, "   
lt_items_ex  TYPE STANDARD TABLE OF BAPISDIT, "   
lt_schedule_ex  TYPE STANDARD TABLE OF BAPISDHEDU, "   
lt_business_ex  TYPE STANDARD TABLE OF BAPISDBUSI, "   
lt_incomplete_log  TYPE STANDARD TABLE OF BAPIINCOMP, "   
lt_extensionex  TYPE STANDARD TABLE OF BAPIPAREX, "   
lt_conditions_ex  TYPE STANDARD TABLE OF BAPICOND, "   
lt_sales_items_inx  TYPE STANDARD TABLE OF BAPISDITMX, "   
lv_sales_header_inx  TYPE BAPISDHD1X, "   
lv_sales_header_status  TYPE BAPISDHDST, "   
lt_partners_ex  TYPE STANDARD TABLE OF BAPISDPART, "   
lt_textheaders_ex  TYPE STANDARD TABLE OF BAPISDTEHD, "   
lt_textlines_ex  TYPE STANDARD TABLE OF BAPITEXTLI, "   
lt_batch_charc  TYPE STANDARD TABLE OF BAPIBTSEL, "   
lt_campaign_asgn  TYPE STANDARD TABLE OF BAPISDCA, "   
lt_conditions_konv_ex  TYPE STANDARD TABLE OF KONV, "   
lv_sender  TYPE BDI_LOGSYS, "   
lt_sales_partners  TYPE STANDARD TABLE OF BAPIPARNR, "   
lt_sales_schedules_in  TYPE STANDARD TABLE OF BAPISCHDL, "   
lv_binary_relationshiptype  TYPE BRELTYP-RELTYPE, "   SPACE
lt_sales_schedules_inx  TYPE STANDARD TABLE OF BAPISCHDLX, "   
lv_int_number_assignment  TYPE BAPIFLAG-BAPIFLAG, "   SPACE
lv_behave_when_error  TYPE BAPIFLAG-BAPIFLAG, "   SPACE
lt_sales_conditions_in  TYPE STANDARD TABLE OF BAPICOND, "   
lv_logic_switch  TYPE BAPISDLS, "   SPACE
lt_sales_conditions_inx  TYPE STANDARD TABLE OF BAPICONDX, "   
lt_sales_cfgs_ref  TYPE STANDARD TABLE OF BAPICUCFG, "   
lv_business_object  TYPE BAPIUSW01-OBJTYPE. "   SPACE

  CALL FUNCTION 'SD_SALESDOCUMENT_CREATE'  "Creating a Sales and Distribution Document
    EXPORTING
         SALESDOCUMENT = lv_salesdocument
         TESTRUN = lv_testrun
         CONVERT_PARVW_AUART = lv_convert_parvw_auart
         STATUS_BUFFER_REFRESH = lv_status_buffer_refresh
         CALL_ACTIVE = lv_call_active
         SALES_HEADER_IN = lv_sales_header_in
         SALES_HEADER_INX = lv_sales_header_inx
         SENDER = lv_sender
         BINARY_RELATIONSHIPTYPE = lv_binary_relationshiptype
         INT_NUMBER_ASSIGNMENT = lv_int_number_assignment
         BEHAVE_WHEN_ERROR = lv_behave_when_error
         LOGIC_SWITCH = lv_logic_switch
         BUSINESS_OBJECT = lv_business_object
    IMPORTING
         SALESDOCUMENT_EX = lv_salesdocument_ex
         SALES_HEADER_OUT = lv_sales_header_out
         SALES_HEADER_STATUS = lv_sales_header_status
    TABLES
         RETURN = lt_return
         SALES_CFGS_INST = lt_sales_cfgs_inst
         SALES_CFGS_PART_OF = lt_sales_cfgs_part_of
         SALES_CFGS_VALUE = lt_sales_cfgs_value
         SALES_CFGS_BLOB = lt_sales_cfgs_blob
         SALES_CFGS_VK = lt_sales_cfgs_vk
         SALES_CFGS_REFINST = lt_sales_cfgs_refinst
         SALES_CCARD = lt_sales_ccard
         SALES_TEXT = lt_sales_text
         SALES_KEYS = lt_sales_keys
         SALES_CONTRACT_IN = lt_sales_contract_in
         SALES_ITEMS_IN = lt_sales_items_in
         SALES_CONTRACT_INX = lt_sales_contract_inx
         EXTENSIONIN = lt_extensionin
         PARTNERADDRESSES = lt_partneraddresses
         SALES_SCHED_CONF_IN = lt_sales_sched_conf_in
         ITEMS_EX = lt_items_ex
         SCHEDULE_EX = lt_schedule_ex
         BUSINESS_EX = lt_business_ex
         INCOMPLETE_LOG = lt_incomplete_log
         EXTENSIONEX = lt_extensionex
         CONDITIONS_EX = lt_conditions_ex
         SALES_ITEMS_INX = lt_sales_items_inx
         PARTNERS_EX = lt_partners_ex
         TEXTHEADERS_EX = lt_textheaders_ex
         TEXTLINES_EX = lt_textlines_ex
         BATCH_CHARC = lt_batch_charc
         CAMPAIGN_ASGN = lt_campaign_asgn
         CONDITIONS_KONV_EX = lt_conditions_konv_ex
         SALES_PARTNERS = lt_sales_partners
         SALES_SCHEDULES_IN = lt_sales_schedules_in
         SALES_SCHEDULES_INX = lt_sales_schedules_inx
         SALES_CONDITIONS_IN = lt_sales_conditions_in
         SALES_CONDITIONS_INX = lt_sales_conditions_inx
         SALES_CFGS_REF = lt_sales_cfgs_ref
. " SD_SALESDOCUMENT_CREATE




ABAP code using 7.40 inline data declarations to call FM SD_SALESDOCUMENT_CREATE

The below ABAP code uses the newer in-line data declarations. This allows you to see the coding differences/benefits of the later inline syntax. Please note some of the newer syntax below, such as the @DATA is not available until 4.70 EHP 8.

 
"SELECT single VBELN FROM BAPIVBELN INTO @DATA(ld_salesdocument).
 
"SELECT single VBELN FROM BAPIVBELN INTO @DATA(ld_salesdocument_ex).
 
"SELECT single BAPIFLAG FROM BAPIFLAG INTO @DATA(ld_testrun).
 
 
 
"SELECT single BAPIFLAG FROM BAPIFLAG INTO @DATA(ld_convert_parvw_auart).
DATA(ld_convert_parvw_auart) = ' '.
 
 
"SELECT single BAPIFLAG FROM BAPIFLAG INTO @DATA(ld_status_buffer_refresh).
DATA(ld_status_buffer_refresh) = 'X'.
 
DATA(ld_call_active) = ' '.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
"SELECT single RELTYPE FROM BRELTYP INTO @DATA(ld_binary_relationshiptype).
DATA(ld_binary_relationshiptype) = ' '.
 
 
"SELECT single BAPIFLAG FROM BAPIFLAG INTO @DATA(ld_int_number_assignment).
DATA(ld_int_number_assignment) = ' '.
 
"SELECT single BAPIFLAG FROM BAPIFLAG INTO @DATA(ld_behave_when_error).
DATA(ld_behave_when_error) = ' '.
 
 
DATA(ld_logic_switch) = ' '.
 
 
 
"SELECT single OBJTYPE FROM BAPIUSW01 INTO @DATA(ld_business_object).
DATA(ld_business_object) = ' '.
 


Search for further information about these or an SAP related objects



Comments on this SAP object

What made you want to lookup this SAP object? Please tell us what you were looking for and anything you would like to be included on this page!