We can help. Together we learn....

 

Sometime the requirement is such that search help is required from the values obtained in run time or from constant values. In this you can use the FM: F4IF_INT_TABLE_VALUE_REQUEST to meet your purpose. The basic logic is that it uses data from the internal table to show in the F4 search help.

 

Example: Here an internal table is populated with some constants. This program is just for guideline.

 

* Type for internal table for populating the file-type

 Types: BEGIN OF x_filtyp,

              filetype TYPE char3,          " File type

              description TYPE char50,      " description

             END OF x_filtyp.

 

***********************************************************************

* INTERNAL TABLES                                                     *

***********************************************************************

DATA:

* File type

i_filtyp TYPE STANDARD TABLE OF x_filtyp INITIAL SIZE 0,

 

PARAMETERS: p_file(3) TYPE c.

 

***********************************************************************

* INITIALIZATION                                                      *

***********************************************************************

INITIALIZATION.

*Populating file type in an internal table

  PERFORM sub_filtyp.

 

 

***********************************************************************

* AT SELECTION-SCREEN                                                 *

***********************************************************************

AT SELECTION-SCREEN.

* On value request for p_filtyp

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_filtyp .

  PERFORM sub_get_help_filtyp USING p_file.

 

*&---------------------------------------------------------------------*

*&      Form  sub_filtyp

*&---------------------------------------------------------------------*

FORM sub_filtyp.

 

* local variables

  DATA: l_wa_filtyp TYPE x_filtyp.   "work area

 

* Appending row

  l_wa_filtyp-filetype = c_a.

  l_wa_filtyp-description = 'Alphabet A'.

  APPEND l_wa_filtyp TO i_filtyp.

* Appending row

  l_wa_filtyp-filetype = c_b.

  l_wa_filtyp-description = 'Alphabet B'.

  APPEND l_wa_filtyp TO i_filtyp.

 

ENDFORM.                    "sub_filtyp

 

*&---------------------------------------------------------------------*

*&      Form  sub_get_help_filtyp

*&---------------------------------------------------------------------*

FORM sub_get_help_filtyp USING l_filtyp .

 

* local vairables

  DATA: l_dynfld    TYPE dynfnam,          "Screen Field Name

        l_retfld    TYPE fieldname,        "Return Field Name

        l_i_fields TYPE STANDARD TABLE OF dfies,    "for call function

        l_i_return TYPE TABLE OF ddshretval,        "for call function

        l_wa_field  TYPE dfies,                     "work area

        l_wa_return TYPE ddshretval,                "work

        l_wa_value  TYPE seahlpres,

        l_i_value   TYPE STANDARD TABLE OF seahlpres,

        l_i_mapping TYPE STANDARD TABLE OF dselc,

        l_wa_mapping TYPE dselc.

 

  l_wa_mapping-fldname = 'DESCRIPTION'.

  APPEND l_wa_mapping TO l_i_mapping.

 

  l_wa_field-fieldname = 'FILETYPE'.

  l_wa_field-tabname = 'I_FILTYP'.

  l_wa_field-intlen    = 6.

  l_wa_field-leng      = 6.

  l_wa_field-outputlen = 6.

  l_wa_field-position = 1 .

  l_wa_field-scrtext_s = l_wa_field-fieldname.

  l_wa_field-scrtext_m = l_wa_field-fieldname.

  l_wa_field-scrtext_l = l_wa_field-fieldname.

  l_wa_field-reptext   = l_wa_field-fieldname.

  APPEND l_wa_field TO l_i_fields.

  CLEAR l_wa_field .

 

  l_wa_field-fieldname = 'DESCRIPTION'.

  l_wa_field-tabname = 'I_FILTYP'.

*  l_wa_field-OFFSET = 3.

  l_wa_field-intlen    = 50.

  l_wa_field-leng      = 50.

  l_wa_field-outputlen = 50.

  l_wa_field-position = 2 .

  l_wa_field-scrtext_s = l_wa_field-fieldname.

  l_wa_field-scrtext_m = l_wa_field-fieldname.

  l_wa_field-scrtext_l = l_wa_field-fieldname.

  l_wa_field-reptext   = l_wa_field-fieldname.

  APPEND l_wa_field TO l_i_fields.

 

  LOOP AT i_filtyp INTO wa_filtyp.

    l_wa_value-string  = wa_filtyp-filetype.

    APPEND l_wa_value TO l_i_value.

    l_wa_value-string  = wa_filtyp-description.

    APPEND l_wa_value TO l_i_value.

  ENDLOOP.

 

  l_retfld = 'FILETYPE'.

  l_dynfld = l_filtyp.

 

* call fucntion for search help

  CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

    EXPORTING

      retfield         = l_retfld

      dynpprog         = sy-repid

      dynpnr           = sy-dynnr

      dynprofield      = l_dynfld

      window_title     = 'Filetype'

*      value_org        = 'S'

      callback_program = sy-repid

    TABLES

      value_tab        = l_i_value

      field_tab        = l_i_fields

      return_tab       = l_i_return

*      dynpfld_mapping  = l_i_mapping

    EXCEPTIONS

      parameter_error  = 1

      no_values_found  = 2

      OTHERS           = 3.

 

  IF sy-subrc NE 0.

   

  ELSE.

 

    READ TABLE l_i_return INTO l_wa_return

                WITH KEY fieldname = 'FILETYPE'.

    IF sy-subrc EQ 0.

      l_filtyp = l_wa_return-fieldval.

    ENDIF.

 

  ENDIF.

ENDFORM.                    " sub_get_help_filtyp

 

 

You can add your code in AT SELECTION-SCREEN for establishing dependency on two or more selection screen parameters.

 

Example:

 

PARAMETERS: p_matnr TYPE matnr,
p_check TYPE char1.

AT SELECTION-SCREEN.
IF p_matnr = '000000000000000023' .
p_check = '1'.
ELSEIF p_matnr = '1697'.
p_check = 2.
ENDIF.

  

 

Output

For P_matnr = 23 (selected by user), p_check will be automatically populated 1 and 2 for p_matnr = 1697.

0 comments:

Categories