Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

F4IF_INT_TABLE_VALUE_REQUEST Functionality

roberto_falk
Participant
0 Kudos

Hello all,

How can I return more then one value using the FM F4IF_INT_TABLE_VALUE_REQUEST.

Example:


Parameters:
pernr TYPE pa0001-pernr,
sname TYPE pa0001-sname.

When I click "F4" inside the field (parameter) pernr, the following list is showed...

Number - Name

===========

1234 - Roberto


5678 - Falk


When I select the first line, I need to receive both values (Number and Name), no just the Name.

1 ACCEPTED SOLUTION

uwe_schieferstein
Active Contributor
0 Kudos

Hello Roberto

Yes, you can return multiple values using this function module. All you need to do is to define a <b>CALLBACK </b>routine for modifying the search help.

Have a look at the following sample report <b>ZUS_SDN_F4IF_INT_TAB_VAL_REQ</b>. If you define two columns on the search help that are return you retrieve two entries in the values itab for each selected F4 entry (in case of muliple select possible).


*&---------------------------------------------------------------------*
*& Report  ZUS_SDN_F4IF_INT_TAB_VAL_REQ
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  zus_sdn_f4if_int_tab_val_req.

TYPE-POOLS: shlp.


DATA:
  gd_repid     TYPE syrepid,
  gt_knb1      TYPE STANDARD TABLE OF knb1,
*
  gt_values    TYPE STANDARD TABLE OF ddshretval.




START-OF-SELECTION.

  gd_repid = syst-repid.

  SELECT * FROM knb1 INTO TABLE gt_knb1 UP TO 100 ROWS.


  CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
      ddic_structure         = 'KNB1'
      retfield               = 'KUNNR'  " overwritten in callback !!!
*     PVALKEY                = ' '
*     DYNPPROG               = ' '
*     DYNPNR                 = ' '
*     DYNPROFIELD            = ' '
*     STEPL                  = 0
*     WINDOW_TITLE           =
*     VALUE                  = ' '
      value_org              = 'S'  " structure
*     MULTIPLE_CHOICE        = ' '
*     DISPLAY                = ' '
      callback_program       = gd_repid
      callback_form          = 'CALLBACK_F4'
*     MARK_TAB               =
*   IMPORTING
*     USER_RESET             =
    TABLES
      value_tab              = gt_knb1
*     FIELD_TAB              =
      return_tab             = gt_values
*     DYNPFLD_MAPPING        =
    EXCEPTIONS
      parameter_error        = 1
      no_values_found        = 2
      OTHERS                 = 3.
  IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.


  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
    EXPORTING
      i_structure_name = 'DDSHRETVAL'
    TABLES
      t_outtab         = gt_values
    EXCEPTIONS
      program_error    = 1
      OTHERS           = 2.
  IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.



END-OF-SELECTION.
*&---------------------------------------------------------------------*
*&      Form  CALLBACK_F4
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM callback_f4
            TABLES record_tab STRUCTURE seahlpres
            CHANGING shlp TYPE shlp_descr
                     callcontrol LIKE ddshf4ctrl.
* define local data
  DATA:
    ls_intf     LIKE LINE OF shlp-interface,
    ls_prop     LIKE LINE OF shlp-fieldprop.



  " Hide unwanted fields
  CLEAR: ls_prop-shlpselpos,
         ls_prop-shlplispos.
  MODIFY shlp-fieldprop FROM ls_prop
    TRANSPORTING shlpselpos shlplispos
  WHERE ( fieldname NE 'BUKRS'  AND
          fieldname NE 'KUNNR'  AND
          fieldname NE 'PERNR' ).


  " Overwrite selectable fields on search help
  REFRESH: shlp-interface.
  ls_intf-shlpfield = 'BUKRS'.
  ls_intf-valfield  = 'X'.
  APPEND ls_intf TO shlp-interface.
  ls_intf-shlpfield = 'KUNNR'.
  APPEND ls_intf TO shlp-interface.


ENDFORM.                    " CALLBACK_F4

Regards

Uwe

4 REPLIES 4

roberto_falk
Participant
0 Kudos

...finalizing the message.

Thanks all the help.

Roberto Falk

0 Kudos

When you use the FM, you need to pass a table with possible values, right? So, when the user selects one entry, you can perform a READ TABLE under the values tables and gather the other fields...

Greetings,

Blag.

0 Kudos

Hello Alvaro,

I understand your anwser, but lets considering that the pernr is not unique... I know that it is, but in my problem here, the value that returns is not unique.

Thanks a lot,

Roberto Falk

uwe_schieferstein
Active Contributor
0 Kudos

Hello Roberto

Yes, you can return multiple values using this function module. All you need to do is to define a <b>CALLBACK </b>routine for modifying the search help.

Have a look at the following sample report <b>ZUS_SDN_F4IF_INT_TAB_VAL_REQ</b>. If you define two columns on the search help that are return you retrieve two entries in the values itab for each selected F4 entry (in case of muliple select possible).


*&---------------------------------------------------------------------*
*& Report  ZUS_SDN_F4IF_INT_TAB_VAL_REQ
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  zus_sdn_f4if_int_tab_val_req.

TYPE-POOLS: shlp.


DATA:
  gd_repid     TYPE syrepid,
  gt_knb1      TYPE STANDARD TABLE OF knb1,
*
  gt_values    TYPE STANDARD TABLE OF ddshretval.




START-OF-SELECTION.

  gd_repid = syst-repid.

  SELECT * FROM knb1 INTO TABLE gt_knb1 UP TO 100 ROWS.


  CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
      ddic_structure         = 'KNB1'
      retfield               = 'KUNNR'  " overwritten in callback !!!
*     PVALKEY                = ' '
*     DYNPPROG               = ' '
*     DYNPNR                 = ' '
*     DYNPROFIELD            = ' '
*     STEPL                  = 0
*     WINDOW_TITLE           =
*     VALUE                  = ' '
      value_org              = 'S'  " structure
*     MULTIPLE_CHOICE        = ' '
*     DISPLAY                = ' '
      callback_program       = gd_repid
      callback_form          = 'CALLBACK_F4'
*     MARK_TAB               =
*   IMPORTING
*     USER_RESET             =
    TABLES
      value_tab              = gt_knb1
*     FIELD_TAB              =
      return_tab             = gt_values
*     DYNPFLD_MAPPING        =
    EXCEPTIONS
      parameter_error        = 1
      no_values_found        = 2
      OTHERS                 = 3.
  IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.


  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
    EXPORTING
      i_structure_name = 'DDSHRETVAL'
    TABLES
      t_outtab         = gt_values
    EXCEPTIONS
      program_error    = 1
      OTHERS           = 2.
  IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.



END-OF-SELECTION.
*&---------------------------------------------------------------------*
*&      Form  CALLBACK_F4
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM callback_f4
            TABLES record_tab STRUCTURE seahlpres
            CHANGING shlp TYPE shlp_descr
                     callcontrol LIKE ddshf4ctrl.
* define local data
  DATA:
    ls_intf     LIKE LINE OF shlp-interface,
    ls_prop     LIKE LINE OF shlp-fieldprop.



  " Hide unwanted fields
  CLEAR: ls_prop-shlpselpos,
         ls_prop-shlplispos.
  MODIFY shlp-fieldprop FROM ls_prop
    TRANSPORTING shlpselpos shlplispos
  WHERE ( fieldname NE 'BUKRS'  AND
          fieldname NE 'KUNNR'  AND
          fieldname NE 'PERNR' ).


  " Overwrite selectable fields on search help
  REFRESH: shlp-interface.
  ls_intf-shlpfield = 'BUKRS'.
  ls_intf-valfield  = 'X'.
  APPEND ls_intf TO shlp-interface.
  ls_intf-shlpfield = 'KUNNR'.
  APPEND ls_intf TO shlp-interface.


ENDFORM.                    " CALLBACK_F4

Regards

Uwe