SAP PTRM_TRIP_INIT Function Module for Initialize new travel request/plan (context) or get data of existing one









PTRM_TRIP_INIT is a standard ptrm trip init SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Initialize new travel request/plan (context) or get data of existing one 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 ptrm trip init FM, simply by entering the name PTRM_TRIP_INIT into the relevant SAP transaction such as SE37 or SE38.

Function Group: PTRM_COMMON
Program Name: SAPLPTRM_COMMON
Main Program: SAPLPTRM_COMMON
Appliation area:
Release date: N/A
Mode(Normal, Remote etc): Remote-Enabled
Update:



Function PTRM_TRIP_INIT 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 'PTRM_TRIP_INIT'"Initialize new travel request/plan (context) or get data of existing one
EXPORTING
I_EMPLOYEENUMBER = "Personnel Number
* I_TRIPNUMBER = "Trip number if existing trip should be accessed
* I_TRIP_COMPONENT = 'R' "'R' = Request, 'P' = Plan
* I_CUSTOMIZING_DATE = SY-DATUM "Read customizing valid for indicated date. Sy-datum if initial.
* I_LANGUAGE = SY-LANGU "UI language, backend system default if blank

IMPORTING
E_GENERAL_DATA = "General data of trip such as period, destination, est. cost
ET_VH_PLAN_REGIONS = "Value help regions, plan specific
ET_VH_DESTINATION_ADDRESSES = "Value help destination addresses defined in customizing
ET_VH_PREDEF_ADDRS_CATEGORIES = "Value help categories of Predefined Addresses
ET_VH_DESTINATIONS = "Personal Help Values for freeflow destination (historical)
ET_VH_TRIP_REASONS = "Personal Help Values for trip reasons (historical)
ET_VH_ACTIVITY_TYPES = "Value help trip activity types for request and plan
ET_VH_PLAN_FROM_AIRPORTS = "Personal Help Values for departure airports (historical, incl. country, region)
ET_VH_PLAN_TO_AIRPORTS = "Personal Help Values for arrival airports (historical, incl. country, region)
ET_CD_COMPANY_CODES = "Cost dist: Table of Company Codes
ET_CD_BUSINESS_AREAS = "Cost dist: Table of Business Areas
E_TRIP_SCHEME = "Trip Schema information (for request and plan schema PL is used)
ET_CD_VH_COSTCENTER = "Cost dist: Personal Help Values for Cost Center
ET_CD_VH_ORDER = "Cost dist: Personal Help Values for Orders
ET_CD_VH_COSTOBJECT = "Cost dist: Personal Help Values for Cost Object
ET_CD_VH_WBSELEMENT = "Cost dist: Personal Help Values for WBS Element
ET_CD_VH_NETWORK = "Cost dist: Personal Help Values for Network
ET_CD_VH_VORNR = "Cost dist: Personal Help Values for Activity
ET_CD_VH_SALESORDER = "Cost dist: Personal Help Values for Sales Orders
ET_CD_VH_FISTL = "Cost dist: Personal Help Values for Funds Center
ET_CD_VH_GRANT = "Cost dist: Personal Help Values for Grant
ET_CD_VH_FKBER = "Cost dist: Personal Help Values for Functional Area
E_CD_COST_DIST_TEXT = "Short text with trip's cost distribution for informal display.
ET_CD_VH_CPROJECTS = "Cost dist: Personal Help Values for cProjects
ET_CD_COST_DIST_TRIP = "Cost distribution of trip request as hold in the backend context
ET_CD_MASTERCOST_TRIP_DEFAULT = "Standard cost distribution as per customizing
ET_FIELD_CONTROL = "Field control for general fields (indicates active/inactive fields etc.)
ET_FIELD_CONTROL_COSTDIST_TRIP = "Field control for cost distribution of trip
ET_PLAN_AGENCY_STATUS = "Tavel agceny status' for Travel Plan
ET_PLAN_ITEM_SERVICES = "Specific Item Informations concerning all categories
ET_PLAN_FLIGHT_FARES = "Airfare rates
ET_PLAN_FLIGHT_FARE_NOTES = "Airfare rate detail information
ET_RETURN = "Table with BAPI return information: messages
E_CD_COST_DIST_TRIP_DEFAULT = "Defaults for new cost assignment item
E_PLAN_FAST_BOOKING_ACTIVE = "Flag to indicate express booking enablement
E_PLAN_DATA = "Plan specific general data of a trip such as reservation codes
ET_EMPLOYEE_DATA = "Information on Employee
ET_VH_COUNTRIES = "Value help countries and regions available for trip destinations
ET_VH_PLAN_COUNTRIES = "Value help countries, plan specific
.



IMPORTING Parameters details for PTRM_TRIP_INIT

I_EMPLOYEENUMBER - Personnel Number

Data type: BAPIEMPL-PERNR
Optional: No
Call by Reference: No ( called with pass by value option)

I_TRIPNUMBER - Trip number if existing trip should be accessed

Data type: BAPITRIP-TRIPNO
Optional: Yes
Call by Reference: No ( called with pass by value option)

I_TRIP_COMPONENT - 'R' = Request, 'P' = Plan

Data type: PLAN_REQUEST
Default: 'R'
Optional: Yes
Call by Reference: No ( called with pass by value option)

I_CUSTOMIZING_DATE - Read customizing valid for indicated date. Sy-datum if initial.

Data type: BAPITRIP-DEP_DATE
Default: SY-DATUM
Optional: Yes
Call by Reference: No ( called with pass by value option)

I_LANGUAGE - UI language, backend system default if blank

Data type: BAPITRVXXX-LANGU
Default: SY-LANGU
Optional: Yes
Call by Reference: No ( called with pass by value option)

EXPORTING Parameters details for PTRM_TRIP_INIT

E_GENERAL_DATA - General data of trip such as period, destination, est. cost

Data type: PTRV_WEB_GENERAL_DATA_EXT
Optional: No
Call by Reference: No ( called with pass by value option)

ET_VH_PLAN_REGIONS - Value help regions, plan specific

Data type: FTPS_WEB_REGION_T
Optional: No
Call by Reference: No ( called with pass by value option)

ET_VH_DESTINATION_ADDRESSES - Value help destination addresses defined in customizing

Data type: FTPS_WEB_PREDEF_ADR_T
Optional: No
Call by Reference: No ( called with pass by value option)

ET_VH_PREDEF_ADDRS_CATEGORIES - Value help categories of Predefined Addresses

Data type: PTRV_WEB_PREDEF_CATEGORIES_T
Optional: No
Call by Reference: No ( called with pass by value option)

ET_VH_DESTINATIONS - Personal Help Values for freeflow destination (historical)

Data type: PTRV_WEB_LOCATION_T
Optional: No
Call by Reference: No ( called with pass by value option)

ET_VH_TRIP_REASONS - Personal Help Values for trip reasons (historical)

Data type: PTRV_WEB_TRIP_REASON_T
Optional: No
Call by Reference: No ( called with pass by value option)

ET_VH_ACTIVITY_TYPES - Value help trip activity types for request and plan

Data type: PTRP_WEB_TA20R1_T
Optional: No
Call by Reference: No ( called with pass by value option)

ET_VH_PLAN_FROM_AIRPORTS - Personal Help Values for departure airports (historical, incl. country, region)

Data type: FTPS_WEB_LOCATION_T
Optional: No
Call by Reference: No ( called with pass by value option)

ET_VH_PLAN_TO_AIRPORTS - Personal Help Values for arrival airports (historical, incl. country, region)

Data type: FTPS_WEB_LOCATION_T
Optional: No
Call by Reference: No ( called with pass by value option)

ET_CD_COMPANY_CODES - Cost dist: Table of Company Codes

Data type: PTRV_WEB_COMPANY_CODE_T
Optional: No
Call by Reference: No ( called with pass by value option)

ET_CD_BUSINESS_AREAS - Cost dist: Table of Business Areas

Data type: PTRV_WEB_BUSINESS_AREA_T
Optional: No
Call by Reference: No ( called with pass by value option)

E_TRIP_SCHEME - Trip Schema information (for request and plan schema PL is used)

Data type: PTRV_WEB_T706S
Optional: No
Call by Reference: No ( called with pass by value option)

ET_CD_VH_COSTCENTER - Cost dist: Personal Help Values for Cost Center

Data type: PTRV_WEB_COSTCENTER_T
Optional: No
Call by Reference: No ( called with pass by value option)

ET_CD_VH_ORDER - Cost dist: Personal Help Values for Orders

Data type: PTRV_WEB_ORDER_T
Optional: No
Call by Reference: No ( called with pass by value option)

ET_CD_VH_COSTOBJECT - Cost dist: Personal Help Values for Cost Object

Data type: PTRV_WEB_COSTOBJECT_T
Optional: No
Call by Reference: No ( called with pass by value option)

ET_CD_VH_WBSELEMENT - Cost dist: Personal Help Values for WBS Element

Data type: PTRV_WEB_WBSELEMENT_T
Optional: No
Call by Reference: No ( called with pass by value option)

ET_CD_VH_NETWORK - Cost dist: Personal Help Values for Network

Data type: PTRV_WEB_NETWORK_T
Optional: No
Call by Reference: No ( called with pass by value option)

ET_CD_VH_VORNR - Cost dist: Personal Help Values for Activity

Data type: PTRV_WEB_VORNR_T
Optional: No
Call by Reference: No ( called with pass by value option)

ET_CD_VH_SALESORDER - Cost dist: Personal Help Values for Sales Orders

Data type: PTRV_WEB_SALESORDER_T
Optional: No
Call by Reference: No ( called with pass by value option)

ET_CD_VH_FISTL - Cost dist: Personal Help Values for Funds Center

Data type: PTRV_WEB_FISTL_T
Optional: No
Call by Reference: No ( called with pass by value option)

ET_CD_VH_GRANT - Cost dist: Personal Help Values for Grant

Data type: PTRV_WEB_GRANT_T
Optional: No
Call by Reference: No ( called with pass by value option)

ET_CD_VH_FKBER - Cost dist: Personal Help Values for Functional Area

Data type: PTRV_WEB_FKBER_T
Optional: No
Call by Reference: No ( called with pass by value option)

E_CD_COST_DIST_TEXT - Short text with trip's cost distribution for informal display.

Data type: PTRV_WEB_COST_DIST_TEXT
Optional: No
Call by Reference: No ( called with pass by value option)

ET_CD_VH_CPROJECTS - Cost dist: Personal Help Values for cProjects

Data type: PTRV_WEB_CPROJECTS_T
Optional: No
Call by Reference: No ( called with pass by value option)

ET_CD_COST_DIST_TRIP - Cost distribution of trip request as hold in the backend context

Data type: PTRV_WEB_COSTDIST_TRIP_EXT_T
Optional: No
Call by Reference: No ( called with pass by value option)

ET_CD_MASTERCOST_TRIP_DEFAULT - Standard cost distribution as per customizing

Data type: PTRV_WEB_COSTDIST_TRIP_EXT_T
Optional: No
Call by Reference: No ( called with pass by value option)

ET_FIELD_CONTROL - Field control for general fields (indicates active/inactive fields etc.)

Data type: PTRV_WEB_FIELD_CONTROL_T
Optional: No
Call by Reference: No ( called with pass by value option)

ET_FIELD_CONTROL_COSTDIST_TRIP - Field control for cost distribution of trip

Data type: PTRS_RFC_TRVFSEL_TRIP_CA_T
Optional: No
Call by Reference: No ( called with pass by value option)

ET_PLAN_AGENCY_STATUS - Tavel agceny status' for Travel Plan

Data type: FTPS_WEB_PLAN_STATUS_T
Optional: No
Call by Reference: No ( called with pass by value option)

ET_PLAN_ITEM_SERVICES - Specific Item Informations concerning all categories

Data type: FTPS_WEB_ITEM_SERVICE_T
Optional: No
Call by Reference: No ( called with pass by value option)

ET_PLAN_FLIGHT_FARES - Airfare rates

Data type: FTPS_WEB_FLIGHT_FARE_T
Optional: No
Call by Reference: No ( called with pass by value option)

ET_PLAN_FLIGHT_FARE_NOTES - Airfare rate detail information

Data type: FTPS_WEB_FLIGHT_FARE_NOTE_T
Optional: No
Call by Reference: No ( called with pass by value option)

ET_RETURN - Table with BAPI return information: messages

Data type: BAPIRETTAB
Optional: No
Call by Reference: No ( called with pass by value option)

E_CD_COST_DIST_TRIP_DEFAULT - Defaults for new cost assignment item

Data type: PTRV_WEB_COSTDIST_TRIP_EXT
Optional: No
Call by Reference: No ( called with pass by value option)

E_PLAN_FAST_BOOKING_ACTIVE - Flag to indicate express booking enablement

Data type: XFELD
Optional: No
Call by Reference: No ( called with pass by value option)

E_PLAN_DATA - Plan specific general data of a trip such as reservation codes

Data type: FTPS_WEB_PLAN_OUT
Optional: No
Call by Reference: No ( called with pass by value option)

ET_EMPLOYEE_DATA - Information on Employee

Data type: PTRV_WEB_EMP_INFO_T
Optional: No
Call by Reference: No ( called with pass by value option)

ET_VH_COUNTRIES - Value help countries and regions available for trip destinations

Data type: PTRV_WEB_T706O_T
Optional: No
Call by Reference: No ( called with pass by value option)

ET_VH_PLAN_COUNTRIES - Value help countries, plan specific

Data type: FTPS_WEB_COUNTRY_T
Optional: No
Call by Reference: No ( called with pass by value option)

Copy and paste ABAP code example for PTRM_TRIP_INIT 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_e_general_data  TYPE PTRV_WEB_GENERAL_DATA_EXT, "   
lv_i_employeenumber  TYPE BAPIEMPL-PERNR, "   
lv_et_vh_plan_regions  TYPE FTPS_WEB_REGION_T, "   
lv_et_vh_destination_addresses  TYPE FTPS_WEB_PREDEF_ADR_T, "   
lv_et_vh_predef_addrs_categories  TYPE PTRV_WEB_PREDEF_CATEGORIES_T, "   
lv_et_vh_destinations  TYPE PTRV_WEB_LOCATION_T, "   
lv_et_vh_trip_reasons  TYPE PTRV_WEB_TRIP_REASON_T, "   
lv_et_vh_activity_types  TYPE PTRP_WEB_TA20R1_T, "   
lv_et_vh_plan_from_airports  TYPE FTPS_WEB_LOCATION_T, "   
lv_et_vh_plan_to_airports  TYPE FTPS_WEB_LOCATION_T, "   
lv_et_cd_company_codes  TYPE PTRV_WEB_COMPANY_CODE_T, "   
lv_et_cd_business_areas  TYPE PTRV_WEB_BUSINESS_AREA_T, "   
lv_i_tripnumber  TYPE BAPITRIP-TRIPNO, "   
lv_e_trip_scheme  TYPE PTRV_WEB_T706S, "   
lv_et_cd_vh_costcenter  TYPE PTRV_WEB_COSTCENTER_T, "   
lv_et_cd_vh_order  TYPE PTRV_WEB_ORDER_T, "   
lv_et_cd_vh_costobject  TYPE PTRV_WEB_COSTOBJECT_T, "   
lv_et_cd_vh_wbselement  TYPE PTRV_WEB_WBSELEMENT_T, "   
lv_et_cd_vh_network  TYPE PTRV_WEB_NETWORK_T, "   
lv_et_cd_vh_vornr  TYPE PTRV_WEB_VORNR_T, "   
lv_et_cd_vh_salesorder  TYPE PTRV_WEB_SALESORDER_T, "   
lv_et_cd_vh_fistl  TYPE PTRV_WEB_FISTL_T, "   
lv_et_cd_vh_grant  TYPE PTRV_WEB_GRANT_T, "   
lv_et_cd_vh_fkber  TYPE PTRV_WEB_FKBER_T, "   
lv_i_trip_component  TYPE PLAN_REQUEST, "   'R'
lv_e_cd_cost_dist_text  TYPE PTRV_WEB_COST_DIST_TEXT, "   
lv_et_cd_vh_cprojects  TYPE PTRV_WEB_CPROJECTS_T, "   
lv_et_cd_cost_dist_trip  TYPE PTRV_WEB_COSTDIST_TRIP_EXT_T, "   
lv_et_cd_mastercost_trip_default  TYPE PTRV_WEB_COSTDIST_TRIP_EXT_T, "   
lv_et_field_control  TYPE PTRV_WEB_FIELD_CONTROL_T, "   
lv_et_field_control_costdist_trip  TYPE PTRS_RFC_TRVFSEL_TRIP_CA_T, "   
lv_et_plan_agency_status  TYPE FTPS_WEB_PLAN_STATUS_T, "   
lv_et_plan_item_services  TYPE FTPS_WEB_ITEM_SERVICE_T, "   
lv_et_plan_flight_fares  TYPE FTPS_WEB_FLIGHT_FARE_T, "   
lv_et_plan_flight_fare_notes  TYPE FTPS_WEB_FLIGHT_FARE_NOTE_T, "   
lv_et_return  TYPE BAPIRETTAB, "   
lv_i_customizing_date  TYPE BAPITRIP-DEP_DATE, "   SY-DATUM
lv_e_cd_cost_dist_trip_default  TYPE PTRV_WEB_COSTDIST_TRIP_EXT, "   
lv_i_language  TYPE BAPITRVXXX-LANGU, "   SY-LANGU
lv_e_plan_fast_booking_active  TYPE XFELD, "   
lv_e_plan_data  TYPE FTPS_WEB_PLAN_OUT, "   
lv_et_employee_data  TYPE PTRV_WEB_EMP_INFO_T, "   
lv_et_vh_countries  TYPE PTRV_WEB_T706O_T, "   
lv_et_vh_plan_countries  TYPE FTPS_WEB_COUNTRY_T. "   

  CALL FUNCTION 'PTRM_TRIP_INIT'  "Initialize new travel request/plan (context) or get data of existing one
    EXPORTING
         I_EMPLOYEENUMBER = lv_i_employeenumber
         I_TRIPNUMBER = lv_i_tripnumber
         I_TRIP_COMPONENT = lv_i_trip_component
         I_CUSTOMIZING_DATE = lv_i_customizing_date
         I_LANGUAGE = lv_i_language
    IMPORTING
         E_GENERAL_DATA = lv_e_general_data
         ET_VH_PLAN_REGIONS = lv_et_vh_plan_regions
         ET_VH_DESTINATION_ADDRESSES = lv_et_vh_destination_addresses
         ET_VH_PREDEF_ADDRS_CATEGORIES = lv_et_vh_predef_addrs_categories
         ET_VH_DESTINATIONS = lv_et_vh_destinations
         ET_VH_TRIP_REASONS = lv_et_vh_trip_reasons
         ET_VH_ACTIVITY_TYPES = lv_et_vh_activity_types
         ET_VH_PLAN_FROM_AIRPORTS = lv_et_vh_plan_from_airports
         ET_VH_PLAN_TO_AIRPORTS = lv_et_vh_plan_to_airports
         ET_CD_COMPANY_CODES = lv_et_cd_company_codes
         ET_CD_BUSINESS_AREAS = lv_et_cd_business_areas
         E_TRIP_SCHEME = lv_e_trip_scheme
         ET_CD_VH_COSTCENTER = lv_et_cd_vh_costcenter
         ET_CD_VH_ORDER = lv_et_cd_vh_order
         ET_CD_VH_COSTOBJECT = lv_et_cd_vh_costobject
         ET_CD_VH_WBSELEMENT = lv_et_cd_vh_wbselement
         ET_CD_VH_NETWORK = lv_et_cd_vh_network
         ET_CD_VH_VORNR = lv_et_cd_vh_vornr
         ET_CD_VH_SALESORDER = lv_et_cd_vh_salesorder
         ET_CD_VH_FISTL = lv_et_cd_vh_fistl
         ET_CD_VH_GRANT = lv_et_cd_vh_grant
         ET_CD_VH_FKBER = lv_et_cd_vh_fkber
         E_CD_COST_DIST_TEXT = lv_e_cd_cost_dist_text
         ET_CD_VH_CPROJECTS = lv_et_cd_vh_cprojects
         ET_CD_COST_DIST_TRIP = lv_et_cd_cost_dist_trip
         ET_CD_MASTERCOST_TRIP_DEFAULT = lv_et_cd_mastercost_trip_default
         ET_FIELD_CONTROL = lv_et_field_control
         ET_FIELD_CONTROL_COSTDIST_TRIP = lv_et_field_control_costdist_trip
         ET_PLAN_AGENCY_STATUS = lv_et_plan_agency_status
         ET_PLAN_ITEM_SERVICES = lv_et_plan_item_services
         ET_PLAN_FLIGHT_FARES = lv_et_plan_flight_fares
         ET_PLAN_FLIGHT_FARE_NOTES = lv_et_plan_flight_fare_notes
         ET_RETURN = lv_et_return
         E_CD_COST_DIST_TRIP_DEFAULT = lv_e_cd_cost_dist_trip_default
         E_PLAN_FAST_BOOKING_ACTIVE = lv_e_plan_fast_booking_active
         E_PLAN_DATA = lv_e_plan_data
         ET_EMPLOYEE_DATA = lv_et_employee_data
         ET_VH_COUNTRIES = lv_et_vh_countries
         ET_VH_PLAN_COUNTRIES = lv_et_vh_plan_countries
. " PTRM_TRIP_INIT




ABAP code using 7.40 inline data declarations to call FM PTRM_TRIP_INIT

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_i_employeenumber).
 
 
 
 
 
 
 
 
 
 
 
"SELECT single TRIPNO FROM BAPITRIP INTO @DATA(ld_i_tripnumber).
 
 
 
 
 
 
 
 
 
 
 
 
DATA(ld_i_trip_component) = 'R'.
 
 
 
 
 
 
 
 
 
 
 
 
"SELECT single DEP_DATE FROM BAPITRIP INTO @DATA(ld_i_customizing_date).
DATA(ld_i_customizing_date) = SY-DATUM.
 
 
"SELECT single LANGU FROM BAPITRVXXX INTO @DATA(ld_i_language).
DATA(ld_i_language) = SY-LANGU.
 
 
 
 
 
 


Search for further information about these or an SAP related objects



Comments on this SAP object

What made you want to lookup this SAP object? Please tell us what you were looking for and anything you would like to be included on this page!