SAP TRV_KM_COMPARISON Function Module for









TRV_KM_COMPARISON is a standard trv km comparison 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 trv km comparison FM, simply by entering the name TRV_KM_COMPARISON into the relevant SAP transaction such as SE37 or SE38.

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



Function TRV_KM_COMPARISON 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 'TRV_KM_COMPARISON'"
EXPORTING
P_HEAD = "
IN_PTRV_COMP = "Comparison Calculation Results PS
COMP_F_RECEIPT_NR = "
ABKR1 = "Allocation Group
DISPLAY_MODUS = "
P_PERIO = "
WEG_KM = "Total Miles/Kilometers
WEG_AUFTEILUNG = "
KZPMF = "Name for Vehicle Type
PKWKL = "Name for vehicle class
AZMIT = "Number of Passengers
KM_SATZ = "
WAERS = "Travel Expense Report Currency

IMPORTING
OUT_PTRV_COMP = "Comparison Calculation Results PS
KAP_BETRAG = "
CREATE_RECEIPT = "
DELETE_RECEIPT = "
SAVE_COMP_DATA = "

TABLES
ZIEL = "
BELEG = "
EDITOR = "Travel Management General Purpose Text Editor
.



IMPORTING Parameters details for TRV_KM_COMPARISON

P_HEAD -

Data type: PTP02
Optional: No
Call by Reference: Yes

IN_PTRV_COMP - Comparison Calculation Results PS

Data type: PTRV_COMP
Optional: No
Call by Reference: Yes

COMP_F_RECEIPT_NR -

Data type: C
Optional: No
Call by Reference: Yes

ABKR1 - Allocation Group

Data type: PTP42-ABKR1
Optional: No
Call by Reference: Yes

DISPLAY_MODUS -

Data type: C
Optional: No
Call by Reference: Yes

P_PERIO -

Data type: PTP42
Optional: No
Call by Reference: Yes

WEG_KM - Total Miles/Kilometers

Data type: PTP68-KMGES
Optional: No
Call by Reference: Yes

WEG_AUFTEILUNG -

Data type: C
Optional: No
Call by Reference: Yes

KZPMF - Name for Vehicle Type

Data type: T706E-FZTXT
Optional: No
Call by Reference: Yes

PKWKL - Name for vehicle class

Data type: T706W-TEXT25
Optional: No
Call by Reference: Yes

AZMIT - Number of Passengers

Data type: PTP68-AZMIT
Optional: No
Call by Reference: Yes

KM_SATZ -

Data type: PTK21-BETFA
Optional: No
Call by Reference: Yes

WAERS - Travel Expense Report Currency

Data type: PTP42-WAERS
Optional: No
Call by Reference: Yes

EXPORTING Parameters details for TRV_KM_COMPARISON

OUT_PTRV_COMP - Comparison Calculation Results PS

Data type: PTRV_COMP
Optional: No
Call by Reference: Yes

KAP_BETRAG -

Data type: PTK25-GBTFZ
Optional: No
Call by Reference: Yes

CREATE_RECEIPT -

Data type: C
Optional: No
Call by Reference: Yes

DELETE_RECEIPT -

Data type: C
Optional: No
Call by Reference: Yes

SAVE_COMP_DATA -

Data type: C
Optional: No
Call by Reference: Yes

TABLES Parameters details for TRV_KM_COMPARISON

ZIEL -

Data type: PTK05
Optional: No
Call by Reference: Yes

BELEG -

Data type: PTK03
Optional: No
Call by Reference: Yes

EDITOR - Travel Management General Purpose Text Editor

Data type: PTP71
Optional: No
Call by Reference: Yes

Copy and paste ABAP code example for TRV_KM_COMPARISON 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_ziel  TYPE STANDARD TABLE OF PTK05, "   
lv_p_head  TYPE PTP02, "   
lv_out_ptrv_comp  TYPE PTRV_COMP, "   
lv_in_ptrv_comp  TYPE PTRV_COMP, "   
lv_comp_f_receipt_nr  TYPE C, "   
lv_abkr1  TYPE PTP42-ABKR1, "   
lv_display_modus  TYPE C, "   
lt_beleg  TYPE STANDARD TABLE OF PTK03, "   
lv_p_perio  TYPE PTP42, "   
lv_kap_betrag  TYPE PTK25-GBTFZ, "   
lt_editor  TYPE STANDARD TABLE OF PTP71, "   
lv_weg_km  TYPE PTP68-KMGES, "   
lv_create_receipt  TYPE C, "   
lv_delete_receipt  TYPE C, "   
lv_weg_aufteilung  TYPE C, "   
lv_kzpmf  TYPE T706E-FZTXT, "   
lv_save_comp_data  TYPE C, "   
lv_pkwkl  TYPE T706W-TEXT25, "   
lv_azmit  TYPE PTP68-AZMIT, "   
lv_km_satz  TYPE PTK21-BETFA, "   
lv_waers  TYPE PTP42-WAERS. "   

  CALL FUNCTION 'TRV_KM_COMPARISON'  "
    EXPORTING
         P_HEAD = lv_p_head
         IN_PTRV_COMP = lv_in_ptrv_comp
         COMP_F_RECEIPT_NR = lv_comp_f_receipt_nr
         ABKR1 = lv_abkr1
         DISPLAY_MODUS = lv_display_modus
         P_PERIO = lv_p_perio
         WEG_KM = lv_weg_km
         WEG_AUFTEILUNG = lv_weg_aufteilung
         KZPMF = lv_kzpmf
         PKWKL = lv_pkwkl
         AZMIT = lv_azmit
         KM_SATZ = lv_km_satz
         WAERS = lv_waers
    IMPORTING
         OUT_PTRV_COMP = lv_out_ptrv_comp
         KAP_BETRAG = lv_kap_betrag
         CREATE_RECEIPT = lv_create_receipt
         DELETE_RECEIPT = lv_delete_receipt
         SAVE_COMP_DATA = lv_save_comp_data
    TABLES
         ZIEL = lt_ziel
         BELEG = lt_beleg
         EDITOR = lt_editor
. " TRV_KM_COMPARISON




ABAP code using 7.40 inline data declarations to call FM TRV_KM_COMPARISON

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 ABKR1 FROM PTP42 INTO @DATA(ld_abkr1).
 
 
 
 
"SELECT single GBTFZ FROM PTK25 INTO @DATA(ld_kap_betrag).
 
 
"SELECT single KMGES FROM PTP68 INTO @DATA(ld_weg_km).
 
 
 
 
"SELECT single FZTXT FROM T706E INTO @DATA(ld_kzpmf).
 
 
"SELECT single TEXT25 FROM T706W INTO @DATA(ld_pkwkl).
 
"SELECT single AZMIT FROM PTP68 INTO @DATA(ld_azmit).
 
"SELECT single BETFA FROM PTK21 INTO @DATA(ld_km_satz).
 
"SELECT single WAERS FROM PTP42 INTO @DATA(ld_waers).
 


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!