SAP BS01_PURCHASE_DOCUMENT_CREATE Function Module for Purchase Document Creation









BS01_PURCHASE_DOCUMENT_CREATE is a standard bs01 purchase document 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 Purchase Document Creation 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 purchase document create FM, simply by entering the name BS01_PURCHASE_DOCUMENT_CREATE into the relevant SAP transaction such as SE37 or SE38.

Function Group: BOS04
Program Name: SAPLBOS04
Main Program: SAPLBOS04
Appliation area: M
Release date: 25-Jun-2001
Mode(Normal, Remote etc): Remote-Enabled
Update:



Function BS01_PURCHASE_DOCUMENT_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_PURCHASE_DOCUMENT_CREATE'"Purchase Document Creation
EXPORTING
DOC_HEADER = "Order header data
* DOC_ADDRESS = "Ordering Address for One-Time Vendor
* SKIP_ITEMS_WITH_ERROR = 'X' "Indicator: Skip faulty items
DOCUMENT_CATEGORY = "

IMPORTING
PURCHASEORDER = "Purchase Order Number

TABLES
DOC_ITEMS = "Table of PO Items
* DOC_SERVICES_TEXT = "Text for Service Line
* EXTENSIONIN = "Customer Enhancment Import
DOC_ITEM_SCHEDULES = "Table of Schedule Lines
* DOC_ITEM_ACCOUNT_ASSIGNMENT = "Table of Account Assignments
* DOC_ITEM_TEXT = "Table of Item Texts
* RETURN = "Confirmations
* DOC_LIMITS = "Limits
* DOC_CONTRACT_LIMITS = "Limits with Contract Reference
* DOC_SERVICES = "Services
* DOC_SRV_ACCASS_VALUES = "Value/link to service account assignment
.



IMPORTING Parameters details for BS01_PURCHASE_DOCUMENT_CREATE

DOC_HEADER - Order header data

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

DOC_ADDRESS - Ordering Address for One-Time Vendor

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

SKIP_ITEMS_WITH_ERROR - Indicator: Skip faulty items

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

DOCUMENT_CATEGORY -

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

EXPORTING Parameters details for BS01_PURCHASE_DOCUMENT_CREATE

PURCHASEORDER - Purchase Order Number

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

TABLES Parameters details for BS01_PURCHASE_DOCUMENT_CREATE

DOC_ITEMS - Table of PO Items

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

DOC_SERVICES_TEXT - Text for Service Line

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

DOC_ITEM_SCHEDULES - Table of Schedule Lines

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

DOC_ITEM_ACCOUNT_ASSIGNMENT - Table of Account Assignments

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

DOC_ITEM_TEXT - Table of Item Texts

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

RETURN - Confirmations

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

DOC_LIMITS - Limits

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

DOC_CONTRACT_LIMITS - Limits with Contract Reference

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

DOC_SERVICES - Services

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

DOC_SRV_ACCASS_VALUES - Value/link to service account assignment

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

Copy and paste ABAP code example for BS01_PURCHASE_DOCUMENT_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_doc_items  TYPE STANDARD TABLE OF BS01MMITEM, "   
lv_doc_header  TYPE BS01MMHEAD, "   
lv_purchaseorder  TYPE BAPIEKKOC-PO_NUMBER, "   
lt_doc_services_text  TYPE STANDARD TABLE OF BAPIESLLTX, "   
lt_extensionin  TYPE STANDARD TABLE OF BAPIPAREX, "   
lv_doc_address  TYPE BAPIADDRESS, "   
lt_doc_item_schedules  TYPE STANDARD TABLE OF BS01MMSCHEDULE, "   
lv_skip_items_with_error  TYPE BAPIMMPARA-SELECTION, "   'X'
lt_doc_item_account_assignment  TYPE STANDARD TABLE OF BAPIEKKN, "   
lt_doc_item_text  TYPE STANDARD TABLE OF BS01MMITEMTX, "   
lv_document_category  TYPE BS01MMHEAD-DOC_CAT, "   
lt_return  TYPE STANDARD TABLE OF BAPIRET2, "   
lt_doc_limits  TYPE STANDARD TABLE OF BAPIESUHC, "   
lt_doc_contract_limits  TYPE STANDARD TABLE OF BAPIESUCC, "   
lt_doc_services  TYPE STANDARD TABLE OF BSMMESLLC, "   
lt_doc_srv_accass_values  TYPE STANDARD TABLE OF BAPIESKLC. "   

  CALL FUNCTION 'BS01_PURCHASE_DOCUMENT_CREATE'  "Purchase Document Creation
    EXPORTING
         DOC_HEADER = lv_doc_header
         DOC_ADDRESS = lv_doc_address
         SKIP_ITEMS_WITH_ERROR = lv_skip_items_with_error
         DOCUMENT_CATEGORY = lv_document_category
    IMPORTING
         PURCHASEORDER = lv_purchaseorder
    TABLES
         DOC_ITEMS = lt_doc_items
         DOC_SERVICES_TEXT = lt_doc_services_text
         EXTENSIONIN = lt_extensionin
         DOC_ITEM_SCHEDULES = lt_doc_item_schedules
         DOC_ITEM_ACCOUNT_ASSIGNMENT = lt_doc_item_account_assignment
         DOC_ITEM_TEXT = lt_doc_item_text
         RETURN = lt_return
         DOC_LIMITS = lt_doc_limits
         DOC_CONTRACT_LIMITS = lt_doc_contract_limits
         DOC_SERVICES = lt_doc_services
         DOC_SRV_ACCASS_VALUES = lt_doc_srv_accass_values
. " BS01_PURCHASE_DOCUMENT_CREATE




ABAP code using 7.40 inline data declarations to call FM BS01_PURCHASE_DOCUMENT_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 PO_NUMBER FROM BAPIEKKOC INTO @DATA(ld_purchaseorder).
 
 
 
 
 
"SELECT single SELECTION FROM BAPIMMPARA INTO @DATA(ld_skip_items_with_error).
DATA(ld_skip_items_with_error) = 'X'.
 
 
 
"SELECT single DOC_CAT FROM BS01MMHEAD INTO @DATA(ld_document_category).
 
 
 
 
 
 


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!