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 - return more than 1 field in return_values?

former_member294023
Participant

In a dialog program I"m using the 'on value request' to call a routine that builds a dropdown on a field. It looks like this:

PROCESS ON VALUE-REQUEST.

FIELD ekpo_ci-zzlicnum module build_search.

Within build_search, I build itab_values with the dropdown values and the function module is called:

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING RETFIELD = 'ZZLICNUM'

DYNPPROG = w_progname

DYNPNR = w_scr_num

DYNPROFIELD = 'ZZLICNUM'

VALUE_ORG = 'S'

TABLES

VALUE_TAB = ITAB_VALUES

RETURN_TAB = RETURN_VALUES

EXCEPTIONS

PARAMETER_ERROR = 1

NO_VALUES_FOUND = 2

OTHERS = 3.

The routine calls F4IF_INT_TABLE_VALUE_REQUEST and in the dropdown, 5 fields are shown in each row (built in an internal table itab_values). When I select one of the rows, it returns the field value for zzlicnum in return_values. Is there a way to also return the other values I have in itab_values (other than just zzlicnum) - I need to use the other fields that are associated with zzlicnum in my program for some additional logic.

I appreciate any help!

1 ACCEPTED SOLUTION

Former Member

hi,

refer to these codes:

you can change something according to your requirement.


PARAMETERS:
  a TYPE char10,
  b TYPE char10,
  c TYPE char10.


DATA:
  BEGIN OF tab OCCURS 0,
    field1 TYPE char10,
    field2 TYPE char10,
    field3 TYPE char10,
  END OF tab,
  wa LIKE LINE OF tab,
  DYNPFLD_MAPPING TYPE STANDARD TABLE OF DSELC,
  dyn_wa TYPE DSELC,
  lt_return TYPE TABLE OF DDSHRETVAL,
  lwa_return TYPE ddshretval.

INITIALIZATION.
  wa-field1 = 'aaaaa'.
  wa-field2 = 'bbbbb'.
  wa-field3 = 'ccccc'.
  APPEND wa to tab.

  wa-field1 = 'aaaaa'.
  wa-field2 = 'bbccc'.
  wa-field3 = 'ddddd'.
  APPEND wa to tab.

  wa-field1 = 'aaaab'.
  wa-field2 = 'bbccc'.
  wa-field3 = 'eeeee'.
  APPEND wa to tab.

  dyn_wa-FLDNAME = 'FIELD1'.
  dyn_wa-DYFLDNAME = 'A'.
  APPEND dyn_wa to DYNPFLD_MAPPING.

  dyn_wa-FLDNAME = 'FIELD2'.
  dyn_wa-DYFLDNAME = 'B'.
  APPEND dyn_wa to DYNPFLD_MAPPING.

  dyn_wa-FLDNAME = 'FIELD3'.
  dyn_wa-DYFLDNAME = 'C'.
  APPEND dyn_wa to DYNPFLD_MAPPING.
*
AT SELECTION-SCREEN on VALUE-REQUEST FOR a.
  CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
*     DDIC_STRUCTURE         = ' '
      retfield               = 'FIELD1'
*     PVALKEY                = ' '
      DYNPPROG               = sy-cprog
      DYNPNR                 = '1000'
      DYNPROFIELD            = 'A'
*     STEPL                  = 0
*     WINDOW_TITLE           = WINDOW_TITLE
*     VALUE                  = ' '
      VALUE_ORG              = 'S'
*     MULTIPLE_CHOICE        = ' '
*     DISPLAY                = ' '
     CALLBACK_PROGRAM       = sy-cprog
     CALLBACK_FORM          = 'CALLBACK_F4'
*     MARK_TAB               = MARK_TAB
*   IMPORTING
*     USER_RESET             = USER_RESET
    TABLES
      value_tab              = tab
*     FIELD_TAB              = FIELD_TAB
      RETURN_TAB             = lt_return
*      DYNPFLD_MAPPING        = 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.


form callback_f4 TABLES record_tab STRUCTURE seahlpres
            CHANGING shlp TYPE shlp_descr
                     callcontrol LIKE ddshf4ctrl.
  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 'F0001'  AND
*          fieldname NE 'F0002'  AND
*          fieldname NE 'F0003' ).
*  " Overwrite selectable fields on search help
  REFRESH: shlp-interface.
  ls_intf-shlpfield = 'F0001'.
  ls_intf-valfield  = 'A'.
  ls_intf-f4field   = 'X'.
  APPEND ls_intf TO shlp-interface.
  ls_intf-shlpfield = 'F0002'.
  ls_intf-valfield  = 'B'.
  ls_intf-f4field   = 'X'.
  APPEND ls_intf TO shlp-interface.
  ls_intf-shlpfield = 'F0003'.
  ls_intf-valfield  = 'C'.
  ls_intf-f4field   = 'X'.
  APPEND ls_intf TO shlp-interface.
ENDFORM.
           

9 REPLIES 9

Former Member
0 Kudos

Hi,

Check this Fm HELP_VALUES_GET_WITH_TABLE

0 Kudos

Do you mean use HELP_VALUES_GET_WITH_TABLE instead of F4IF_INT_TABLE_VALUE_REQUEST, or in addition to it - there is no documentation about help_values_get_with_table.

Former Member

hi,

refer to these codes:

you can change something according to your requirement.


PARAMETERS:
  a TYPE char10,
  b TYPE char10,
  c TYPE char10.


DATA:
  BEGIN OF tab OCCURS 0,
    field1 TYPE char10,
    field2 TYPE char10,
    field3 TYPE char10,
  END OF tab,
  wa LIKE LINE OF tab,
  DYNPFLD_MAPPING TYPE STANDARD TABLE OF DSELC,
  dyn_wa TYPE DSELC,
  lt_return TYPE TABLE OF DDSHRETVAL,
  lwa_return TYPE ddshretval.

INITIALIZATION.
  wa-field1 = 'aaaaa'.
  wa-field2 = 'bbbbb'.
  wa-field3 = 'ccccc'.
  APPEND wa to tab.

  wa-field1 = 'aaaaa'.
  wa-field2 = 'bbccc'.
  wa-field3 = 'ddddd'.
  APPEND wa to tab.

  wa-field1 = 'aaaab'.
  wa-field2 = 'bbccc'.
  wa-field3 = 'eeeee'.
  APPEND wa to tab.

  dyn_wa-FLDNAME = 'FIELD1'.
  dyn_wa-DYFLDNAME = 'A'.
  APPEND dyn_wa to DYNPFLD_MAPPING.

  dyn_wa-FLDNAME = 'FIELD2'.
  dyn_wa-DYFLDNAME = 'B'.
  APPEND dyn_wa to DYNPFLD_MAPPING.

  dyn_wa-FLDNAME = 'FIELD3'.
  dyn_wa-DYFLDNAME = 'C'.
  APPEND dyn_wa to DYNPFLD_MAPPING.
*
AT SELECTION-SCREEN on VALUE-REQUEST FOR a.
  CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
*     DDIC_STRUCTURE         = ' '
      retfield               = 'FIELD1'
*     PVALKEY                = ' '
      DYNPPROG               = sy-cprog
      DYNPNR                 = '1000'
      DYNPROFIELD            = 'A'
*     STEPL                  = 0
*     WINDOW_TITLE           = WINDOW_TITLE
*     VALUE                  = ' '
      VALUE_ORG              = 'S'
*     MULTIPLE_CHOICE        = ' '
*     DISPLAY                = ' '
     CALLBACK_PROGRAM       = sy-cprog
     CALLBACK_FORM          = 'CALLBACK_F4'
*     MARK_TAB               = MARK_TAB
*   IMPORTING
*     USER_RESET             = USER_RESET
    TABLES
      value_tab              = tab
*     FIELD_TAB              = FIELD_TAB
      RETURN_TAB             = lt_return
*      DYNPFLD_MAPPING        = 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.


form callback_f4 TABLES record_tab STRUCTURE seahlpres
            CHANGING shlp TYPE shlp_descr
                     callcontrol LIKE ddshf4ctrl.
  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 'F0001'  AND
*          fieldname NE 'F0002'  AND
*          fieldname NE 'F0003' ).
*  " Overwrite selectable fields on search help
  REFRESH: shlp-interface.
  ls_intf-shlpfield = 'F0001'.
  ls_intf-valfield  = 'A'.
  ls_intf-f4field   = 'X'.
  APPEND ls_intf TO shlp-interface.
  ls_intf-shlpfield = 'F0002'.
  ls_intf-valfield  = 'B'.
  ls_intf-f4field   = 'X'.
  APPEND ls_intf TO shlp-interface.
  ls_intf-shlpfield = 'F0003'.
  ls_intf-valfield  = 'C'.
  ls_intf-f4field   = 'X'.
  APPEND ls_intf TO shlp-interface.
ENDFORM.
           

0 Kudos

I'm trying to do this, but I'm having a problem. Here is my whole scenario: I'm adding 3 fields to the purchase order line by implementing SAP enhancement MM06E005. This allows addition of fields to ekpo and also to the purchase order (me21n, me22n, and me23n). Function group used is XM06. In the PAI of the screen I do the PROCESS ON VALUE-REQUEST and FIELD ekpo_ci-zzlicnum module build search - build search is where I build the dropdown using F4IF_INT_TABLE_VALUE_REQUEST. I can see in that function module where you suggest using the callback_form parameter, which I'm trying to do; however, where in the function group do I put the actual FORM/ENDFORM? Seems that no matter where I put it, I get a run time error PERFORM NOT FOUND: It says: The program SAPLSDHI is meant to execute an external perform namely the routine 'CALLBACK_F4' of the program RM_MEPO_GUI and this routine does not exist. CALLBACK_F4 is what I have in the CALLBACK_FORM parameter and is also the name of the FORM I've created.

0 Kudos

Hi Leslie,

Go to SE80, choose Function group as program type-> display main program of this Function Group.

Now uncomment inlcude LXAAAF01 where AAA stands for program name. This include is intended for subroutine definitions. Go insinde and type your form here. Activate main Function Group program and try once again. Your subroutine should now be visible.

Regards

Marcin

0 Kudos

Hi Leslie,

I think you can try to do what Marcin say.

In function group XXXF01 is the include file to put your subroutines.

Regards,

Huai Zhi

0 Kudos

Thank you all for your help! Looks like I can do this now...

dev_parbutteea
Active Contributor
0 Kudos

Hi,

Just do a read on ITAB_VALUES with the values returned in RETURN_VALUES.

0 Kudos

That won't work for me, because the field I'm returning isn't necesarily unique - I could have 5 rows displayed in the dropdown, and zzlicnum could be the same for all; the other information would be unique and that's the info I"m trying to capture.