2013 Jul 18 10:21 AM
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
2013 Jul 18 10:30 AM
2013 Jul 18 10:34 AM
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.
2013 Jul 18 11:51 AM
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.
2013 Jul 18 10:50 AM
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.
2013 Jul 18 12:04 PM
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.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |