‎2009 Jun 16 12:40 PM
Hi ,
I need to replace a string as per the example below.
w_string = ' Varenr800294TC59 ROSINER! Mål/Vægt '.
In this string mentioned above , i need to replace the 2 character 'a' to different color.
Can some one help me with this.
‎2009 Jun 16 12:43 PM
Hi Vijay,
Not clear to your question. Do you want to REPLACE a string with some other character? What do you mean by
i need to replace the 2 character 'a' to different color.Please explain.
Thanks,
Amol
‎2009 Jun 16 12:52 PM
Hi
Thanks for your reply.
For example.
I have a string w_string = ' Varenr800294TC59 ROSINER!Mål/Vægt'.
In this string , i have to highlight the 2 character wstring+0(2) with a different color .
How can i do this.
‎2009 Jun 16 12:53 PM
‎2009 Jun 16 12:55 PM
‎2009 Jun 16 12:58 PM
It is not necessary that i must highlight with different color.
Any highlight options in the pop up is fine for that character.
‎2009 Jun 16 1:05 PM
Hi,
When you are saying its a pop-up do you mean that its an information box or a window that you are displaying..
‎2009 Jun 16 1:07 PM
This is only possible during list processing using options like
FORMAT COLOR COL_BACKGROUND or COL_NEGATIVE or COL_POSITIVE etc.
Do F1 help on FORMAT.
‎2009 Jun 16 1:08 PM
It is not an information window.This is a normal window.
I am calling this FM COPO_POPUP_TO_DISPLAY_TEXTLIST to display the string.
‎2009 Jun 16 1:18 PM
Hi,
Please try this to highlight the code:
WRITE: / listtab+6(lv_len) COLOR COL_NEGATIVE<----- You may also use COL_POSITIVE
‎2009 Jun 16 1:31 PM
Even you can try below options for different colors.
WRITE w_string+6(2) COLOR COL_TOTAL. " COL_NORMAL." COL_GROUP." COL_POSITIVE.Thanks,
Amol
‎2009 Jun 16 1:36 PM
Hi ,
Thanks all for the replies.
If i use this ,
Then i only see the colored character as output.
But i need the full string as output with the formatted character colored.
‎2009 Jun 16 1:42 PM
What you can do is you can read the entire string and find the position of the character you want to color... Then color it accordingly...
LOOP AT so_name.
lv_len = strlen( so_name-low ).
CLEAR lv_pos.
WHILE lv_pos LT lv_len.
lv_c = so_name-low+lv_pos(c_no).
lv_pos = lv_pos + 1.
IF c_wild CA lv_c. <--- Check for your character here
set the color here
REFRESH so_name.
CLEAR so_name.
EXIT.
ENDIF.
ENDWHILE.
ENDLOOP.
Amol: Whatever you mentioned has been written earlier...
‎2009 Jun 16 1:46 PM
I think below code will be useful to you.
WRITE :/ w_string+0(6) COLOR COL_POSITIVE, w_string+6(1) COLOR COL_GROUP, w_string+6(27) COLOR COL_TOTAL.Thanks,
Amol
‎2009 Jun 16 12:48 PM
Hi,
Is this a text which is displayed in your ALV cell... I mean you want to change the a's to a different COLOR.... If you want to do this ..
‎2009 Jun 16 1:58 PM
DATA col TYPE i VALUE 0.
data : string(100) type c value 'abcdefghijkl'.
col = 1.
WRITE: / string+0(5).
FORMAT COLOR = col.
write: string+5(3).
format color off.
write: string+8(92).