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

Selection screen F4 help

Former Member
0 Likes
3,013

Hi Colleagues,

     I have met one question which I do not know how to solve:

     In selection screen ,there are two fields, and two fields have dependency relationship. When fill value in the first field, then press F4 of the second field, value should be different according to the value filled in the first field, however , I need to press enter when I fill value in the first field, or when I tried to read the possible values of seconde field according to the value of the first field, I found that the value of the first field are not set. How could I press F4 directly without press enter firstly in the first field?

     Thank you very much.

Best regards,

Xu Chris

Hi Colleagues,

     I have met one question which I do not know how to solve:

     In selection screen ,there are two fields, and two fields have dependency relationship. When fill value in the first field, then press F4 of the second field, value should be different according to the value filled in the first field, however , I need to press enter when I fill value in the first field, or when I tried to read the possible values of seconde field according to the value of the first field, I found that the value of the first field are not set. How could I press F4 directly without press enter firstly in the first field?

     Thank you very much.

Best regards,

Xu Chris

5 REPLIES 5
Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,823

This is a FAQ, use search tool on DYNP_VALUES_READ.

Regards,

Raymond

Read only

Former Member
0 Likes
1,823

Hi Chris,

Please refer following code. This might help to solve your problem.

- Here, If you enter value in first field CARRID and directly press F4 on second field CONNID (without pressing ENTER) then you can get input values depending upon value in first field.

- Declare internal table it_connid with a field connid.
PARAMETERS: p_carrid TYPE sflight-carrid,
                           p_connid TYPE sflight-connid.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_connid.
DATA: lt_dynpfields TYPE TABLE OF dynpread,
            ls_dynpfields TYPE  dynpread.

ls_dynpfields-fieldname = 'P_CARRID'.
APPEND ls_dynpfields TO lt_dynpfields.

  CALL FUNCTION 'DYNP_VALUES_READ'
    EXPORTING
      dyname     = sy-repid
      dynumb     = sy-dynnr
    TABLES
      dynpfields = lt_dynpfields.

  READ TABLE lt_dynpfields INTO ls_dynpfields WITH KEY fieldname = 'P_CARRID'.
  IF sy-subrc = 0.
    p_carrid = ls_dynpfields-fieldvalue.
    TRANSLATE p_carrid TO UPPER CASE.
  ENDIF.
  SELECT connid
    FROM sflight
    INTO TABLE lt_connid
   WHERE carrid = p_carrid.

  SORT lt_connid BY connid.
  DELETE ADJACENT DUPLICATES FROM lt_connid COMPARING connid.

  CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
      retfield    = 'CONNID'
      dynpprog    = sy-repid
      dynpnr      = sy-dynnr
      dynprofield = 'P_CONNID'
      value_org   = 'S'
    TABLES
      value_tab   = lt_connid.

Read only

0 Likes
1,823

Hi Bharatilal,

please check below code

wa_dynpfields-fieldname = 'FIELD1'.

  APPEND wa_dynpfields TO it_dynpfields.

  CALL FUNCTION 'DYNP_VALUES_READ'

    EXPORTING

      dyname               = sy-repid

      dynumb               = sy-dynnr

*     translate_to_upper   = 'X'

*     REQUEST              = ' '

    TABLES

      dynpfields           = it_dynpfields.

  READ TABLE it_dynpfields INTO wa_dynpfields WITH KEY fieldname = 'FIELD1'.

  IF sy-subrc iS INITIAL.

    SELECT ztcustnam

           ztsowno

      FROM ztsalo01

      INTO TABLE it_sow

      WHERE ztcustnam = wa_dynpfields-fieldvalue

      AND   deletion_ind = ' '.

  ENDIF.

  CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

    EXPORTING

      retfield        = 'FIELD_NAME'

      dynpprog        = sy-repid

      dynpnr          = sy-dynnr

      dynprofield     = 'FIELD2'

      window_title    = 'SOW Number'

      value_org       = 'S'

    TABLES

      value_tab       = it_sow

    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 only

Former Member
0 Likes
1,823

Is your serach help is standard ? If standard can't do anything.

If your search help is Z search help, Export the parameter of  first field in search help. On press of F4 on second field you will get filter values on basis of first field. No need to press enter.

Read only

mayur_priyan
Active Participant
0 Likes
1,823

Hi Chris,

You can use the Function module 'DYNP_VALUES_READ' to directly fetch the values entered in field 1. Then by reading the value fetched from the field 1 you can populate a table which can be displayed as F4 help for field two by using the Function module F4IF_INT_TABLE_VALUE_REQUEST.