SAP PTRV_WRITE_TRIP_HEADER Function Module for









PTRV_WRITE_TRIP_HEADER is a standard ptrv write trip header 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 ptrv write trip header FM, simply by entering the name PTRV_WRITE_TRIP_HEADER into the relevant SAP transaction such as SE37 or SE38.

Function Group: HRTRV_UTIL
Program Name: SAPLHRTRV_UTIL
Main Program: SAPLHRTRV_UTIL
Appliation area: P
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:



Function PTRV_WRITE_TRIP_HEADER 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 'PTRV_WRITE_TRIP_HEADER'"
EXPORTING
PERSONNEL_NUMBER = "Personnel Number
* TIME_FROM = "Time From
* TIME_TO = "End Time
* REASON_FOR_TRIP = "Reason for Trip
* CITY = "Trip Location
* COUNTRY = "
* REGION = "State
* DRAW_FRAME = 'X' "
* RIGHT_MARGIN = 80 "
EMPLOYEE_NAME = "Employee Name
* COMPANY_CODE = "Company Code
* PERSONNEL_AREA = "Personnel Area
* COST_CENTER = "Cost Center
* CONTROLLING_AREA = "Controlling Area
* TRIP_NUMBER = "Trip Number
* TRIP_FROM = "
* TRIP_TO = "Trip Until
.



IMPORTING Parameters details for PTRV_WRITE_TRIP_HEADER

PERSONNEL_NUMBER - Personnel Number

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

TIME_FROM - Time From

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

TIME_TO - End Time

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

REASON_FOR_TRIP - Reason for Trip

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

CITY - Trip Location

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

COUNTRY -

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

REGION - State

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

DRAW_FRAME -

Data type: SY-DEBUG
Default: 'X'
Optional: Yes
Call by Reference: No ( called with pass by value option)

RIGHT_MARGIN -

Data type: I
Default: 80
Optional: Yes
Call by Reference: No ( called with pass by value option)

EMPLOYEE_NAME - Employee Name

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

COMPANY_CODE - Company Code

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

PERSONNEL_AREA - Personnel Area

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

COST_CENTER - Cost Center

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

CONTROLLING_AREA - Controlling Area

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

TRIP_NUMBER - Trip Number

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

TRIP_FROM -

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

TRIP_TO - Trip Until

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

Copy and paste ABAP code example for PTRV_WRITE_TRIP_HEADER 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_personnel_number  TYPE P0001-PERNR, "   
lv_time_from  TYPE PTP02-UHRV1, "   
lv_time_to  TYPE PTP02-UHRB1, "   
lv_reason_for_trip  TYPE PTP02-KUNDE, "   
lv_city  TYPE PTP02-ZORT1, "   
lv_country  TYPE PTP02-ZLAND, "   
lv_region  TYPE PTP02-HRGIO, "   
lv_draw_frame  TYPE SY-DEBUG, "   'X'
lv_right_margin  TYPE I, "   80
lv_employee_name  TYPE P0001-ENAME, "   
lv_company_code  TYPE P0001-BUKRS, "   
lv_personnel_area  TYPE P0001-WERKS, "   
lv_cost_center  TYPE P0001-KOSTL, "   
lv_controlling_area  TYPE P0001-KOKRS, "   
lv_trip_number  TYPE PTRV_HEAD-REINR, "   
lv_trip_from  TYPE PTP02-DATV1, "   
lv_trip_to  TYPE PTP02-DATB1. "   

  CALL FUNCTION 'PTRV_WRITE_TRIP_HEADER'  "
    EXPORTING
         PERSONNEL_NUMBER = lv_personnel_number
         TIME_FROM = lv_time_from
         TIME_TO = lv_time_to
         REASON_FOR_TRIP = lv_reason_for_trip
         CITY = lv_city
         COUNTRY = lv_country
         REGION = lv_region
         DRAW_FRAME = lv_draw_frame
         RIGHT_MARGIN = lv_right_margin
         EMPLOYEE_NAME = lv_employee_name
         COMPANY_CODE = lv_company_code
         PERSONNEL_AREA = lv_personnel_area
         COST_CENTER = lv_cost_center
         CONTROLLING_AREA = lv_controlling_area
         TRIP_NUMBER = lv_trip_number
         TRIP_FROM = lv_trip_from
         TRIP_TO = lv_trip_to
. " PTRV_WRITE_TRIP_HEADER




ABAP code using 7.40 inline data declarations to call FM PTRV_WRITE_TRIP_HEADER

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 P0001 INTO @DATA(ld_personnel_number).
 
"SELECT single UHRV1 FROM PTP02 INTO @DATA(ld_time_from).
 
"SELECT single UHRB1 FROM PTP02 INTO @DATA(ld_time_to).
 
"SELECT single KUNDE FROM PTP02 INTO @DATA(ld_reason_for_trip).
 
"SELECT single ZORT1 FROM PTP02 INTO @DATA(ld_city).
 
"SELECT single ZLAND FROM PTP02 INTO @DATA(ld_country).
 
"SELECT single HRGIO FROM PTP02 INTO @DATA(ld_region).
 
"SELECT single DEBUG FROM SY INTO @DATA(ld_draw_frame).
DATA(ld_draw_frame) = 'X'.
 
DATA(ld_right_margin) = 80.
 
"SELECT single ENAME FROM P0001 INTO @DATA(ld_employee_name).
 
"SELECT single BUKRS FROM P0001 INTO @DATA(ld_company_code).
 
"SELECT single WERKS FROM P0001 INTO @DATA(ld_personnel_area).
 
"SELECT single KOSTL FROM P0001 INTO @DATA(ld_cost_center).
 
"SELECT single KOKRS FROM P0001 INTO @DATA(ld_controlling_area).
 
"SELECT single REINR FROM PTRV_HEAD INTO @DATA(ld_trip_number).
 
"SELECT single DATV1 FROM PTP02 INTO @DATA(ld_trip_from).
 
"SELECT single DATB1 FROM PTP02 INTO @DATA(ld_trip_to).
 


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!