SAP KCRP2_CHOOSE_VARIABLE Function Module for Choose a variable (local or global one)









KCRP2_CHOOSE_VARIABLE is a standard kcrp2 choose variable SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Choose a variable (local or global 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 kcrp2 choose variable FM, simply by entering the name KCRP2_CHOOSE_VARIABLE into the relevant SAP transaction such as SE37 or SE38.

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



Function KCRP2_CHOOSE_VARIABLE 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 'KCRP2_CHOOSE_VARIABLE'"Choose a variable (local or global one)
EXPORTING
I_TXTMT = "Medium field label
I_APPLCLASS = "Application class
I_FNAM = "Name of characteristic
I_VNAM = "Name of variable
I_VARTYP = "Type of variable
I_DISPLAY = "
I_DTYPE = "Data type in ABAP Dictionary
I_VNOOBL = "Optional entry for variables
* I_VPARSEL = '*' "Parameter / select option

CHANGING
C_TXTMT = "Description
C_VNAM = "Name of variable
C_OK_CODE = "
.



IMPORTING Parameters details for KCRP2_CHOOSE_VARIABLE

I_TXTMT - Medium field label

Data type: CFBL101-TXTMT
Optional: No
Call by Reference: Yes

I_APPLCLASS - Application class

Data type: RKB1D-APPLCLASS
Optional: No
Call by Reference: Yes

I_FNAM - Name of characteristic

Data type: CFBCH01-FIELD
Optional: No
Call by Reference: Yes

I_VNAM - Name of variable

Data type: TKESV-VNAM
Optional: No
Call by Reference: Yes

I_VARTYP - Type of variable

Data type: TKESV-VARTYP
Optional: No
Call by Reference: Yes

I_DISPLAY -

Data type:
Optional: No
Call by Reference: Yes

I_DTYPE - Data type in ABAP Dictionary

Data type: CDIFIE-DTYPE
Optional: No
Call by Reference: Yes

I_VNOOBL - Optional entry for variables

Data type: TKESV-VNOOBL
Optional: No
Call by Reference: Yes

I_VPARSEL - Parameter / select option

Data type: TKESV-VPARSEL
Default: '*'
Optional: Yes
Call by Reference: Yes

CHANGING Parameters details for KCRP2_CHOOSE_VARIABLE

C_TXTMT - Description

Data type: CFBL101-TXTMT
Optional: No
Call by Reference: Yes

C_VNAM - Name of variable

Data type: TKESV-VNAM
Optional: No
Call by Reference: Yes

C_OK_CODE -

Data type:
Optional: No
Call by Reference: Yes

Copy and paste ABAP code example for KCRP2_CHOOSE_VARIABLE 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_c_txtmt  TYPE CFBL101-TXTMT, "   
lv_i_txtmt  TYPE CFBL101-TXTMT, "   
lv_c_vnam  TYPE TKESV-VNAM, "   
lv_i_applclass  TYPE RKB1D-APPLCLASS, "   
lv_i_fnam  TYPE CFBCH01-FIELD, "   
lv_c_ok_code  TYPE CFBCH01, "   
lv_i_vnam  TYPE TKESV-VNAM, "   
lv_i_vartyp  TYPE TKESV-VARTYP, "   
lv_i_display  TYPE TKESV, "   
lv_i_dtype  TYPE CDIFIE-DTYPE, "   
lv_i_vnoobl  TYPE TKESV-VNOOBL, "   
lv_i_vparsel  TYPE TKESV-VPARSEL. "   '*'

  CALL FUNCTION 'KCRP2_CHOOSE_VARIABLE'  "Choose a variable (local or global one)
    EXPORTING
         I_TXTMT = lv_i_txtmt
         I_APPLCLASS = lv_i_applclass
         I_FNAM = lv_i_fnam
         I_VNAM = lv_i_vnam
         I_VARTYP = lv_i_vartyp
         I_DISPLAY = lv_i_display
         I_DTYPE = lv_i_dtype
         I_VNOOBL = lv_i_vnoobl
         I_VPARSEL = lv_i_vparsel
    CHANGING
         C_TXTMT = lv_c_txtmt
         C_VNAM = lv_c_vnam
         C_OK_CODE = lv_c_ok_code
. " KCRP2_CHOOSE_VARIABLE




ABAP code using 7.40 inline data declarations to call FM KCRP2_CHOOSE_VARIABLE

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 TXTMT FROM CFBL101 INTO @DATA(ld_c_txtmt).
 
"SELECT single TXTMT FROM CFBL101 INTO @DATA(ld_i_txtmt).
 
"SELECT single VNAM FROM TKESV INTO @DATA(ld_c_vnam).
 
"SELECT single APPLCLASS FROM RKB1D INTO @DATA(ld_i_applclass).
 
"SELECT single FIELD FROM CFBCH01 INTO @DATA(ld_i_fnam).
 
 
"SELECT single VNAM FROM TKESV INTO @DATA(ld_i_vnam).
 
"SELECT single VARTYP FROM TKESV INTO @DATA(ld_i_vartyp).
 
 
"SELECT single DTYPE FROM CDIFIE INTO @DATA(ld_i_dtype).
 
"SELECT single VNOOBL FROM TKESV INTO @DATA(ld_i_vnoobl).
 
"SELECT single VPARSEL FROM TKESV INTO @DATA(ld_i_vparsel).
DATA(ld_i_vparsel) = '*'.
 


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!