Sie sind auf Seite 1von 4

F4 Search Help to select more than one column value


The main target of this document is to provide basic knowledge for freshers on how to create and use of custom search help by using the Function Module 'F4IF_INT_TABLE_VALUE_REQUEST'. This document covers the topic, regarding how to select more than one column value on selection-screen Using F4-Help. Sample Scenario: 1. The selection screen comprises of two fields material and material description, Here we create custom search help using the function module 'F4IF_INT_TABLE_VALUE_REQUEST' for Material (MATNR). So the target is whenever the user does F4 on material field and selects the material, along with material number the description of material should be displayed in the respective field i.e., Material Description. Please find the below screen shots for the sample scenario.


Click F4 on Material field, you will get below sample screen.

3. Select Any material from the Search help. Then along with Material Number the Description of the Material also is displayed in the respective field.

Please find the below sample code to achieve the above scenario.
*&---------------------------------------------------------------------* *& Report ZF4HELP_MULTIPLE *& *&---------------------------------------------------------------------* REPORT zf4help_multiple NO STANDARD PAGE HEADING.

*====> Types Declaration

TYPES: BEGIN OF ty_makt, matnr TYPE matnr, " Material Number maktx TYPE maktx, " Material Description (Short Text) END OF ty_makt. *====> Internal tables Declaraiton DATA: t_values TYPE STANDARD TABLE OF ty_makt. DATA: t_return TYPE STANDARD TABLE OF ddshretval. DATA: t_mapping TYPE STANDARD TABLE OF dselc. *====> Work Area Declaration DATA: s_values TYPE ty_makt. DATA: s_return TYPE ddshretval. DATA: s_mapping TYPE dselc. *--------------------------------------------------------------------* *========== S E L E C T I O N - S C R E E N - D E S I G N ===========* *--------------------------------------------------------------------* PARAMETERS: p_matnr TYPE matnr, p_maktx TYPE maktx.

*====> Selection Screen Events AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_matnr. *====> Select query is to get the Material & Material description based on the Login Language SELECT matnr "-> F0001 maktx "-> F0002 FROM makt INTO TABLE t_values UP TO 50 ROWS WHERE spras = sy-langu.

s_mapping-fldname = 'F0001'. s_mapping-dyfldname = 'P_MATNR'. APPEND s_mapping TO t_mapping. CLEAR s_mapping. s_mapping-fldname = 'F0002'. s_mapping-dyfldname = 'P_MAKTX'. APPEND s_mapping TO t_mapping. CLEAR s_mapping. CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST' EXPORTING retfield = 'MATNR' dynpprog = sy-cprog dynpnr = sy-dynnr dynprofield = 'P_MATNR' window_title = 'Selection of Material with Description' value_org = 'S' TABLES value_tab = t_values return_tab = t_return dynpfld_mapping = t_mapping EXCEPTIONS parameter_error = 1 no_values_found = 2 OTHERS = 3.