SAP SRM_DOCUMENT_CREATE Function Module for
SRM_DOCUMENT_CREATE is a standard srm 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 to perform a specific ABAP function and below is the pattern details, 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 srm document create FM, simply by entering the name SRM_DOCUMENT_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: N/A
Mode(Normal, Remote etc): Remote-Enabled
Update:

Function SRM_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 'SRM_DOCUMENT_CREATE'".
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
* DOC_CONTEXT = "
* DOCUMENTID_CHECK_UNIQUE = 'X' "
IMPORTING
RETURN = "Return Code
OBJECTID = "Internal ID of New Document
DOCUMENTCLASS = "Storage Location of New Record (Content Model)
TABLES
* REQUIRED_PROPERTIES = "
EXCEPTIONS
INTERNAL_ERROR = 1 PARAMETER_ERROR = 2 DOC_ID_NOT_UNIQUE = 3 NOT_AUTHORIZED = 4 CUSTOMIZING_ERROR = 5
IMPORTING Parameters details for SRM_DOCUMENT_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)
DOC_CONTEXT -
Data type: BAPIDOCCONTEXTOptional: Yes
Call by Reference: No ( called with pass by value option)
DOCUMENTID_CHECK_UNIQUE -
Data type: BAPISRMDOC-BOOLEANDefault: 'X'
Optional: Yes
Call by Reference: No ( called with pass by value option)
EXPORTING Parameters details for SRM_DOCUMENT_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 - Storage Location of New Record (Content Model)
Data type: BAPISRMDOC-DOCCLASSOptional: No
Call by Reference: No ( called with pass by value option)
TABLES Parameters details for SRM_DOCUMENT_CREATE
REQUIRED_PROPERTIES -
Data type: BAPIPROPERTYTABOptional: Yes
Call by Reference: Yes
EXCEPTIONS details
INTERNAL_ERROR - Internal Error
Data type:Optional: No
Call by Reference: Yes
PARAMETER_ERROR - Parameter error
Data type:Optional: No
Call by Reference: Yes
DOC_ID_NOT_UNIQUE - Document ID Not Unique
Data type:Optional: No
Call by Reference: Yes
NOT_AUTHORIZED - No Authorization
Data type:Optional: No
Call by Reference: Yes
CUSTOMIZING_ERROR -
Data type:Optional: No
Call by Reference: Yes
Copy and paste ABAP code example for SRM_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: | ||||
| lv_return | TYPE BAPIRET2, " | |||
| lv_rms_id | TYPE BAPISRMDOC-RMSID, " | |||
| lv_internal_error | TYPE BAPISRMDOC, " | |||
| lt_required_properties | TYPE STANDARD TABLE OF BAPIPROPERTYTAB, " | |||
| lv_sps_id | TYPE BAPISRMDOC-SPSID, " | |||
| lv_objectid | TYPE BAPISRMDOC-GUID, " | |||
| lv_parameter_error | TYPE BAPISRMDOC, " | |||
| lv_documentid | TYPE BAPISRMDOC-DOCID, " | |||
| lv_documentclass | TYPE BAPISRMDOC-DOCCLASS, " | |||
| lv_doc_id_not_unique | TYPE BAPISRMDOC, " | |||
| lv_description | TYPE BAPISRMDOC-DESCR, " | |||
| lv_not_authorized | TYPE BAPISRMDOC, " | |||
| lv_do_commit | TYPE BAPISRMDOC-BOOLEAN, " | |||
| lv_customizing_error | TYPE BAPISRMDOC, " | |||
| lv_doc_context | TYPE BAPIDOCCONTEXT, " | |||
| lv_documentid_check_unique | TYPE BAPISRMDOC-BOOLEAN. " 'X' |
|   CALL FUNCTION 'SRM_DOCUMENT_CREATE' " |
| EXPORTING | ||
| RMS_ID | = lv_rms_id | |
| SPS_ID | = lv_sps_id | |
| DOCUMENTID | = lv_documentid | |
| DESCRIPTION | = lv_description | |
| DO_COMMIT | = lv_do_commit | |
| DOC_CONTEXT | = lv_doc_context | |
| DOCUMENTID_CHECK_UNIQUE | = lv_documentid_check_unique | |
| IMPORTING | ||
| RETURN | = lv_return | |
| OBJECTID | = lv_objectid | |
| DOCUMENTCLASS | = lv_documentclass | |
| TABLES | ||
| REQUIRED_PROPERTIES | = lt_required_properties | |
| EXCEPTIONS | ||
| INTERNAL_ERROR = 1 | ||
| PARAMETER_ERROR = 2 | ||
| DOC_ID_NOT_UNIQUE = 3 | ||
| NOT_AUTHORIZED = 4 | ||
| CUSTOMIZING_ERROR = 5 | ||
| . " SRM_DOCUMENT_CREATE | ||
ABAP code using 7.40 inline data declarations to call FM SRM_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 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