SAP BAPI_SRM_DOC_CREATE Function Module for SRM BAPI: Create Document
BAPI_SRM_DOC_CREATE is a standard bapi srm doc 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 SRM BAPI: Create 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 bapi srm doc create FM, simply by entering the name BAPI_SRM_DOC_CREATE into the relevant SAP transaction such as SE37 or SE38.
Function Group: SRM_BAPI_DOCUMENT
Program Name: SAPLSRM_BAPI_DOCUMENT
Main Program: SAPLSRM_BAPI_DOCUMENT
Appliation area:
Release date: 19-Aug-2002
Mode(Normal, Remote etc): Remote-Enabled
Update:

Function BAPI_SRM_DOC_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 'BAPI_SRM_DOC_CREATE'"SRM BAPI: Create Document.
EXPORTING
RMS_ID = "Records Management System ID
SPS_ID = "Element Type for Document to Be Created
DOCUMENTID = "Unique Name for Document to Be Created
DESCRIPTION = "Description, Does Not Have To Be Unique
* DO_COMMIT = "'X': Execute Commit
* DOCUMENTID_CHECK_UNIQUE = 'X' "Check uniqueness of name for new document
IMPORTING
RETURN = "Return Code
OBJECTID = "Internal ID of New Document
DOCUMENTCLASS = "Location of New Document (Content Model)
TABLES
* REQUIRED_PROPERTIES = "Mandatory fields must be filled when creating the document
IMPORTING Parameters details for BAPI_SRM_DOC_CREATE
RMS_ID - Records Management System ID
Data type: BAPISRMDOC-RMSIDOptional: No
Call by Reference: No ( called with pass by value option)
SPS_ID - Element Type for Document to Be Created
Data type: BAPISRMDOC-SPSIDOptional: No
Call by Reference: No ( called with pass by value option)
DOCUMENTID - Unique Name for Document to Be Created
Data type: BAPISRMDOC-DOCIDOptional: No
Call by Reference: No ( called with pass by value option)
DESCRIPTION - Description, Does Not Have To Be Unique
Data type: BAPISRMDOC-DESCROptional: No
Call by Reference: No ( called with pass by value option)
DO_COMMIT - 'X': Execute Commit
Data type: BAPISRMDOC-BOOLEANOptional: Yes
Call by Reference: No ( called with pass by value option)
DOCUMENTID_CHECK_UNIQUE - Check uniqueness of name for new document
Data type: BAPISRMDOC-BOOLEANDefault: 'X'
Optional: Yes
Call by Reference: No ( called with pass by value option)
EXPORTING Parameters details for BAPI_SRM_DOC_CREATE
RETURN - Return Code
Data type: BAPIRET2Optional: No
Call by Reference: No ( called with pass by value option)
OBJECTID - Internal ID of New Document
Data type: BAPISRMDOC-GUIDOptional: No
Call by Reference: No ( called with pass by value option)
DOCUMENTCLASS - Location of New Document (Content Model)
Data type: BAPISRMDOC-DOCCLASSOptional: No
Call by Reference: No ( called with pass by value option)
TABLES Parameters details for BAPI_SRM_DOC_CREATE
REQUIRED_PROPERTIES - Mandatory fields must be filled when creating the document
Data type: BAPIPROPERTYTABOptional: Yes
Call by Reference: Yes
Copy and paste ABAP code example for BAPI_SRM_DOC_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: | ||||
| lv_return | TYPE BAPIRET2, " | |||
| lv_rms_id | TYPE BAPISRMDOC-RMSID, " | |||
| lt_required_properties | TYPE STANDARD TABLE OF BAPIPROPERTYTAB, " | |||
| lv_sps_id | TYPE BAPISRMDOC-SPSID, " | |||
| lv_objectid | TYPE BAPISRMDOC-GUID, " | |||
| lv_documentid | TYPE BAPISRMDOC-DOCID, " | |||
| lv_documentclass | TYPE BAPISRMDOC-DOCCLASS, " | |||
| lv_description | TYPE BAPISRMDOC-DESCR, " | |||
| lv_do_commit | TYPE BAPISRMDOC-BOOLEAN, " | |||
| lv_documentid_check_unique | TYPE BAPISRMDOC-BOOLEAN. " 'X' |
|   CALL FUNCTION 'BAPI_SRM_DOC_CREATE' "SRM BAPI: Create Document |
| EXPORTING | ||
| RMS_ID | = lv_rms_id | |
| SPS_ID | = lv_sps_id | |
| DOCUMENTID | = lv_documentid | |
| DESCRIPTION | = lv_description | |
| DO_COMMIT | = lv_do_commit | |
| DOCUMENTID_CHECK_UNIQUE | = lv_documentid_check_unique | |
| IMPORTING | ||
| RETURN | = lv_return | |
| OBJECTID | = lv_objectid | |
| DOCUMENTCLASS | = lv_documentclass | |
| TABLES | ||
| REQUIRED_PROPERTIES | = lt_required_properties | |
| . " BAPI_SRM_DOC_CREATE | ||
ABAP code using 7.40 inline data declarations to call FM BAPI_SRM_DOC_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 RMSID FROM BAPISRMDOC INTO @DATA(ld_rms_id). | ||||
| "SELECT single SPSID FROM BAPISRMDOC INTO @DATA(ld_sps_id). | ||||
| "SELECT single GUID FROM BAPISRMDOC INTO @DATA(ld_objectid). | ||||
| "SELECT single DOCID FROM BAPISRMDOC INTO @DATA(ld_documentid). | ||||
| "SELECT single DOCCLASS FROM BAPISRMDOC INTO @DATA(ld_documentclass). | ||||
| "SELECT single DESCR FROM BAPISRMDOC INTO @DATA(ld_description). | ||||
| "SELECT single BOOLEAN FROM BAPISRMDOC INTO @DATA(ld_do_commit). | ||||
| "SELECT single BOOLEAN FROM BAPISRMDOC INTO @DATA(ld_documentid_check_unique). | ||||
| DATA(ld_documentid_check_unique) | = 'X'. | |||
Search for further information about these or an SAP related objects