SAP PRELIMINARY_POSTING_DOC_DELETE Function Module for Delete a parked document and update BKPF
PRELIMINARY_POSTING_DOC_DELETE is a standard preliminary posting doc delete SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Delete a parked document and update BKPF 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 preliminary posting doc delete FM, simply by entering the name PRELIMINARY_POSTING_DOC_DELETE into the relevant SAP transaction such as SE37 or SE38.
Function Group: F042
Program Name: SAPLF042
Main Program: SAPLF042
Appliation area:
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update: 1

Function PRELIMINARY_POSTING_DOC_DELETE 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 'PRELIMINARY_POSTING_DOC_DELETE'"Delete a parked document and update BKPF.
EXPORTING
* BELNN = ' ' "Document number of the new document (change document number)
BELNR = "Document number
* BSTAT = ' ' "BSTAT of BKPF record / If=' ', no update
BUKRS = "Company code
* GJAHN = 0 "Fiscal year of the new document
GJAHR = "Fiscal year
* NO_BSIP = "
* SPLIT_DATA = "
EXCEPTIONS
DOCUMENT_NOT_FOUND = 1 UPDATE_ERROR = 2
IMPORTING Parameters details for PRELIMINARY_POSTING_DOC_DELETE
BELNN - Document number of the new document (change document number)
Data type: VBKPF-BELNRDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
BELNR - Document number
Data type: VBKPF-BELNROptional: No
Call by Reference: No ( called with pass by value option)
BSTAT - BSTAT of BKPF record / If=SPACE, no update
Data type: VBKPF-BSTATDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
BUKRS - Company code
Data type: VBKPF-BUKRSOptional: No
Call by Reference: No ( called with pass by value option)
GJAHN - Fiscal year of the new document
Data type: VBKPF-GJAHROptional: Yes
Call by Reference: No ( called with pass by value option)
GJAHR - Fiscal year
Data type: VBKPF-GJAHROptional: No
Call by Reference: No ( called with pass by value option)
NO_BSIP -
Data type: XFELDOptional: Yes
Call by Reference: No ( called with pass by value option)
SPLIT_DATA -
Data type: XFELDOptional: Yes
Call by Reference: No ( called with pass by value option)
EXCEPTIONS details
DOCUMENT_NOT_FOUND - Document not found
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
UPDATE_ERROR - Error during update of BKPF
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for PRELIMINARY_POSTING_DOC_DELETE 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_belnn | TYPE VBKPF-BELNR, " SPACE | |||
| lv_document_not_found | TYPE VBKPF, " | |||
| lv_belnr | TYPE VBKPF-BELNR, " | |||
| lv_update_error | TYPE VBKPF, " | |||
| lv_bstat | TYPE VBKPF-BSTAT, " SPACE | |||
| lv_bukrs | TYPE VBKPF-BUKRS, " | |||
| lv_gjahn | TYPE VBKPF-GJAHR, " 0 | |||
| lv_gjahr | TYPE VBKPF-GJAHR, " | |||
| lv_no_bsip | TYPE XFELD, " | |||
| lv_split_data | TYPE XFELD. " |
|   CALL FUNCTION 'PRELIMINARY_POSTING_DOC_DELETE' "Delete a parked document and update BKPF |
| EXPORTING | ||
| BELNN | = lv_belnn | |
| BELNR | = lv_belnr | |
| BSTAT | = lv_bstat | |
| BUKRS | = lv_bukrs | |
| GJAHN | = lv_gjahn | |
| GJAHR | = lv_gjahr | |
| NO_BSIP | = lv_no_bsip | |
| SPLIT_DATA | = lv_split_data | |
| EXCEPTIONS | ||
| DOCUMENT_NOT_FOUND = 1 | ||
| UPDATE_ERROR = 2 | ||
| . " PRELIMINARY_POSTING_DOC_DELETE | ||
ABAP code using 7.40 inline data declarations to call FM PRELIMINARY_POSTING_DOC_DELETE
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 BELNR FROM VBKPF INTO @DATA(ld_belnn). | ||||
| DATA(ld_belnn) | = ' '. | |||
| "SELECT single BELNR FROM VBKPF INTO @DATA(ld_belnr). | ||||
| "SELECT single BSTAT FROM VBKPF INTO @DATA(ld_bstat). | ||||
| DATA(ld_bstat) | = ' '. | |||
| "SELECT single BUKRS FROM VBKPF INTO @DATA(ld_bukrs). | ||||
| "SELECT single GJAHR FROM VBKPF INTO @DATA(ld_gjahn). | ||||
| "SELECT single GJAHR FROM VBKPF INTO @DATA(ld_gjahr). | ||||
Search for further information about these or an SAP related objects