2010 Mar 02 3:23 PM
Hello experts,
I have a normal ABAP report with a selection screen. On this screen I have two input fields, field_A and field_B. In field_A the user can choose from one of 4 pre-set values (A, B, C, D). Now, depending on this value choosen for field_A, the F4 help of field_B (and of course field_B's type) should change accordingly this selection in field_A.
So I have to questions:
1.) How to change an input field's type dynamically on a selection screen?
2.) How to set the F4 help of an input field dynamically on a selection screen?
Thanks in advance for your help!
Kind regards, Matthias
2010 Mar 04 1:15 PM
Matthias, <li>Here is the Sample program. Just check it out . <b><u> </u></b> Thanks Venkat.O
2010 Mar 02 3:31 PM
Hi,
Input help can be set dynamically in the event AT SELECTION-SCREEN ON VALUE REQUEST. Don't use standard F4. Code explicitly for F4 values based on your conditions. We have lot of sample codes for this in SCN.
I doubt if you can change the data type dynamically. One option i can think of is, create different input fields with different data types you want. Now hide the remaining fields and show only one field with required datatype based on the input entered in field_A. This can be done in AT SELECTION-SCREEN and AT SELECTION-SCREEN OUTPUT events.
Thanks,
Vinod.
2010 Mar 04 9:00 AM
Hello Vinod,
thanks for your help. Can you please provide a link to the accordig examples pages where to find examples of dynamical F4 help?
Kind regards, Matthias
2010 Mar 04 12:40 PM
Hi,
Check below sample code where in material F4 is Dynamic based on the radio button selected i.e. deletion flag set or not.
Hope this is what you are expecting.
TABLES mara.
PARAMETERS: po_lvorm RADIOBUTTON GROUP g1 USER-COMMAND ucomm, "Deletion flagged
po_nondl RADIOBUTTON GROUP g1 DEFAULT 'X'. "Deletion not flagged
SELECT-OPTIONS: so_matnr FOR mara-matnr.
TYPES: BEGIN OF t_mara,
matnr TYPE mara-matnr,
END OF t_mara.
DATA: i_mara TYPE STANDARD TABLE OF t_mara,
i_rettab TYPE STANDARD TABLE OF ddshretval,
wa_rettab TYPE ddshretval.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR so_matnr-low.
REFRESH i_mara[].
IF po_lvorm EQ 'X'.
SELECT matnr INTO TABLE i_mara FROM mara WHERE lvorm EQ 'X'.
ELSE.
SELECT matnr INTO TABLE i_mara FROM mara WHERE lvorm EQ space.
ENDIF.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
DDIC_STRUCTURE = ' '
retfield = 'SO_MATNR-LOW'
PVALKEY = ' '
dynpprog = sy-repid
dynpnr = sy-dynnr
DYNPROFIELD = ' '
STEPL = 0
WINDOW_TITLE = WINDOW_TITLE
VALUE = ' '
value_org = 'S'
MULTIPLE_CHOICE = ' '
DISPLAY = ' '
CALLBACK_PROGRAM = ' '
CALLBACK_FORM = ' '
MARK_TAB = MARK_TAB
IMPORTING
USER_RESET = USER_RESET
TABLES
value_tab = i_mara
FIELD_TAB = FIELD_TAB
return_tab = i_rettab
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.
CLEAR wa_rettab.
READ TABLE i_rettab INTO wa_rettab INDEX 1.
IF sy-subrc IS INITIAL.
MOVE wa_rettab-fieldval TO so_matnr-low.
ENDIF.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR so_matnr-high.
IF po_lvorm EQ 'X'.
SELECT matnr INTO TABLE i_mara FROM mara WHERE lvorm EQ 'X'.
ELSE.
SELECT matnr INTO TABLE i_mara FROM mara WHERE lvorm EQ space.
ENDIF.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
DDIC_STRUCTURE = ' '
retfield = 'SO_MATNR-HIGH'
PVALKEY = ' '
dynpprog = sy-repid
dynpnr = sy-dynnr
DYNPROFIELD = ' '
STEPL = 0
WINDOW_TITLE = WINDOW_TITLE
VALUE = ' '
value_org = 'S'
MULTIPLE_CHOICE = ' '
DISPLAY = ' '
CALLBACK_PROGRAM = ' '
CALLBACK_FORM = ' '
MARK_TAB = MARK_TAB
IMPORTING
USER_RESET = USER_RESET
TABLES
value_tab = i_mara
FIELD_TAB = FIELD_TAB
return_tab = i_rettab
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.
CLEAR wa_rettab.
READ TABLE i_rettab INTO wa_rettab INDEX 1.
IF sy-subrc IS INITIAL.
MOVE wa_rettab-fieldval TO so_matnr-high.
ENDIF.
Thanks,
Vinod.
2010 Mar 02 8:45 PM
Another option is to have a table with all the available valid combinations of your two fields.
When they click the drop down on Field A, they are presented with all valid combinationes - when the choose an entry, both values are populated.
You could even make Field B read-only.
2010 Mar 04 9:07 AM
2010 Mar 04 1:15 PM
Matthias, <li>Here is the Sample program. Just check it out . <b><u> </u></b> Thanks Venkat.O