SAP FVD_PRODUCT_COMPARE_PROD Function Module for Compare Two Products
FVD_PRODUCT_COMPARE_PROD is a standard fvd product compare prod SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Compare Two Products 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 fvd product compare prod FM, simply by entering the name FVD_PRODUCT_COMPARE_PROD into the relevant SAP transaction such as SE37 or SE38.
Function Group: FVDC_PROD_COMPARE
Program Name: SAPLFVDC_PROD_COMPARE
Main Program: SAPLFVDC_PROD_COMPARE
Appliation area:
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:

Function FVD_PRODUCT_COMPARE_PROD 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 'FVD_PRODUCT_COMPARE_PROD'"Compare Two Products.
EXPORTING
I_PRODTYPE = "Product Category
I_CLIENT1 = "Client
I_PRODINT1 = "Internal Product ID
I_VERSION1 = "Version of a Product
I_CLIENT2 = "Client
I_PRODINT2 = "Internal Product ID
I_VERSION2 = "Version of a Product
IMPORTING
E_T_COMPARE = "Comparison of Two Attributes
EXCEPTIONS
ERROR_OCCURED_PROD1 = 1 ERROR_OCCURED_PROD2 = 2 ERROR_OCCURED = 3
IMPORTING Parameters details for FVD_PRODUCT_COMPARE_PROD
I_PRODTYPE - Product Category
Data type: TDPR_PRODUCT-PRODTYPEOptional: No
Call by Reference: Yes
I_CLIENT1 - Client
Data type: MANDTOptional: No
Call by Reference: Yes
I_PRODINT1 - Internal Product ID
Data type: TB_PR_PRODINTOptional: No
Call by Reference: Yes
I_VERSION1 - Version of a Product
Data type: TDPR_PRODV-VERSIONOptional: No
Call by Reference: Yes
I_CLIENT2 - Client
Data type: MANDTOptional: No
Call by Reference: Yes
I_PRODINT2 - Internal Product ID
Data type: TB_PR_PRODINTOptional: No
Call by Reference: Yes
I_VERSION2 - Version of a Product
Data type: TDPR_PRODV-VERSIONOptional: No
Call by Reference: Yes
EXPORTING Parameters details for FVD_PRODUCT_COMPARE_PROD
E_T_COMPARE - Comparison of Two Attributes
Data type: TRTY_COMPAREOptional: No
Call by Reference: Yes
EXCEPTIONS details
ERROR_OCCURED_PROD1 -
Data type:Optional: No
Call by Reference: Yes
ERROR_OCCURED_PROD2 -
Data type:Optional: No
Call by Reference: Yes
ERROR_OCCURED -
Data type:Optional: No
Call by Reference: Yes
Copy and paste ABAP code example for FVD_PRODUCT_COMPARE_PROD 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_i_prodtype | TYPE TDPR_PRODUCT-PRODTYPE, " | |||
| lv_e_t_compare | TYPE TRTY_COMPARE, " | |||
| lv_error_occured_prod1 | TYPE TRTY_COMPARE, " | |||
| lv_i_client1 | TYPE MANDT, " | |||
| lv_error_occured_prod2 | TYPE MANDT, " | |||
| lv_i_prodint1 | TYPE TB_PR_PRODINT, " | |||
| lv_error_occured | TYPE TB_PR_PRODINT, " | |||
| lv_i_version1 | TYPE TDPR_PRODV-VERSION, " | |||
| lv_i_client2 | TYPE MANDT, " | |||
| lv_i_prodint2 | TYPE TB_PR_PRODINT, " | |||
| lv_i_version2 | TYPE TDPR_PRODV-VERSION. " |
|   CALL FUNCTION 'FVD_PRODUCT_COMPARE_PROD' "Compare Two Products |
| EXPORTING | ||
| I_PRODTYPE | = lv_i_prodtype | |
| I_CLIENT1 | = lv_i_client1 | |
| I_PRODINT1 | = lv_i_prodint1 | |
| I_VERSION1 | = lv_i_version1 | |
| I_CLIENT2 | = lv_i_client2 | |
| I_PRODINT2 | = lv_i_prodint2 | |
| I_VERSION2 | = lv_i_version2 | |
| IMPORTING | ||
| E_T_COMPARE | = lv_e_t_compare | |
| EXCEPTIONS | ||
| ERROR_OCCURED_PROD1 = 1 | ||
| ERROR_OCCURED_PROD2 = 2 | ||
| ERROR_OCCURED = 3 | ||
| . " FVD_PRODUCT_COMPARE_PROD | ||
ABAP code using 7.40 inline data declarations to call FM FVD_PRODUCT_COMPARE_PROD
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 PRODTYPE FROM TDPR_PRODUCT INTO @DATA(ld_i_prodtype). | ||||
| "SELECT single VERSION FROM TDPR_PRODV INTO @DATA(ld_i_version1). | ||||
| "SELECT single VERSION FROM TDPR_PRODV INTO @DATA(ld_i_version2). | ||||
Search for further information about these or an SAP related objects