SAP BS01_SALESDOCUMENT_CREATE Function Module for Creation of a Sales Document with BOS









BS01_SALESDOCUMENT_CREATE is a standard bs01 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 Creation of a Sales Document with BOS 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 bs01 salesdocument create FM, simply by entering the name BS01_SALESDOCUMENT_CREATE into the relevant SAP transaction such as SE37 or SE38.

Function Group: BOS01
Program Name: SAPLBOS01
Main Program: SAPLBOS01
Appliation area: V
Release date: 25-Jun-2001
Mode(Normal, Remote etc): Normal Function Module
Update:



Function BS01_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 'BS01_SALESDOCUMENT_CREATE'"Creation of a Sales Document with BOS
EXPORTING
* SALESDOCUMENT = "Sales Document Number
* TESTRUN = "Test run
* COSTINGVARIANT = "Cost Estimate Number for Cost Est. w/o Qty Structure
SALES_HEADER_IN = "Document Header Data
* SALES_HEADER_INX = "Checkbox for header data
* 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
* BUSINESS_OBJECT = ' ' "Business object

IMPORTING
SALESDOCUMENT_EX = "Number of Generated Document

TABLES
RETURN = "Return Messages
* 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_CONTRACT_INX = "Checkbox: Contract Data
* SALES_ITEMS_IN = "Item Data
* EXTENSIONIN = "Customer Enhancment Import
* SALES_SERVICES = "Services
* SALES_SERVICES_TEXT = "Text for Service Line
* SALES_SERVICES_COND = "Service Line Conditions
* SALES_SERVICES_COST_ITEMS = "Communication Fields: Sales Document Item With BOS & Costing
* SALES_SERVICES_COST_MODEL = "Communication Fields: Sales Document Item With BOS & Costing
* SALES_SERVICES_MODEL_VAL = "BOS ECP : Structure for Characteristic Value Assignment
* PARTNERADDRESSES = "BAPI Reference Structure for Addresses (Org./Company)
* SALES_ITEMS_INX = "Checkbox Item Data
* SALES_PARTNERS = "Document partner
* SALES_SCHEDULES_IN = "Schedule line data
* SALES_SCHEDULES_INX = "Checkbox Schedule Line Data
* SALES_CONDITIONS_IN = "Conditions
* SALES_CFGS_REF = "Configuration: Reference data
* SALES_CFGS_INST = "Configuration: Instances
.



IMPORTING Parameters details for BS01_SALESDOCUMENT_CREATE

SALESDOCUMENT - Sales 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)

COSTINGVARIANT - Cost Estimate Number for Cost Est. w/o Qty Structure

Data type: ESLL-KLVAR
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 - Checkbox for header data

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

SENDER - Logical system - Sender

Data type: BAPI_SENDER
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

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: No
Call by Reference: No ( called with pass by value option)

EXPORTING Parameters details for BS01_SALESDOCUMENT_CREATE

SALESDOCUMENT_EX - Number of Generated Document

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

TABLES Parameters details for BS01_SALESDOCUMENT_CREATE

RETURN - Return Messages

Data type: BAPIRET2
Optional: No
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_CONTRACT_INX - Checkbox: Contract Data

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

SALES_ITEMS_IN - Item Data

Data type: BAPISDITMBOS
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)

SALES_SERVICES - Services

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

SALES_SERVICES_TEXT - Text for Service Line

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

SALES_SERVICES_COND - Service Line Conditions

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

SALES_SERVICES_COST_ITEMS - Communication Fields: Sales Document Item With BOS & Costing

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

SALES_SERVICES_COST_MODEL - Communication Fields: Sales Document Item With BOS & Costing

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

SALES_SERVICES_MODEL_VAL - BOS ECP : Structure for Characteristic Value Assignment

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

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

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

SALES_ITEMS_INX - Checkbox Item Data

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

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_CFGS_REF - Configuration: Reference data

Data type: BAPICUCFG
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)

Copy and paste ABAP code example for BS01_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_part_of  TYPE STANDARD TABLE OF BAPICUPRT, "   
lv_costingvariant  TYPE ESLL-KLVAR, "   
lt_sales_cfgs_value  TYPE STANDARD TABLE OF BAPICUVAL, "   
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_contract_inx  TYPE STANDARD TABLE OF BAPICTRX, "   
lt_sales_items_in  TYPE STANDARD TABLE OF BAPISDITMBOS, "   
lv_sales_header_in  TYPE BAPISDHD1, "   
lt_extensionin  TYPE STANDARD TABLE OF BAPIPAREX, "   
lt_sales_services  TYPE STANDARD TABLE OF BAPISDESLLCBOS, "   
lt_sales_services_text  TYPE STANDARD TABLE OF BAPIESLLTX, "   
lt_sales_services_cond  TYPE STANDARD TABLE OF BAPIBOSCD, "   
lt_sales_services_cost_items  TYPE STANDARD TABLE OF BAPIBOSCOST, "   
lt_sales_services_cost_model  TYPE STANDARD TABLE OF BAPIBOSCOSTMODEL, "   
lt_sales_services_model_val  TYPE STANDARD TABLE OF BAPIBOSCOSTMODEL_CHARA_VALUE, "   
lt_partneraddresses  TYPE STANDARD TABLE OF BAPIADDR1, "   
lt_sales_items_inx  TYPE STANDARD TABLE OF BAPISDITMXBOS, "   
lv_sales_header_inx  TYPE BAPISDHD1X, "   
lv_sender  TYPE BAPI_SENDER, "   
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_cfgs_ref  TYPE STANDARD TABLE OF BAPICUCFG, "   
lv_business_object  TYPE BAPIUSW01-OBJTYPE, "   SPACE
lt_sales_cfgs_inst  TYPE STANDARD TABLE OF BAPICUINS. "   

  CALL FUNCTION 'BS01_SALESDOCUMENT_CREATE'  "Creation of a Sales Document with BOS
    EXPORTING
         SALESDOCUMENT = lv_salesdocument
         TESTRUN = lv_testrun
         COSTINGVARIANT = lv_costingvariant
         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
    TABLES
         RETURN = lt_return
         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_CONTRACT_INX = lt_sales_contract_inx
         SALES_ITEMS_IN = lt_sales_items_in
         EXTENSIONIN = lt_extensionin
         SALES_SERVICES = lt_sales_services
         SALES_SERVICES_TEXT = lt_sales_services_text
         SALES_SERVICES_COND = lt_sales_services_cond
         SALES_SERVICES_COST_ITEMS = lt_sales_services_cost_items
         SALES_SERVICES_COST_MODEL = lt_sales_services_cost_model
         SALES_SERVICES_MODEL_VAL = lt_sales_services_model_val
         PARTNERADDRESSES = lt_partneraddresses
         SALES_ITEMS_INX = lt_sales_items_inx
         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_CFGS_REF = lt_sales_cfgs_ref
         SALES_CFGS_INST = lt_sales_cfgs_inst
. " BS01_SALESDOCUMENT_CREATE




ABAP code using 7.40 inline data declarations to call FM BS01_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 KLVAR FROM ESLL INTO @DATA(ld_costingvariant).
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
"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!