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

F4IF_INT_TABLE_VALUE_REQUEST not using value_tab

Former Member
0 Likes
1,301

I am trying to use the F4IF_INT_TABLE_VALUE_REQUEST Function Module and am having a problem with passing the vlaue_tab. When the field is empty, it works fine, but when the field already has a value in it and the user invokes the F4 help again, the function module is re-populated using a custom set of values, based on the value of another field. I use DYNP_GET_STEPL and DYNP_VALUES_READ to check the value of the field and base the population of value_tab from that. Everything for that works fine and I have verified that right before the call to F4IF_INT_TABLE_VALUE_REQUEST the value_tab is populated correctly, but when it is called and the popup appears the values in value_tab are ignored and the only selection in the popup is the one that already is in the field. Are there some special parameter settings that change whether it uses the value_tab to display the values for selection?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,121

PROCESS ON VALUE-REQUEST.

   FIELD ZOSDR_HDR_S-DISC_REASON MODULE DISC_REASON200_F4.

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

MODULE DISC_REASON200_F4 INPUT.

REFRESH: reasons_t, fval_t, it_return.

CLEAR: fval, wa_return, ZOSDR_HDR_S-DISC_REASON.



* Get f4 field index

CALL FUNCTION 'DYNP_GET_STEPL'

IMPORTING

   POVSTEPL              = fval-stepl

EXCEPTIONS

   STEPL_NOT_FOUND       = 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.



fval-fieldname = 'ZOSDR_HDR_S-OSDR_TYPE'.

APPEND fval TO fval_t.



* Read field value for OSDR Type

CALL FUNCTION 'DYNP_VALUES_READ'

  EXPORTING

    DYNAME                               = sy-repid

    DYNUMB                               = sy-dynnr



  TABLES

    DYNPFIELDS                           = fval_t

EXCEPTIONS

   INVALID_ABAPWORKAREA                 = 1

   INVALID_DYNPROFIELD                  = 2

   INVALID_DYNPRONAME                   = 3

   INVALID_DYNPRONUMMER                 = 4

   INVALID_REQUEST                      = 5

   NO_FIELDDESCRIPTION                  = 6

   INVALID_PARAMETER                    = 7

   UNDEFIND_ERROR                       = 8

   DOUBLE_CONVERSION                    = 9

   STEPL_NOT_FOUND                      = 10

   OTHERS                               = 11.



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 fval_t INTO fval INDEX 1.



* Build values based on OSDR Type

CASE fval-fieldvalue.

  WHEN 'OVERAGE'.

    line-disc_reason = '*CUSTOMER SERVICE ERROR'.

    APPEND line TO reasons_t.

    line-disc_reason = '*SHIPPING ERROR'.

    APPEND line TO reasons_t.

    line-disc_reason = '*CUSTOMER RELATED'.

    APPEND line TO reasons_t.

    line-disc_reason = '*TRANSPORTATION ERROR'.

    APPEND line TO reasons_t.

    line-disc_reason = '*UNDETERMINED'.

    APPEND line TO reasons_t.

  WHEN 'SHORTAGE'.

    line-disc_reason = '*CUSTOMER SERVICE ERROR'.

    APPEND line TO reasons_t.

    line-disc_reason = '*SHIPPING ERROR'.

    APPEND line TO reasons_t.

    line-disc_reason = '*CUSTOMER RELATED'.

    APPEND line TO reasons_t.

    line-disc_reason = '*TRANSPORTATION ERROR'.

    APPEND line TO reasons_t.

    line-disc_reason = '*UNDETERMINED'.

    APPEND line TO reasons_t.

  WHEN 'DAMAGED'.

    line-disc_reason = '*DAMAGED WHILE UNLOADING'.

    APPEND line TO reasons_t.

    line-disc_reason = '*CRUSHED CASES'.

    APPEND line TO reasons_t.

    line-disc_reason = '*CUSTOMER RELATED'.

    APPEND line TO reasons_t.

    line-disc_reason = '*TRANSPORTATION ERROR'.

    APPEND line TO reasons_t.

  WHEN 'REFUSED'.

    line-disc_reason = '*CUSTOMER SERVICE ERROR'.

    APPEND line TO reasons_t.

    line-disc_reason = '*TEMPERATURE ISSUE'.

    APPEND line TO reasons_t.

    line-disc_reason = '*CUSTOMER RELATED'.

    APPEND line TO reasons_t.

    line-disc_reason = '*SHORT CODE DATE'.

    APPEND line TO reasons_t.

    line-disc_reason = '*MISCELLANOUS'.

    APPEND line TO reasons_t.

ENDCASE.

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

Everything works fine until here. When the field for the f4 is blank it fills the VALUE_TAB table (reasons_t) correctly, and also if the field is filled it works until here, and the table is filled correctly, but when the FM is called in the next line below it pops up with only the value that is already in the field, even though the value tab has 4 or 5 values in it

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

    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

      EXPORTING

        RETFIELD               = 'DISC_REASON'

        DYNPPROG               = sy-repid

        DYNPNR                 = sy-dynnr

        DYNPROFIELD            = 'ZOSDR_HDR_S-DISC_REASON'

        WINDOW_TITLE           = 'Discrepency Reason'

        VALUE_ORG              = 'S'

      TABLES

        VALUE_TAB              = reasons_t

        RETURN_TAB             = it_return

     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.

    ELSE.

      READ TABLE it_return INTO wa_return INDEX 1.

      ZOSDR_HDR_S-DISC_REASON = wa_return-fieldval.

    ENDIF.

ENDFORM.

8 REPLIES 8
Read only

kesavadas_thekkillath
Active Contributor
0 Likes
1,121

Could you please post your part of code.

Read only

Former Member
0 Likes
1,121

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_ernam. 

SELECT ernam FROM mara INTO TABLE it_ernam.

  CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

    EXPORTING

      retfield        = 'P_ERNAM'

      value_org       = 'S'

    TABLES

      value_tab       = it_ernam

      return_tab      = it_return1

    EXCEPTIONS

      parameter_error = 1

      no_values_found = 2

      OTHERS          = 3.

  p_ernam = it_return1-fieldval.

Hope this helps you.

Read only

0 Likes
1,121

Try to refresh it_return1 if it's not declared as local it.

Read only

Former Member
0 Likes
1,121

Hello,

You need to refresh your internal table before filling entries. Kindly paste your code here for more clarity.

Regards,

Deepti

Read only

Former Member
0 Likes
1,122

PROCESS ON VALUE-REQUEST.

   FIELD ZOSDR_HDR_S-DISC_REASON MODULE DISC_REASON200_F4.

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

MODULE DISC_REASON200_F4 INPUT.

REFRESH: reasons_t, fval_t, it_return.

CLEAR: fval, wa_return, ZOSDR_HDR_S-DISC_REASON.



* Get f4 field index

CALL FUNCTION 'DYNP_GET_STEPL'

IMPORTING

   POVSTEPL              = fval-stepl

EXCEPTIONS

   STEPL_NOT_FOUND       = 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.



fval-fieldname = 'ZOSDR_HDR_S-OSDR_TYPE'.

APPEND fval TO fval_t.



* Read field value for OSDR Type

CALL FUNCTION 'DYNP_VALUES_READ'

  EXPORTING

    DYNAME                               = sy-repid

    DYNUMB                               = sy-dynnr



  TABLES

    DYNPFIELDS                           = fval_t

EXCEPTIONS

   INVALID_ABAPWORKAREA                 = 1

   INVALID_DYNPROFIELD                  = 2

   INVALID_DYNPRONAME                   = 3

   INVALID_DYNPRONUMMER                 = 4

   INVALID_REQUEST                      = 5

   NO_FIELDDESCRIPTION                  = 6

   INVALID_PARAMETER                    = 7

   UNDEFIND_ERROR                       = 8

   DOUBLE_CONVERSION                    = 9

   STEPL_NOT_FOUND                      = 10

   OTHERS                               = 11.



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 fval_t INTO fval INDEX 1.



* Build values based on OSDR Type

CASE fval-fieldvalue.

  WHEN 'OVERAGE'.

    line-disc_reason = '*CUSTOMER SERVICE ERROR'.

    APPEND line TO reasons_t.

    line-disc_reason = '*SHIPPING ERROR'.

    APPEND line TO reasons_t.

    line-disc_reason = '*CUSTOMER RELATED'.

    APPEND line TO reasons_t.

    line-disc_reason = '*TRANSPORTATION ERROR'.

    APPEND line TO reasons_t.

    line-disc_reason = '*UNDETERMINED'.

    APPEND line TO reasons_t.

  WHEN 'SHORTAGE'.

    line-disc_reason = '*CUSTOMER SERVICE ERROR'.

    APPEND line TO reasons_t.

    line-disc_reason = '*SHIPPING ERROR'.

    APPEND line TO reasons_t.

    line-disc_reason = '*CUSTOMER RELATED'.

    APPEND line TO reasons_t.

    line-disc_reason = '*TRANSPORTATION ERROR'.

    APPEND line TO reasons_t.

    line-disc_reason = '*UNDETERMINED'.

    APPEND line TO reasons_t.

  WHEN 'DAMAGED'.

    line-disc_reason = '*DAMAGED WHILE UNLOADING'.

    APPEND line TO reasons_t.

    line-disc_reason = '*CRUSHED CASES'.

    APPEND line TO reasons_t.

    line-disc_reason = '*CUSTOMER RELATED'.

    APPEND line TO reasons_t.

    line-disc_reason = '*TRANSPORTATION ERROR'.

    APPEND line TO reasons_t.

  WHEN 'REFUSED'.

    line-disc_reason = '*CUSTOMER SERVICE ERROR'.

    APPEND line TO reasons_t.

    line-disc_reason = '*TEMPERATURE ISSUE'.

    APPEND line TO reasons_t.

    line-disc_reason = '*CUSTOMER RELATED'.

    APPEND line TO reasons_t.

    line-disc_reason = '*SHORT CODE DATE'.

    APPEND line TO reasons_t.

    line-disc_reason = '*MISCELLANOUS'.

    APPEND line TO reasons_t.

ENDCASE.

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

Everything works fine until here. When the field for the f4 is blank it fills the VALUE_TAB table (reasons_t) correctly, and also if the field is filled it works until here, and the table is filled correctly, but when the FM is called in the next line below it pops up with only the value that is already in the field, even though the value tab has 4 or 5 values in it

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

    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

      EXPORTING

        RETFIELD               = 'DISC_REASON'

        DYNPPROG               = sy-repid

        DYNPNR                 = sy-dynnr

        DYNPROFIELD            = 'ZOSDR_HDR_S-DISC_REASON'

        WINDOW_TITLE           = 'Discrepency Reason'

        VALUE_ORG              = 'S'

      TABLES

        VALUE_TAB              = reasons_t

        RETURN_TAB             = it_return

     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.

    ELSE.

      READ TABLE it_return INTO wa_return INDEX 1.

      ZOSDR_HDR_S-DISC_REASON = wa_return-fieldval.

    ENDIF.

ENDFORM.

Read only

0 Likes
1,121

use like this:

    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'


      EXPORTING


        RETFIELD               = 'DISC_REASON'


        WINDOW_TITLE           = 'Discrepency Reason'


        VALUE_ORG              = 'S'


      TABLES


        VALUE_TAB              = reasons_t


        RETURN_TAB             = it_return


     EXCEPTIONS


       PARAMETER_ERROR        = 1


       NO_VALUES_FOUND        = 2


       OTHERS                 = 3.

Read only

0 Likes
1,121

Hello Zachary,

  Everything looks good and it should populate values. Its just a hit n trial, please see the result after removing DYNPROFIELD= 'ZOSDR_HDR_S-DISC_REASON'

from FM 'F4IF_INT_TABLE_VALUE_REQUEST'.

Regards,

Deepti

Read only

Former Member
0 Likes
1,121

Thanks for you help guys, I understand now that if given that information it seems to use that instead of the value_tab