SAP BAPI_PRF_GET_EXISTING_DATA Function Module for FM to get existing data for a Document
BAPI_PRF_GET_EXISTING_DATA is a standard bapi prf get existing data SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for FM to get existing data for a 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 prf get existing data FM, simply by entering the name BAPI_PRF_GET_EXISTING_DATA into the relevant SAP transaction such as SE37 or SE38.
Function Group: PRF_BAPI_SERVICES_GRP
Program Name: SAPLPRF_BAPI_SERVICES_GRP
Main Program: SAPLPRF_BAPI_SERVICES_GRP
Appliation area:
Release date: 02-Aug-2016
Mode(Normal, Remote etc): Remote-Enabled
Update:

Function BAPI_PRF_GET_EXISTING_DATA 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_PRF_GET_EXISTING_DATA'"FM to get existing data for a Document.
EXPORTING
SOURCEDOCTYPE = "Regime Document type
DOCNUMBER = "Regime Document reference number
IMPORTING
HEADERKEY = "Guid for unique identification of PRF Record
TABLES
* HEADERS = "BAPI structure for PRF Header
* ITEMS = "BAPI structure for PRF Item
RETURN = "Return Parameter
* HEADERSB = "BAPI structure for PRF Header
IMPORTING Parameters details for BAPI_PRF_GET_EXISTING_DATA
SOURCEDOCTYPE - Regime Document type
Data type: BAPI_PRF_S_HDR-SRC_DOC_TYPOptional: No
Call by Reference: No ( called with pass by value option)
DOCNUMBER - Regime Document reference number
Data type: BAPI_PRF_S_HDR-DOC_NOOptional: No
Call by Reference: No ( called with pass by value option)
EXPORTING Parameters details for BAPI_PRF_GET_EXISTING_DATA
HEADERKEY - Guid for unique identification of PRF Record
Data type: BAPI_PRF_S_HDR-HEADER_KEYOptional: No
Call by Reference: No ( called with pass by value option)
TABLES Parameters details for BAPI_PRF_GET_EXISTING_DATA
HEADERS - BAPI structure for PRF Header
Data type: BAPI_PRF_S_HDROptional: Yes
Call by Reference: Yes
ITEMS - BAPI structure for PRF Item
Data type: BAPI_PRF_S_DATA_TRANSFER_STRUCOptional: Yes
Call by Reference: Yes
RETURN - Return Parameter
Data type: BAPIRET2Optional: No
Call by Reference: Yes
HEADERSB - BAPI structure for PRF Header
Data type: BAPI_PRF_S_DATA_TRANSFER_STRUCOptional: Yes
Call by Reference: Yes
Copy and paste ABAP code example for BAPI_PRF_GET_EXISTING_DATA 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_headers | TYPE STANDARD TABLE OF BAPI_PRF_S_HDR, " | |||
| lv_headerkey | TYPE BAPI_PRF_S_HDR-HEADER_KEY, " | |||
| lv_sourcedoctype | TYPE BAPI_PRF_S_HDR-SRC_DOC_TYP, " | |||
| lt_items | TYPE STANDARD TABLE OF BAPI_PRF_S_DATA_TRANSFER_STRUC, " | |||
| lv_docnumber | TYPE BAPI_PRF_S_HDR-DOC_NO, " | |||
| lt_return | TYPE STANDARD TABLE OF BAPIRET2, " | |||
| lt_headersb | TYPE STANDARD TABLE OF BAPI_PRF_S_DATA_TRANSFER_STRUC. " |
|   CALL FUNCTION 'BAPI_PRF_GET_EXISTING_DATA' "FM to get existing data for a Document |
| EXPORTING | ||
| SOURCEDOCTYPE | = lv_sourcedoctype | |
| DOCNUMBER | = lv_docnumber | |
| IMPORTING | ||
| HEADERKEY | = lv_headerkey | |
| TABLES | ||
| HEADERS | = lt_headers | |
| ITEMS | = lt_items | |
| RETURN | = lt_return | |
| HEADERSB | = lt_headersb | |
| . " BAPI_PRF_GET_EXISTING_DATA | ||
ABAP code using 7.40 inline data declarations to call FM BAPI_PRF_GET_EXISTING_DATA
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 HEADER_KEY FROM BAPI_PRF_S_HDR INTO @DATA(ld_headerkey). | ||||
| "SELECT single SRC_DOC_TYP FROM BAPI_PRF_S_HDR INTO @DATA(ld_sourcedoctype). | ||||
| "SELECT single DOC_NO FROM BAPI_PRF_S_HDR INTO @DATA(ld_docnumber). | ||||
Search for further information about these or an SAP related objects