Skip to Content
Technical Articles
Author's profile photo krishna sidda

Selecting multiple inputs from F4help, separated with comma(,) in input.

Hi all,

I would like to explain selecting multiple inputs from f4help, the selected inputs are separated with comma(,). This blog post will help to you.

I used the function module ‘F4IF_INT_TABLE_VALUE_REQUEST’ in exporting we have to enable multiple-choice = ‘X’ , it allows to select multiple records.

Take the two internal tables because after F4 event internal table holds one value only to store them in other internal table.

Finally process the data.

Follow below these steps:

PARAMETERS carrid TYPE char128.

DATA : BEGIN OF itab OCCURS 0,
         carrid TYPE sflight-carrid,
       END OF itab.
*Declare internal tables and work area.
DATA : rtab    TYPE TABLE OF ddshretval WITH HEADER LINE,
       ptab    TYPE TABLE OF ddshretval WITH HEADER LINE,
       ls_sel  TYPE ddshretval,
       ls_mark TYPE ddshmarks.
REFRESH rtab.
rtab-fieldname = 'CARRID'.
APPEND rtab.
*for f4 help use AT SELECTION-SCREEN ON VALUE-REQUEST
AT SELECTION-SCREEN ON VALUE-REQUEST FOR carrid.
  SELECT carrid FROM sflight INTO TABLE itab.
  IF sy-subrc = 0.
    SORT itab BY carrid.
    DELETE ADJACENT DUPLICATES FROM itab COMPARING carrid.
  ENDIF.

  CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
*     DDIC_STRUCTURE  = ' '
      retfield        = 'CARRID'
*     PVALKEY         = ' '
      dynpprog        = sy-repid
      dynpnr          = sy-dynnr
*     DYNPROFIELD     = ' '
*     STEPL           = 0
*     WINDOW_TITLE    =
*     VALUE           = ' '
      value_org       = 'S'
      multiple_choice = 'X' " Allows to select multiple records
*     DISPLAY         = ' '
*     CALLBACK_PROGRAM = ' '
*     CALLBACK_FORM   = ' '
*      mark_tab        = ls_mark
* IMPORTING
*     USER_RESET      =
    TABLES
      value_tab       = itab
*     FIELD_TAB       =
      return_tab      = rtab " This holds multiple records
*     DYNPFLD_MAPPING =
* EXCEPTIONS
*     PARAMETER_ERROR = 1
*     NO_VALUES_FOUND = 2
*     OTHERS          = 3 .
    .
  IF sy-subrc = 0.
*After F4 event rtab holds one value only so store them in other internal table
    ptab[] = rtab[].
  ENDIF.

  LOOP AT ptab INTO DATA(ls_tab).
    IF sy-tabix NE 1 AND ls_tab-fieldval IS NOT INITIAL.
      CONCATENATE carrid ',' ls_tab-fieldval  INTO carrid.
    ELSE.
      carrid =  ls_tab-fieldval.
    ENDIF.
    CLEAR ls_tab.
  ENDLOOP.

Save and activate the program, then click on execute.

Click on F4 help, select multiple inputs.

 

you will get the inputs separated with comma(,) as below.

 

I think it will help to you, meet you in next blog post.

Thank you,

Siva sidda

 

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.