08-24-2007 3:51 PM
Hi all,
I want to display a tooltip when the user puts the mouse over a cell in an ALV. I know that it's possible for the whole column but is it possible for a single cell? Thanks
08-27-2007 11:15 AM
Hi SAPer,
I've had the same problem, that's how I found this yet unanswered thread.
I could solve my problem by using the combination of an icon with a tooltip-text,
the last of which can be changed for every cell of the ALV-Grid, if you want.
I defined the field in the field catalogue as CHAR45 (based on length 5 being the
maximum length of an icon code and 40 being the maximum length for a tooltip)
and set the flag lvc_s_fcat-icon = 'X'. For filling in the value in the demanded
syntax '&<ICON_CODE>/Q<quickinfo-text>&' I used SAPs standard function
module 'ICON_CREATE'.
Hope this helps
regards
Andreas
08-28-2007 9:10 AM
Thanks Andreas for your answer. I got the point, but could you please provide a snipet of code, it would be very helpful. Thanks
08-28-2007 9:33 AM
Hi SAPer,
no problem - the following is very much simplified, but I hope it helps.
As a result of this example your ALV-Grid column would show a single green
LED icon with the Tooltipp-text 'Text in Tooltipp' (exciting, isn't it?) :
1. My ALV uses a DDIC-reference structure to provide the field attributes.
The field named 'ICON_FIELD' is included there, defined as CHAR45.
2. Adaptations to this field in the field catalog subroutine of my program:
LOOP AT lvc_t_fcat INTO lvc_s_fcat.
CASE lvc_s_fcat-fieldname.
.....
WHEN 'ICON_FIELD'.
lvc_s_fcat-col_pos = '2'. "column position in Grid
lvc_s_fcat-icon = 'X'. "Output as Icon
lvc_s_fcat-outputlen = '2'. "Outputlength in grid
.....
ENDCASE.
MODIFY lvc_t_fcat FROM lvc_s_fcat.
ENDLOOP.
3. The routine, that fills the content of the field for the it_outtab table parameter
of method set_table_for_first_display (the stated 'Text in Tooltipp' is just for
explanation purposes here, actually I use program text-symbols there)
CALL FUNCTION 'ICON_CREATE'
EXPORTING
name = icon_led_green
info = 'Text in Tooltipp'
IMPORTING
RESULT = wa_outtab-icon_field.
best regards
Andreas
08-28-2007 9:40 AM
Have you looked at the report SALV_TEST_TOOLTIPS...? this has different tooltips for lots of different cells... And some of the other demos (SALV_DEMO_HIERSEQ_COLUMN, SALV_DEMO_TABLE_COLUMNS, SALV_TEST_HIERSEQ_COLUMNS, SALV_TEST_TABLE_COLUMNS) also call the "add_tooltip" method.
08-28-2007 9:53 AM
Thanks for the valuable hint, Jonathan.
I've recently changed from using the 'REUSE_ALV...' - function modules to
working with the CL_GUI_ALV_GRID classes directly but I'm afraid I don't
know all of the available methods yet. Good to know, thanks !
08-29-2007 9:22 AM
Hi guys, thanks a lot for your input.
Andreas: Your code was very helpful, and i managed indeed to create an ALV with a column that contains an icon with a tooltip. But it would be really great if i could put an icon and a text in the same column so that, for example, i could have the column contain a short text that is displayed and once i put the mouse on it the long text apears, this way i will have both text visible on the same column. Do you know how to do that?
Jonathan: Actually i looked for the report you mentioned (SALV_DEMO_HIERSEQ_COLUMN, SALV_DEMO_TABLE_COLUMNS, SALV_TEST_HIERSEQ_COLUMNS) but couldn't find them, may i draw your attention toi the fact that I am working on version 4.7
Thanks again.
08-29-2007 9:59 AM
Hi SAPer,
I'm afraid I don't know how to do that. I can't find the mentioned sample reports
either (we have 4.7 as well) and I scanned the available ALV-Grid methods
thoroughly - but in vain - for appropriate functions.
Sorry.
Andreas
08-29-2007 10:16 AM
Hello again,
I almost don't dare to suggest the following (since it is so simple and
I didn't want to imply you might possibly not have been aware of it,
escpecially since it actually is NOT what you're looking for exactly):
The ALV automatically comes up with a tooltipp for fields which are
displayed in a column being too small for displaying the field content.
If you declared a field of - let's say - length 60, 10 being for your short
text, 50 for the additional information, and you sized the column just big
enough for the first 10 characters....
regards
Andreas
08-29-2007 10:41 AM
Well it appears to me that your solution is the best i can have. But I will leave the thread open just in case someone finds a better solution (although i highly doubt it). Thanks again for your help, you get your credit for a very helpful solution though
03-17-2009 3:39 PM
So, Are we saying that you can display tooltips for a particular field if you use some kind of icon?.
Both the two example programs provided by SAP seem to be ICON related, so I'm wondering it's not possible to have tooltip without an ICON being displayed.
In short, I have an ALV and I want to have a tooltip at a selected field for a selected row. Do you think this will be possible?.
Gary King
02-03-2015 12:10 PM
Since is possible with an ICON, i couldn't find an answer for non ICON cell, i tried with function module ICON_CREATE and it works.
Try this code.
CALL FUNCTION 'ICON_CREATE'
EXPORTING
name = '@5F@' "ICON_SPACE
text = 'text i want in my cell'
info = 'tool tip info'
IMPORTING
RESULT = l_cell.
It put's a blank icon in the cell, the text i want for the cell and a tooltip.