2021 Nov 23 10:43 AM
Hi,
I've been asked to add a new parameter in a program. This new field's f4 must show icon_green_light, icon_red_light and icon_yellow_light. the matchcode shows the values ok but when I select one of them the value passed to the parameter is the icon code, i.e @08@.
That's what I've done:
PARAMETERS: p_comp TYPE icon_d.
[...]
TYPES: BEGIN OF ty_fields,
icon TYPE icon_d.
TYPES: END OF ty_fields,
tt_fields TYPE TABLE OF ty_fields.
[...]
AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_comp-low.
PERFORM f_completo_f4 changing s_comp-low.
[...]
FIELD-SYMBOLS: <fs_return> TYPE ddshretval.
DATA: li_return TYPE TABLE OF ddshretval,
l_fields TYPE ty_fields,
li_fields TYPE tt_fields.
SELECT id
FROM icon
INTO TABLE li_fields
WHERE id IN ('@08@','@09@','@0A@').
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'COMPLETO'
dynprofield = 'P_COMP'
dynpprog = sy-repid
dynpnr = sy-dynnr
value_org = 'S'
TABLES
value_tab = li_fields
return_tab = li_return.
READ TABLE li_return ASSIGNING <fs_return>
INDEX 1.
IF sy-subrc EQ 0.
WRITE <fs_return>-fieldval AS ICON TO p_comp.
ENDIF.
REFRESH li_return.
CLEAR li_return.
How can I solve it?
thanks!
Maria
2021 Nov 23 11:59 AM
Hello,
One Simple solution is to have three check-box OR Radio button if you want to allow only one of the types in the output.. each for the Green, Yellow and Red signals and in the description, you may use the Icon codes so the selection screen looks something like this signal.jpg
Hope this helps.
Regards,
Vijay
2021 Nov 23 12:32 PM
2021 Nov 23 1:06 PM
Do they understand the difference between "like" and "technically possible"? haha
2021 Nov 23 9:35 PM
Please edit your question, select your code and press the button [CODE], which makes the code appear colored/indented, it will be easier for people to look at it. Thank you!
2021 Nov 23 10:02 PM
You may have a look at what is possible in BIBS transaction code. For instance > Elements > Icons > icon for "Warehouse stock" with separate button to change the icon.
Or you can do like below to make the icon a pushbutton, to simulate F4:
TABLES sscrfields.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT (40) text.
SELECTION-SCREEN PUSHBUTTON (4) p_comp USER-COMMAND change_light.
SELECTION-SCREEN END OF LINE.
TYPES: BEGIN OF ty_fields,
icon TYPE icon_d,
END OF ty_fields,
tt_fields TYPE TABLE OF ty_fields.
INITIALIZATION.
text = 'Click the light icon to change it'.
p_comp = '@08@'.
AT SELECTION-SCREEN.
CASE sscrfields-ucomm.
WHEN 'CHANGE_LIGHT'.
FIELD-SYMBOLS: <fs_return> TYPE ddshretval.
DATA: li_return TYPE TABLE OF ddshretval,
l_fields TYPE ty_fields,
li_fields TYPE tt_fields.
SELECT id
FROM icon
INTO TABLE li_fields
WHERE id IN ('@08@','@09@','@0A@').
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'ICON'
dynpprog = sy-repid
dynpnr = sy-dynnr
value_org = 'S'
TABLES
value_tab = li_fields
return_tab = li_return.
READ TABLE li_return ASSIGNING <fs_return>
INDEX 1.
IF sy-subrc EQ 0.
p_comp = <fs_return>-fieldval.
ENDIF.
ENDCASE.
2021 Nov 24 8:44 AM
Thanks Sandra, it's a good idea, but they want it as a select-option.
Now it seems that they don't care if they can't see the icon 🙂
2021 Nov 24 10:10 AM
OK. It's not feasible to have an icon in an input field. Anyway SAP GUI is not HTML, so the client requirement should ask only for visual rendering that is known as being feasible.