SAP IDOC_STATUS_WRITE_TO_DATABASE Function Module for Writes one or more status records for an IDoc
IDOC_STATUS_WRITE_TO_DATABASE is a standard idoc status write to database SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Writes one or more status records for an IDoc 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 idoc status write to database FM, simply by entering the name IDOC_STATUS_WRITE_TO_DATABASE into the relevant SAP transaction such as SE37 or SE38.
Function Group: BD15
Program Name: SAPLBD15
Main Program: SAPLBD15
Appliation area: S
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:

Function IDOC_STATUS_WRITE_TO_DATABASE 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 'IDOC_STATUS_WRITE_TO_DATABASE'"Writes one or more status records for an IDoc.
EXPORTING
IDOC_NUMBER = "
* IDOC_OPENED_FLAG = ' ' "
* NO_DEQUEUE_FLAG = 'X' "
IMPORTING
IDOC_CONTROL = "
TABLES
IDOC_STATUS = "
EXCEPTIONS
IDOC_FOREIGN_LOCK = 1 IDOC_NOT_FOUND = 2 IDOC_STATUS_RECORDS_EMPTY = 3 IDOC_STATUS_INVALID = 4 DB_ERROR = 5
IMPORTING Parameters details for IDOC_STATUS_WRITE_TO_DATABASE
IDOC_NUMBER -
Data type: EDIDC-DOCNUMOptional: No
Call by Reference: No ( called with pass by value option)
IDOC_OPENED_FLAG -
Data type: BD11_FLAGDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
NO_DEQUEUE_FLAG -
Data type: BD11_FLAGDefault: 'X'
Optional: Yes
Call by Reference: No ( called with pass by value option)
EXPORTING Parameters details for IDOC_STATUS_WRITE_TO_DATABASE
IDOC_CONTROL -
Data type: EDIDCOptional: No
Call by Reference: No ( called with pass by value option)
TABLES Parameters details for IDOC_STATUS_WRITE_TO_DATABASE
IDOC_STATUS -
Data type: BDIDOCSTATOptional: No
Call by Reference: No ( called with pass by value option)
EXCEPTIONS details
IDOC_FOREIGN_LOCK -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
IDOC_NOT_FOUND -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
IDOC_STATUS_RECORDS_EMPTY -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
IDOC_STATUS_INVALID -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
DB_ERROR -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for IDOC_STATUS_WRITE_TO_DATABASE 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_idoc_number | TYPE EDIDC-DOCNUM, " | |||
| lt_idoc_status | TYPE STANDARD TABLE OF BDIDOCSTAT, " | |||
| lv_idoc_control | TYPE EDIDC, " | |||
| lv_idoc_foreign_lock | TYPE EDIDC, " | |||
| lv_idoc_not_found | TYPE EDIDC, " | |||
| lv_idoc_opened_flag | TYPE BD11_FLAG, " SPACE | |||
| lv_no_dequeue_flag | TYPE BD11_FLAG, " 'X' | |||
| lv_idoc_status_records_empty | TYPE BD11_FLAG, " | |||
| lv_idoc_status_invalid | TYPE BD11_FLAG, " | |||
| lv_db_error | TYPE BD11_FLAG. " |
|   CALL FUNCTION 'IDOC_STATUS_WRITE_TO_DATABASE' "Writes one or more status records for an IDoc |
| EXPORTING | ||
| IDOC_NUMBER | = lv_idoc_number | |
| IDOC_OPENED_FLAG | = lv_idoc_opened_flag | |
| NO_DEQUEUE_FLAG | = lv_no_dequeue_flag | |
| IMPORTING | ||
| IDOC_CONTROL | = lv_idoc_control | |
| TABLES | ||
| IDOC_STATUS | = lt_idoc_status | |
| EXCEPTIONS | ||
| IDOC_FOREIGN_LOCK = 1 | ||
| IDOC_NOT_FOUND = 2 | ||
| IDOC_STATUS_RECORDS_EMPTY = 3 | ||
| IDOC_STATUS_INVALID = 4 | ||
| DB_ERROR = 5 | ||
| . " IDOC_STATUS_WRITE_TO_DATABASE | ||
ABAP code using 7.40 inline data declarations to call FM IDOC_STATUS_WRITE_TO_DATABASE
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 DOCNUM FROM EDIDC INTO @DATA(ld_idoc_number). | ||||
| DATA(ld_idoc_opened_flag) | = ' '. | |||
| DATA(ld_no_dequeue_flag) | = 'X'. | |||
Search for further information about these or an SAP related objects