[[{“value”:”
Introduction :
In SAP ABAP, F4 Help (Search Help) is used to help users select valid values instead of entering them manually. Sometimes, the standard search help does not meet business requirements, and a custom F4 Help needs to be created. In this example, we will create a custom F4 Help for a currency field using the function module F4IF_INT_TABLE_VALUE_REQUEST . The currency codes and descriptions are fetched from the TCURC and TCURT tables and displayed in a user-friendly selection list.
REPORT zva_search_help_parameter.
*———————————————————————*
* Selection Screen
*———————————————————————*
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
” Amount Parameter
PARAMETERS : p_amount TYPE ktwrt,
” Currency Parameter for Custom F4 Help
p_wears TYPE tcurc-waers.
SELECTION-SCREEN END OF BLOCK b1.
*———————————————————————*
* Custom F4 Help for Currency Field
*———————————————————————*
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_wears.
” Internal table to store selected value
DATA: lt_values TYPE TABLE OF ddshretval.
” Internal table for field information (optional)
DATA: lt_fields TYPE STANDARD TABLE OF dfies.
” Fetch Currency Key and Currency Description
SELECT a~waers,
b~ltext
FROM tcurc AS a
INNER JOIN tcurt AS b
ON a~waers = b~waers
WHERE b~spras = ‘E’ ” English Language Texts
INTO TABLE @DATA(lt_list).
” Display Custom F4 Help Popup
CALL FUNCTION ‘F4IF_INT_TABLE_VALUE_REQUEST’
EXPORTING
retfield = ‘WAERS’ ” Return Currency Key
dynpprog = sy-repid ” Current Program Name
dynpnr = sy-dynnr ” Current Screen Number
dynprofield = ‘P_WEARS’ ” Selection Screen Field
value_org = ‘S’ ” Structured Internal Table
TABLES
value_tab = lt_list ” Data to Display in F4 Help
EXCEPTIONS
parameter_error = 1
no_values_found = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ‘No values found for Currency Search Help’
TYPE ‘I’.
ENDIF.
Output :
Conclusion :
Creating a custom F4 Help in ABAP improves the user experience by providing meaningful value selections. Using F4IF_INT_TABLE_VALUE_REQUEST , we can easily display data from internal tables and return the selected value to a screen field. This approach is useful when custom search logic or additional information needs to be displayed to users.
“}]]
Read More Technology Blog Posts by Members articles
#abap