SAP EXIT_SAPLHRTRV_STAT_002 Function Module for
EXIT_SAPLHRTRV_STAT_002 is a standard exit saplhrtrv stat 002 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 exit saplhrtrv stat 002 FM, simply by entering the name EXIT_SAPLHRTRV_STAT_002 into the relevant SAP transaction such as SE37 or SE38.
Function Group: XHRTRVSTAT
Program Name: SAPLXHRTRVSTAT
Main Program:
Appliation area: P
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:

Function EXIT_SAPLHRTRV_STAT_002 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 'EXIT_SAPLHRTRV_STAT_002'".
EXPORTING
PERSONNEL_NUMBER = "Personnel Number
DELETE_BEFORE_INSERT = "Delete Existing Data Before Insert?
BACKGROUND_TASK = "Background Task Processing ? 'X' = Yes
SIMULATION_RUN = "Test Run - No Database Changes ? 'X' = Yes
COMMIT_WORK = "Transmit COMMIT WORK in Function Module 'X' = Yes
TRIP_NUMBER = "Trip Number
TRIP_PERIOD = "Trip Period
TRIP_SCHEMA = "Trip Schema
UPDATE_TYPE = "Save Function 'I' = Insert ...
UPDATE_HEADER_DATA = "Calculate and Save Trip Totals ? 'X' = Yes
UPDATE_RECEIPT_DATA = "Edit Trip Receipts ? 'X' = Yes
UPDATE_ADD_RECEIPT_DATA = "Edit Additional Receipt Data ? 'X' = Yes
UPDATE_COST_DISTRIB_DATA = "Edit Cost Assignment Trip/Receipt ? 'X' = Yes
IMPORTING
RETURN = "Result of Call
TABLES
TRIP_SUMS = "
TRIP_RECEIPT_DATA = "Trip Receipts
TRIP_ADD_RECEIPT_DATA = "Additional Receipt Data
TRIP_COST_DISTRIB_DATA = "Receipt Cost Assignment
IMPORTING Parameters details for EXIT_SAPLHRTRV_STAT_002
PERSONNEL_NUMBER - Personnel Number
Data type: PTRV_HEAD-PERNROptional: No
Call by Reference: No ( called with pass by value option)
DELETE_BEFORE_INSERT - Delete Existing Data Before Insert?
Data type: XFELDOptional: No
Call by Reference: No ( called with pass by value option)
BACKGROUND_TASK - Background Task Processing ? 'X' = Yes
Data type: XFELDOptional: No
Call by Reference: No ( called with pass by value option)
SIMULATION_RUN - Test Run - No Database Changes ? 'X' = Yes
Data type: XFELDOptional: No
Call by Reference: No ( called with pass by value option)
COMMIT_WORK - Transmit COMMIT WORK in Function Module 'X' = Yes
Data type: XFELDOptional: No
Call by Reference: No ( called with pass by value option)
TRIP_NUMBER - Trip Number
Data type: PTRV_HEAD-REINROptional: No
Call by Reference: No ( called with pass by value option)
TRIP_PERIOD - Trip Period
Data type: PTRV_PERIO-PERIOOptional: No
Call by Reference: No ( called with pass by value option)
TRIP_SCHEMA - Trip Schema
Data type: PTRV_HEAD-SCHEMOptional: No
Call by Reference: No ( called with pass by value option)
UPDATE_TYPE - Save Function 'I' = Insert ...
Data type: PTRV_STATS_UPDATE_TYPEOptional: No
Call by Reference: No ( called with pass by value option)
UPDATE_HEADER_DATA - Calculate and Save Trip Totals ? 'X' = Yes
Data type: XFELDOptional: No
Call by Reference: No ( called with pass by value option)
UPDATE_RECEIPT_DATA - Edit Trip Receipts ? 'X' = Yes
Data type: XFELDOptional: No
Call by Reference: No ( called with pass by value option)
UPDATE_ADD_RECEIPT_DATA - Edit Additional Receipt Data ? 'X' = Yes
Data type: XFELDOptional: No
Call by Reference: No ( called with pass by value option)
UPDATE_COST_DISTRIB_DATA - Edit Cost Assignment Trip/Receipt ? 'X' = Yes
Data type: XFELDOptional: No
Call by Reference: No ( called with pass by value option)
EXPORTING Parameters details for EXIT_SAPLHRTRV_STAT_002
RETURN - Result of Call
Data type: BAPIRETURNOptional: No
Call by Reference: No ( called with pass by value option)
TABLES Parameters details for EXIT_SAPLHRTRV_STAT_002
TRIP_SUMS -
Data type: PTRV_SHDROptional: No
Call by Reference: No ( called with pass by value option)
TRIP_RECEIPT_DATA - Trip Receipts
Data type: PTRV_SRECOptional: No
Call by Reference: No ( called with pass by value option)
TRIP_ADD_RECEIPT_DATA - Additional Receipt Data
Data type: PTRV_SADDOptional: No
Call by Reference: No ( called with pass by value option)
TRIP_COST_DISTRIB_DATA - Receipt Cost Assignment
Data type: PTRV_SCOSOptional: No
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for EXIT_SAPLHRTRV_STAT_002 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 BAPIRETURN, " | |||
| lt_trip_sums | TYPE STANDARD TABLE OF PTRV_SHDR, " | |||
| lv_personnel_number | TYPE PTRV_HEAD-PERNR, " | |||
| lv_delete_before_insert | TYPE XFELD, " | |||
| lv_background_task | TYPE XFELD, " | |||
| lv_simulation_run | TYPE XFELD, " | |||
| lv_commit_work | TYPE XFELD, " | |||
| lv_trip_number | TYPE PTRV_HEAD-REINR, " | |||
| lt_trip_receipt_data | TYPE STANDARD TABLE OF PTRV_SREC, " | |||
| lv_trip_period | TYPE PTRV_PERIO-PERIO, " | |||
| lt_trip_add_receipt_data | TYPE STANDARD TABLE OF PTRV_SADD, " | |||
| lv_trip_schema | TYPE PTRV_HEAD-SCHEM, " | |||
| lt_trip_cost_distrib_data | TYPE STANDARD TABLE OF PTRV_SCOS, " | |||
| lv_update_type | TYPE PTRV_STATS_UPDATE_TYPE, " | |||
| lv_update_header_data | TYPE XFELD, " | |||
| lv_update_receipt_data | TYPE XFELD, " | |||
| lv_update_add_receipt_data | TYPE XFELD, " | |||
| lv_update_cost_distrib_data | TYPE XFELD. " |
|   CALL FUNCTION 'EXIT_SAPLHRTRV_STAT_002' " |
| EXPORTING | ||
| PERSONNEL_NUMBER | = lv_personnel_number | |
| DELETE_BEFORE_INSERT | = lv_delete_before_insert | |
| BACKGROUND_TASK | = lv_background_task | |
| SIMULATION_RUN | = lv_simulation_run | |
| COMMIT_WORK | = lv_commit_work | |
| TRIP_NUMBER | = lv_trip_number | |
| TRIP_PERIOD | = lv_trip_period | |
| TRIP_SCHEMA | = lv_trip_schema | |
| UPDATE_TYPE | = lv_update_type | |
| UPDATE_HEADER_DATA | = lv_update_header_data | |
| UPDATE_RECEIPT_DATA | = lv_update_receipt_data | |
| UPDATE_ADD_RECEIPT_DATA | = lv_update_add_receipt_data | |
| UPDATE_COST_DISTRIB_DATA | = lv_update_cost_distrib_data | |
| IMPORTING | ||
| RETURN | = lv_return | |
| TABLES | ||
| TRIP_SUMS | = lt_trip_sums | |
| TRIP_RECEIPT_DATA | = lt_trip_receipt_data | |
| TRIP_ADD_RECEIPT_DATA | = lt_trip_add_receipt_data | |
| TRIP_COST_DISTRIB_DATA | = lt_trip_cost_distrib_data | |
| . " EXIT_SAPLHRTRV_STAT_002 | ||
ABAP code using 7.40 inline data declarations to call FM EXIT_SAPLHRTRV_STAT_002
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 PERNR FROM PTRV_HEAD INTO @DATA(ld_personnel_number). | ||||
| "SELECT single REINR FROM PTRV_HEAD INTO @DATA(ld_trip_number). | ||||
| "SELECT single PERIO FROM PTRV_PERIO INTO @DATA(ld_trip_period). | ||||
| "SELECT single SCHEM FROM PTRV_HEAD INTO @DATA(ld_trip_schema). | ||||
Search for further information about these or an SAP related objects