Professional Documents
Culture Documents
Add Search Help To Screen Field in SAP
Add Search Help To Screen Field in SAP
Add Search Help To Screen Field in SAP
Search Helps forms an integral part of Data Dictionary in SAP. We can attach Search Help in two ways: 1] STATIC HELP ATTACHMENT 2] DYNAMIC HELP ATTACHMENT
1. Static Attachement a) To a selection-screen element: We can attach search help statically using Matchcode.
b) To a Dynpro element: Goto Layout -> Field Attributes -> Dict Tab > Search Help Field. Specify the search help which you want to attach.
Following program shows the way to attach a search help dynamically. REPORT z_test11 .
PARAMETERS: p_carrid(2). DATA: table1 LIKE ddshretval OCCURS 0 WITH HEADER LINE. AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_carrid.
CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST' EXPORTING tabname = 'scarr' fieldname = 'carrid' * SEARCHHELP = ' ' * SHLPPARAM = ' ' * DYNPPROG = ' ' * DYNPNR = ' ' * DYNPROFIELD = 'p_carrid' * STEPL = 0 * VALUE = ' ' * MULTIPLE_CHOICE = ' ' * DISPLAY = ' ' * SUPPRESS_RECORDLIST = ' ' * CALLBACK_PROGRAM = ' ' * CALLBACK_FORM = ' ' * SELECTION_SCREEN = ' ' TABLES
return_tab = table1 EXCEPTIONS field_not_found = 1 no_help_for_field = 2 inconsistent_help = 3 no_values_found = 4 OTHERS = 5 . IF sy-subrc 0. MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. ENDIF.
p_carrid = table1-fieldval.
START-OF-SELECTION. WRITE: p_carrid. b) To a Dynpro element: In PAI of the screen, call the event On alue Reuest. PROCESS ON VALUE-REQUEST. FIELD FIFLNAME1 MODULE get_objval.
There are couple of functions for attching a search help to the fields displayed on the screen.
a) F4IF_FIELD_VALUE_REQUEST - F4 help for fields that are only known at runtime. The parameters it takes are: searchhelp, shlpparam, dynpprog (program name), dynpnr (dynpro number), dynprofield(screen field to attach the help). b) F4IF_INT_TABLE_VALUE_REQUEST - F4 help also returning the value to be displayed in internal table. retfield, dynpprog (program name), dynpnr (dynpro number), dynprofield(screen field to attach the help), value_org = S (Structure), Internal Table containing data to be displayed.
And if you want to attach domain values to the search help, you can just use SQL to get data for the domain (from table DD07V) and then calling function module F4IF_INT_TABLE_VALUE_REQUEST.