on 09-28-2010 9:49 AM
Hi,
I have an internal table of type TLINE and I concatenate the lines into a string like this:
'This is the <U>first'</ >' line which contains a < (less than sign) *
This is the <U>second</> line which contains a > (greater than sign) *'
I want to display it in a FormattedTextView so I do this replacements first:
REPLACE ALL OCCURRENCES OF '<U>' IN lv_longtext WITH '<h1>'.
REPLACE ALL OCCURRENCES OF '<H>' IN lv_longtext WITH '<h1>'.
REPLACE ALL OCCURRENCES OF '</ >' IN lv_longtext WITH '</h1>'.
REPLACE ALL OCCURRENCES OF '*' IN longtext WITH '<br/>'.
The header replacements works fine, but I get the error that the less and greater signs are not allowed.
I think this is cause these signs are a part of the HTML tags.
If I do also a replacement of these signs into HTML code then the header tag does'nt work anymore
cause the < and > of the header tag will be replaced also.
Does anybody have an idea how to solve this problem?
Thanks, Susanne
Hi ,
Have you tried with "<" and ">" for "<" and ">".
May be you can give it a try by replacing "<u>" to "<h1>".
REPLACE ALL OCCURRENCES OF '<' IN lv_longtext WITH '<'.
REPLACE ALL OCCURRENCES OF '>' IN lv_longtext WITH '>'.
Because i remember , in HTML to bring the '<' or '>', we need to use a entites.
[entites|http://www.w3schools.com/HTML/html_entities.asp]
I am not sure if it will work...:)..Give it a try though.
Do let us know if it worked.
Thnks,
aditya.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi ,
If it the input string has the '<' or '>' (greater/lesser than symbol) symbol within " "(double quotes) then the replace statement seems to work fine.
REPLACE ALL OCCURRENCES OF ' "<" ' WITH '<'.
REPLACE ALL OCCURRENCES OF ' ">" ' WITH '>'.
In this case the replace statement does not replace the '<' symbol of your header tags.
lv_longtext = 'This is the <U> first </ > which contains a "<" * '. //your input should be somthing like this.
But I dont know if it is possible for you to get the '<' in double quotes.:(
And also once the symbols are replaced with entites , it should be rendered properly.
Thnks,
aditya.
HI,
You can use the below code to convert the SAP script text i.e TLINE to formatted text
data formatted_text type ref to cl_wd_formatted_text.
" convert from context
formatted_text = cl_wd_formatted_text=> create_from_sapscript(
sapscript_head = sapscript_head
sapscript_lines = sapscript_lines
).
" set it into the context
wd_context->set_attribute(
name = my_formatted_text_attr
value = formatted_text->m_xml_text ).
cl_wd_formatted_text=>write_sapscript_tokens( ).
This code snippet is retrieved form the standard sap help file for web dynpro
[Formatted text view SAP help file|http://help.sap.com/saphelp_nw70/helpdata/en/3b/219141c1d0ae5fe10000000a1550b0/content.htm]
Regards,
Madhu
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.