Application Development and Automation 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: 
Read only

Function module:F4IF_INT_TABLE_VALUE_REQUEST

Former Member
0 Likes
947

Hi,

I have used the function module F4IF_INT_TABLE_VALUE_REQUEST and get the F4 help for S_DECODE-LOW and S_DECODE-HIGH. And when i am selecting the value on the selection screen of F4 help it is not populating the value to the S_DECODE-LOW and S_DECODE-HIGH (Selection screen fields).

*-----------------------------------------------------------------------
* Initialization
*-----------------------------------------------------------------------
INITIALIZATION.
  v_repid = sy-repid.
  PERFORM get_period.
*-----------------------------------------------------------------------
* At Selection Screen output
*-----------------------------------------------------------------------
AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_dcode-low.
  PERFORM get_f4help_for_depcode.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_dcode-high.
  PERFORM get_f4help_for_depcode.

*-----------------------------------------------------------------------
* At Selection Screen
*-----------------------------------------------------------------------
AT SELECTION-SCREEN.
  PERFORM validate_selscr_values.

FORM get_f4help_for_depcode .

  TYPES:BEGIN OF t_decode,
        depcode TYPE /irm/ip_depcode,
        descr   TYPE /irm/gdescr,
        END OF t_decode.
  DATA:it_decode TYPE STANDARD TABLE OF t_decode.
* DATA:wa_detcode TYPE t_decode.
  REFRESH:it_decode.
  SELECT depcode descr FROM /irm/tipdcdt INTO TABLE it_decode
                                         WHERE spras = 'E'
                                         AND depcode LIKE 'C%'.
  CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
      retfield        = 'DEPCODE'
      value_org       = 'S'
    TABLES
      value_tab       = it_decode
    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.

ENDFORM.                    " GET_F4HELP_FOR_DEPCODE

.

This is my code. Where did i make a mistake? Could you please help me in this regard?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
848

after selecting the value from popup, the selected value will be stored in return table, read that table and populate the select options manually.

6 REPLIES 6
Read only

Former Member
0 Likes
849

after selecting the value from popup, the selected value will be stored in return table, read that table and populate the select options manually.

Read only

Former Member
0 Likes
847

Hi,

Please add following exporting attributes in your function module

dynpprog = sy-repid

dynpnr = sy-dynnr

dynprofield = 'S_DCODE'

Read only

Former Member
0 Likes
847

after selection the selected values comes in return table and from there u read value from value_tab and populate the appropriate selection screen field.

regards

vivek

Read only

Former Member
0 Likes
847

Hi Ashok,

We have to pass and internal table to the return_tab in the importing parameters, which stores the value what we have selected.

Please look into the below code it will give you an idea.


DATA : BEGIN OF IT_KNA1 OCCURS 0,
          KUNNR LIKE KNA1-KUNNR,
          NAME1 LIKE KNA1-NAME1,
          NAME2 LIKE KNA1-NAME2,
          NAME3 TYPE CHAR80,
       END OF IT_KNA1.

DATA : IT_RETURN LIKE DDSHRETVAL OCCURS 0 WITH HEADER LINE.

PARAMETERS : P_OWNER TYPE CHAR80.



AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_OWNER.


  SELECT KUNNR
         NAME1
         NAME2
         FROM KNA1 INTO TABLE IT_KNA1
         UP TO 20 ROWS.

  LOOP AT IT_KNA1.
    CONCATENATE IT_KNA1-NAME2 ',' IT_KNA1-NAME1 INTO IT_KNA1-NAME3.
    MODIFY IT_KNA1.
    CLEAR IT_KNA1.
  ENDLOOP.
  

  CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
      RETFIELD               = 'KUNNR'
      DYNPPROG               = SY-REPID
      DYNPROFIELD            = 'P_OWNER'
*    VALUE                  = ' '
      VALUE_ORG              = 'S'
*    MULTIPLE_CHOICE        = ' '
*    DISPLAY                = ' '
     CALLBACK_PROGRAM       = SY-REPID
*    CALLBACK_FORM          = ' '
*    MARK_TAB               =
*  IMPORTING
*    USER_RESET             =
    TABLES
      VALUE_TAB              = IT_KNA1[]
*    FIELD_TAB              =
     RETURN_TAB             = IT_RETURN[]
*    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.

  READ TABLE IT_RETURN INDEX 1.
  WRITE : IT_RETURN-FIELDVAL TO P_OWNER.

regards

Kumar M

Read only

Former Member
0 Likes
847

Hi Ashok,

Follow Chetan's reply with a small correction:

Hi,

Please add following exporting attributes in your function module

dynpprog = sy-repid

dynpnr = sy-dynnr

dynprofield = 'S_DCODE'

dynprofield = 'S_DCODE-LOW'

Now you will think that you will have to create two subroutines for same search help. Answer is NO.

pass the field name to the search help subroutine and use them in the FM sothing like this:

FORM srch_hlp using fld_name.

CALL FUNCTION F4_IF...........

IMPORTING

.

.

dynprofield = FLD_NAME.

This will solve your problem.

Regards,

Prakash Pandey

Read only

Former Member
0 Likes
847

Hi,


*-----------------------------------------------------------------------
* Initialization
*-----------------------------------------------------------------------
INITIALIZATION.
  v_repid = sy-repid.
  PERFORM get_period.
*-----------------------------------------------------------------------
* At Selection Screen output
*-----------------------------------------------------------------------
AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_dcode-low.
  PERFORM get_f4help_for_depcode USING 'S_DCODE-LOW'.      "<------
AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_dcode-high.
  PERFORM get_f4help_for_depcode USING 'S_DCODE-HIGH'.      "<------
 
*-----------------------------------------------------------------------
* At Selection Screen
*-----------------------------------------------------------------------
AT SELECTION-SCREEN.
  PERFORM validate_selscr_values.
 
FORM get_f4help_for_depcode using FIELD .      "<------
 
  TYPES:BEGIN OF t_decode,
        depcode TYPE /irm/ip_depcode,
        descr   TYPE /irm/gdescr,
        END OF t_decode.

  DATA:it_decode TYPE STANDARD TABLE OF t_decode.
* DATA:wa_detcode TYPE t_decode.

  REFRESH:it_decode.

  SELECT depcode descr FROM /irm/tipdcdt INTO TABLE it_decode
                                         WHERE spras = 'E'
                                         AND depcode LIKE 'C%'.

  CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
      retfield        = 'DEPCODE'
      dynpprog        = sy-cprog     "<------
      dynpnr          = '1000'      "<------
      dynprofield     = FIELD     "<------
      value_org       = 'S'
    TABLES
      value_tab       = it_decode
    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.
 
ENDFORM.                    " GET_F4HELP_FOR_DEPCODE