SAP FIELD_CHOICE Function Module for Field Selection









FIELD_CHOICE is a standard field choice SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Field Selection 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 field choice FM, simply by entering the name FIELD_CHOICE into the relevant SAP transaction such as SE37 or SE38.

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



Function FIELD_CHOICE 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 'FIELD_CHOICE'"Field Selection
EXPORTING
* MAXFIELDS = "Maximum Field Selection
* NOSORT = ' ' "Do Not Sort Field Set
* NOMOVE = ' ' "Do Not Change Sequence of Selected Set
* INITIAL_SORT = 0 "Sort Field Set When Call?
* TITEL1 = "Header of Left Table Control
* TITEL2 = "Header of Right Table Control
* POPUPTITEL = "Dialog Box Header
* NOTDELETEABLE = "Specified Fields Cannot Be Deleted
* INFO_TEXT = "Help Text
* DYN_PUSHBUTTON_TEXT1 = "Additional Button
* DYN_PUSHBUTTON_TEXT2 = "Additional Button
* DYN_PUSHBUTTON_TEXT3 = "Additional Button

IMPORTING
RETURN_CODE = "Return Code

TABLES
FIELDTABIN = "Table of Fields That Can Be Selected
SELFIELDS = "Table with Selected Fields
* EXCEPT_TAB = "Exception Conditions for Selecting Fields

EXCEPTIONS
NO_TAB_FIELD_INPUT = 1 TO_MANY_SELFIELDS_ENTRIES = 2
.



IMPORTING Parameters details for FIELD_CHOICE

MAXFIELDS - Maximum Field Selection

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

NOSORT - Do Not Sort Field Set

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

NOMOVE - Do Not Change Sequence of Selected Set

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

INITIAL_SORT - Sort Field Set When Call?

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

TITEL1 - Header of Left Table Control

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

TITEL2 - Header of Right Table Control

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

POPUPTITEL - Dialog Box Header

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

NOTDELETEABLE - Specified Fields Cannot Be Deleted

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

INFO_TEXT - Help Text

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

DYN_PUSHBUTTON_TEXT1 - Additional Button

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

DYN_PUSHBUTTON_TEXT2 - Additional Button

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

DYN_PUSHBUTTON_TEXT3 - Additional Button

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

EXPORTING Parameters details for FIELD_CHOICE

RETURN_CODE - Return Code

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

TABLES Parameters details for FIELD_CHOICE

FIELDTABIN - Table of Fields That Can Be Selected

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

SELFIELDS - Table with Selected Fields

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

EXCEPT_TAB - Exception Conditions for Selecting Fields

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

EXCEPTIONS details

NO_TAB_FIELD_INPUT - Table Fieldtabin is empty

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

TO_MANY_SELFIELDS_ENTRIES - Table Selfields Contains Too Many Fields

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

Copy and paste ABAP code example for FIELD_CHOICE 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_maxfields  TYPE I, "   
lt_fieldtabin  TYPE STANDARD TABLE OF I, "   
lv_return_code  TYPE SY-SUBRC, "   
lv_no_tab_field_input  TYPE SY, "   
lv_nosort  TYPE SY, "   SPACE
lv_nomove  TYPE FLAG, "   SPACE
lv_initial_sort  TYPE I, "   0
lv_titel1  TYPE I, "   
lt_selfields  TYPE STANDARD TABLE OF I, "   
lv_to_many_selfields_entries  TYPE I, "   
lv_titel2  TYPE I, "   
lt_except_tab  TYPE STANDARD TABLE OF I, "   
lv_popuptitel  TYPE I, "   
lv_notdeleteable  TYPE I, "   
lv_info_text  TYPE DOKHL-OBJECT, "   
lv_dyn_pushbutton_text1  TYPE DOKHL, "   
lv_dyn_pushbutton_text2  TYPE DOKHL, "   
lv_dyn_pushbutton_text3  TYPE DOKHL. "   

  CALL FUNCTION 'FIELD_CHOICE'  "Field Selection
    EXPORTING
         MAXFIELDS = lv_maxfields
         NOSORT = lv_nosort
         NOMOVE = lv_nomove
         INITIAL_SORT = lv_initial_sort
         TITEL1 = lv_titel1
         TITEL2 = lv_titel2
         POPUPTITEL = lv_popuptitel
         NOTDELETEABLE = lv_notdeleteable
         INFO_TEXT = lv_info_text
         DYN_PUSHBUTTON_TEXT1 = lv_dyn_pushbutton_text1
         DYN_PUSHBUTTON_TEXT2 = lv_dyn_pushbutton_text2
         DYN_PUSHBUTTON_TEXT3 = lv_dyn_pushbutton_text3
    IMPORTING
         RETURN_CODE = lv_return_code
    TABLES
         FIELDTABIN = lt_fieldtabin
         SELFIELDS = lt_selfields
         EXCEPT_TAB = lt_except_tab
    EXCEPTIONS
        NO_TAB_FIELD_INPUT = 1
        TO_MANY_SELFIELDS_ENTRIES = 2
. " FIELD_CHOICE




ABAP code using 7.40 inline data declarations to call FM FIELD_CHOICE

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 SUBRC FROM SY INTO @DATA(ld_return_code).
 
 
DATA(ld_nosort) = ' '.
 
DATA(ld_nomove) = ' '.
 
 
 
 
 
 
 
 
 
"SELECT single OBJECT FROM DOKHL INTO @DATA(ld_info_text).
 
 
 
 


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!