SAP BAPI_TRIP_REPORT_CREATE Function Module for Create Simple Weekly Report (PR04)
BAPI_TRIP_REPORT_CREATE is a standard bapi trip report create SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Create Simple Weekly Report (PR04) 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 trip report create FM, simply by entering the name BAPI_TRIP_REPORT_CREATE into the relevant SAP transaction such as SE37 or SE38.
Function Group: HRTR
Program Name: SAPLHRTR
Main Program: SAPLHRTR
Appliation area: P
Release date: 09-Aug-1997
Mode(Normal, Remote etc): Remote-Enabled
Update:

Function BAPI_TRIP_REPORT_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 'BAPI_TRIP_REPORT_CREATE'"Create Simple Weekly Report (PR04).
EXPORTING
EMPLOYEENUMBER = "Employee's Personnel Number
STARTDATE = "Beginning Date of Weekly Report
* REASON = "General Trip Reason for Entire Week
* DESTINATION = "General Week Destination
* STATUS = "Trip Status To Be Set
* CHANGE = "Entries in Table AEND, Structure for BAPI Interface
IMPORTING
EMPLOYEENUMBER = "Employee's Personnel Number
TRIPNUMBER = "Trip Number Return Value
RETURN = "Return Value (Instead of Exceptions)
TABLES
WEEK = "Table for Week
* RECEIPTS = "Receipts for Week
* ADDINFO = "Additional Receipt Information
* ADVANCE = "Advance
* TEXT = "Text for Week
* RECEIPTS_JURCODES = "Tax Jurisdiction Codes for Receipts
* RECEIPTS_SERVICE_PROVIDER = "Structure for Service Provider for BAPI
Customer Function user exits
Below is a list of CUSTOMER FUNCTION exit user exits that are available within this program and maybe relevant for this FM.EXIT_SAPLHRTRV_STAT_001
EXIT_SAPLHRTRV_STAT_002
IMPORTING Parameters details for BAPI_TRIP_REPORT_CREATE
EMPLOYEENUMBER - Employee's Personnel Number
Data type: BAPIEMPL-PERNROptional: No
Call by Reference: No ( called with pass by value option)
STARTDATE - Beginning Date of Weekly Report
Data type: BAPITRIP-DEP_DATEOptional: No
Call by Reference: No ( called with pass by value option)
REASON - General Trip Reason for Entire Week
Data type: BAPITRWEEK-CUSTOMEROptional: Yes
Call by Reference: No ( called with pass by value option)
DESTINATION - General Week Destination
Data type: BAPITRWEEK-DAY_DESTOptional: Yes
Call by Reference: No ( called with pass by value option)
STATUS - Trip Status To Be Set
Data type: BAPITRVSTAOptional: Yes
Call by Reference: No ( called with pass by value option)
CHANGE - Entries in Table AEND, Structure for BAPI Interface
Data type: BAPITRVHISOptional: Yes
Call by Reference: No ( called with pass by value option)
EXPORTING Parameters details for BAPI_TRIP_REPORT_CREATE
EMPLOYEENUMBER - Employee's Personnel Number
Data type: BAPIEMPL-PERNROptional: No
Call by Reference: No ( called with pass by value option)
TRIPNUMBER - Trip Number Return Value
Data type: BAPITRIP-TRIPNOOptional: No
Call by Reference: No ( called with pass by value option)
RETURN - Return Value (Instead of Exceptions)
Data type: BAPIRETURNOptional: No
Call by Reference: No ( called with pass by value option)
TABLES Parameters details for BAPI_TRIP_REPORT_CREATE
WEEK - Table for Week
Data type: BAPITRWEEKOptional: No
Call by Reference: No ( called with pass by value option)
RECEIPTS - Receipts for Week
Data type: BAPITRVRECOptional: Yes
Call by Reference: No ( called with pass by value option)
ADDINFO - Additional Receipt Information
Data type: BAPITRADDIOptional: Yes
Call by Reference: No ( called with pass by value option)
ADVANCE - Advance
Data type: BAPITRVSCHOptional: Yes
Call by Reference: Yes
TEXT - Text for Week
Data type: BAPITRTEXTOptional: Yes
Call by Reference: No ( called with pass by value option)
RECEIPTS_JURCODES - Tax Jurisdiction Codes for Receipts
Data type: BAPIJURCODEOptional: Yes
Call by Reference: Yes
RECEIPTS_SERVICE_PROVIDER - Structure for Service Provider for BAPI
Data type: BAPIRECPAYOTOptional: Yes
Call by Reference: Yes
Copy and paste ABAP code example for BAPI_TRIP_REPORT_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: | ||||
| lt_week | TYPE STANDARD TABLE OF BAPITRWEEK, " | |||
| lv_employeenumber | TYPE BAPIEMPL-PERNR, " | |||
| lv_employeenumber | TYPE BAPIEMPL-PERNR, " | |||
| lt_receipts | TYPE STANDARD TABLE OF BAPITRVREC, " | |||
| lv_startdate | TYPE BAPITRIP-DEP_DATE, " | |||
| lv_tripnumber | TYPE BAPITRIP-TRIPNO, " | |||
| lv_reason | TYPE BAPITRWEEK-CUSTOMER, " | |||
| lv_return | TYPE BAPIRETURN, " | |||
| lt_addinfo | TYPE STANDARD TABLE OF BAPITRADDI, " | |||
| lt_advance | TYPE STANDARD TABLE OF BAPITRVSCH, " | |||
| lv_destination | TYPE BAPITRWEEK-DAY_DEST, " | |||
| lt_text | TYPE STANDARD TABLE OF BAPITRTEXT, " | |||
| lv_status | TYPE BAPITRVSTA, " | |||
| lv_change | TYPE BAPITRVHIS, " | |||
| lt_receipts_jurcodes | TYPE STANDARD TABLE OF BAPIJURCODE, " | |||
| lt_receipts_service_provider | TYPE STANDARD TABLE OF BAPIRECPAYOT. " |
|   CALL FUNCTION 'BAPI_TRIP_REPORT_CREATE' "Create Simple Weekly Report (PR04) |
| EXPORTING | ||
| EMPLOYEENUMBER | = lv_employeenumber | |
| STARTDATE | = lv_startdate | |
| REASON | = lv_reason | |
| DESTINATION | = lv_destination | |
| STATUS | = lv_status | |
| CHANGE | = lv_change | |
| IMPORTING | ||
| EMPLOYEENUMBER | = lv_employeenumber | |
| TRIPNUMBER | = lv_tripnumber | |
| RETURN | = lv_return | |
| TABLES | ||
| WEEK | = lt_week | |
| RECEIPTS | = lt_receipts | |
| ADDINFO | = lt_addinfo | |
| ADVANCE | = lt_advance | |
| TEXT | = lt_text | |
| RECEIPTS_JURCODES | = lt_receipts_jurcodes | |
| RECEIPTS_SERVICE_PROVIDER | = lt_receipts_service_provider | |
| . " BAPI_TRIP_REPORT_CREATE | ||
ABAP code using 7.40 inline data declarations to call FM BAPI_TRIP_REPORT_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 PERNR FROM BAPIEMPL INTO @DATA(ld_employeenumber). | ||||
| "SELECT single PERNR FROM BAPIEMPL INTO @DATA(ld_employeenumber). | ||||
| "SELECT single DEP_DATE FROM BAPITRIP INTO @DATA(ld_startdate). | ||||
| "SELECT single TRIPNO FROM BAPITRIP INTO @DATA(ld_tripnumber). | ||||
| "SELECT single CUSTOMER FROM BAPITRWEEK INTO @DATA(ld_reason). | ||||
| "SELECT single DAY_DEST FROM BAPITRWEEK INTO @DATA(ld_destination). | ||||
Search for further information about these or an SAP related objects