SAP BAPI_TRIP_CREATE_FROM_DATA Function Module for Create Employee Trip with CallTransaction on PR01
BAPI_TRIP_CREATE_FROM_DATA is a standard bapi trip create from 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 Create Employee Trip with CallTransaction on PR01 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 create from data FM, simply by entering the name BAPI_TRIP_CREATE_FROM_DATA 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_CREATE_FROM_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_TRIP_CREATE_FROM_DATA'"Create Employee Trip with CallTransaction on PR01.
EXPORTING
EMPLOYEENUMBER = "Employee's Personnel Number
FRAMEDATA = "General Trip Data
* STATUS = "Trip Status
* BATCH_SESSION_NAME = "
* CHANGE = "Entries in Table AEND, Structure for BAPI Interface
* BATCH_INPUT_ONLY = "Checkbox
IMPORTING
RETURN = "Return Value (Instead of Exceptions)
EMPLOYEENUMBER = "Employee's Personnel Number
TRIPNUMBER = "Trip Number
TABLES
* RECEIPTS = "Receipts
* COSTDIST_STOP = "Cost Distribution for Stopovers
* COSTDIST_RECE = "Cost Distribution for Receipts
* COSTDIST_MILE = "Cost Distribution for Miles/Kms Distribution
* RECEIPTS_JURCODES = "Tax Jurisdiction Codes for the Receipts
* RECEIPTS_SERVICE_PROVIDER = "Structure for Service Provider for BAPI
* ADDINFO = "Additional Receipt Information
* ADVANCE = "Advance
* TEXT = "Trip Text
* MILEAGE = "Miles/Km Distribution
* STOPOVER = "Stopovers
* DEDUCTIONS = "Deductions
* TRANSPORT = "Local Public Transport, Journey
* COSTDIST_TRIP = "Cost Distribution for Entire Trip
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_CREATE_FROM_DATA
EMPLOYEENUMBER - Employee's Personnel Number
Data type: BAPIEMPL-PERNROptional: No
Call by Reference: No ( called with pass by value option)
FRAMEDATA - General Trip Data
Data type: BAPITRMAINOptional: No
Call by Reference: No ( called with pass by value option)
STATUS - Trip Status
Data type: BAPITRVSTAOptional: Yes
Call by Reference: No ( called with pass by value option)
BATCH_SESSION_NAME -
Data type: APQI-GROUPIDOptional: 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)
BATCH_INPUT_ONLY - Checkbox
Data type: BAPITRVXXX-BOOLEANOptional: Yes
Call by Reference: No ( called with pass by value option)
EXPORTING Parameters details for BAPI_TRIP_CREATE_FROM_DATA
RETURN - Return Value (Instead of Exceptions)
Data type: BAPIRETURNOptional: No
Call by Reference: No ( called with pass by value option)
EMPLOYEENUMBER - Employee's Personnel Number
Data type: BAPIEMPL-PERNROptional: No
Call by Reference: No ( called with pass by value option)
TRIPNUMBER - Trip Number
Data type: BAPITRIP-TRIPNOOptional: No
Call by Reference: No ( called with pass by value option)
TABLES Parameters details for BAPI_TRIP_CREATE_FROM_DATA
RECEIPTS - Receipts
Data type: BAPITRVRECOptional: Yes
Call by Reference: No ( called with pass by value option)
COSTDIST_STOP - Cost Distribution for Stopovers
Data type: BAPITRVCOSOptional: Yes
Call by Reference: No ( called with pass by value option)
COSTDIST_RECE - Cost Distribution for Receipts
Data type: BAPITRVCOROptional: Yes
Call by Reference: No ( called with pass by value option)
COSTDIST_MILE - Cost Distribution for Miles/Kms Distribution
Data type: BAPITRVCOMOptional: Yes
Call by Reference: No ( called with pass by value option)
RECEIPTS_JURCODES - Tax Jurisdiction Codes for the 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
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 - Trip Text
Data type: BAPITRTEXTOptional: Yes
Call by Reference: No ( called with pass by value option)
MILEAGE - Miles/Km Distribution
Data type: BAPITRVMILOptional: Yes
Call by Reference: No ( called with pass by value option)
STOPOVER - Stopovers
Data type: BAPITRVSTOOptional: Yes
Call by Reference: No ( called with pass by value option)
DEDUCTIONS - Deductions
Data type: BAPITRVDEDOptional: Yes
Call by Reference: No ( called with pass by value option)
TRANSPORT - Local Public Transport, Journey
Data type: BAPITRVTRNOptional: Yes
Call by Reference: Yes
COSTDIST_TRIP - Cost Distribution for Entire Trip
Data type: BAPITRVCOTOptional: Yes
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for BAPI_TRIP_CREATE_FROM_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: | ||||
| lv_return | TYPE BAPIRETURN, " | |||
| lt_receipts | TYPE STANDARD TABLE OF BAPITRVREC, " | |||
| lv_employeenumber | TYPE BAPIEMPL-PERNR, " | |||
| lt_costdist_stop | TYPE STANDARD TABLE OF BAPITRVCOS, " | |||
| lt_costdist_rece | TYPE STANDARD TABLE OF BAPITRVCOR, " | |||
| lt_costdist_mile | TYPE STANDARD TABLE OF BAPITRVCOM, " | |||
| lt_receipts_jurcodes | TYPE STANDARD TABLE OF BAPIJURCODE, " | |||
| lt_receipts_service_provider | TYPE STANDARD TABLE OF BAPIRECPAYOT, " | |||
| lt_addinfo | TYPE STANDARD TABLE OF BAPITRADDI, " | |||
| lv_framedata | TYPE BAPITRMAIN, " | |||
| lv_employeenumber | TYPE BAPIEMPL-PERNR, " | |||
| lv_status | TYPE BAPITRVSTA, " | |||
| lt_advance | TYPE STANDARD TABLE OF BAPITRVSCH, " | |||
| lv_tripnumber | TYPE BAPITRIP-TRIPNO, " | |||
| lt_text | TYPE STANDARD TABLE OF BAPITRTEXT, " | |||
| lv_batch_session_name | TYPE APQI-GROUPID, " | |||
| lv_change | TYPE BAPITRVHIS, " | |||
| lt_mileage | TYPE STANDARD TABLE OF BAPITRVMIL, " | |||
| lt_stopover | TYPE STANDARD TABLE OF BAPITRVSTO, " | |||
| lv_batch_input_only | TYPE BAPITRVXXX-BOOLEAN, " | |||
| lt_deductions | TYPE STANDARD TABLE OF BAPITRVDED, " | |||
| lt_transport | TYPE STANDARD TABLE OF BAPITRVTRN, " | |||
| lt_costdist_trip | TYPE STANDARD TABLE OF BAPITRVCOT. " |
|   CALL FUNCTION 'BAPI_TRIP_CREATE_FROM_DATA' "Create Employee Trip with CallTransaction on PR01 |
| EXPORTING | ||
| EMPLOYEENUMBER | = lv_employeenumber | |
| FRAMEDATA | = lv_framedata | |
| STATUS | = lv_status | |
| BATCH_SESSION_NAME | = lv_batch_session_name | |
| CHANGE | = lv_change | |
| BATCH_INPUT_ONLY | = lv_batch_input_only | |
| IMPORTING | ||
| RETURN | = lv_return | |
| EMPLOYEENUMBER | = lv_employeenumber | |
| TRIPNUMBER | = lv_tripnumber | |
| TABLES | ||
| RECEIPTS | = lt_receipts | |
| COSTDIST_STOP | = lt_costdist_stop | |
| COSTDIST_RECE | = lt_costdist_rece | |
| COSTDIST_MILE | = lt_costdist_mile | |
| RECEIPTS_JURCODES | = lt_receipts_jurcodes | |
| RECEIPTS_SERVICE_PROVIDER | = lt_receipts_service_provider | |
| ADDINFO | = lt_addinfo | |
| ADVANCE | = lt_advance | |
| TEXT | = lt_text | |
| MILEAGE | = lt_mileage | |
| STOPOVER | = lt_stopover | |
| DEDUCTIONS | = lt_deductions | |
| TRANSPORT | = lt_transport | |
| COSTDIST_TRIP | = lt_costdist_trip | |
| . " BAPI_TRIP_CREATE_FROM_DATA | ||
ABAP code using 7.40 inline data declarations to call FM BAPI_TRIP_CREATE_FROM_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 PERNR FROM BAPIEMPL INTO @DATA(ld_employeenumber). | ||||
| "SELECT single PERNR FROM BAPIEMPL INTO @DATA(ld_employeenumber). | ||||
| "SELECT single TRIPNO FROM BAPITRIP INTO @DATA(ld_tripnumber). | ||||
| "SELECT single GROUPID FROM APQI INTO @DATA(ld_batch_session_name). | ||||
| "SELECT single BOOLEAN FROM BAPITRVXXX INTO @DATA(ld_batch_input_only). | ||||
Search for further information about these or an SAP related objects