cancel
Showing results for 
Search instead for 
Did you mean: 

How to add many lines in the Text View in Web Dynpro

Former Member
0 Kudos

Hi,

I have one container with one Text View in Web Dynpro. I need to show the result of FM READ_TEXT in Text View element, without lose the text format.

The metods of class CL_WD_TEXT_VIEW have a String parameter. So, how show all lines returned in the parameter LINES (table) of FM READ_TEXT.

Tks

Douglas Santos

Accepted Solutions (0)

Answers (4)

Answers (4)

rpalotai
Participant
0 Kudos

Follow this note:

Note 1061428 - TextView: Forcing a line break

You can use the CL_ABAP_CHAR_UTILITIES=>NEWLINE to force a line break.

Former Member
0 Kudos

Hi

You can use the textEdit UIElement and binf the data returned by READ_TEXT . to save formatting, convert the table returned by READ_TEXT into string by using FM CONVERT_TABLE_TO_STRING.

Thanks

Vishal Kapoor

Former Member
0 Kudos

hi, Douglas.

Using Text View, you can not output the result in "multi Line",in my eyes..

Instead, you can use "Formated Text" UI element replacing the "Text View", which plays like "Text View".

The advantage of "Formated Text" is that : it is very very convenient to output the formated Text, such as multi line. which is just what you want..

For example,


*1.define one string viarable
 loop at your_FM_Returned_Text.
  concatenate lw_formated_text TDline '<br />'
                         into lw_formated_text.   
endloop.

*here, you can use HTML formate, such as <br> denotes "new line". For example, you can also use "<strong>" to highlight the text as you want..

Hope it can help you a little.

best wishes.

Former Member
0 Kudos

Hi ,

I doubt if you can use textview to show multiple lines of output.

Instead you can use textedit . The property value of textedit can be bound to a string_table .

So , you can create a context attribute of type string_table and bind it to the value property of textedit.

Since the FM will return a TABLE of type TLINE , you can loop through it and proceed as shown below.

DATA : lt_table TYPE TABLE OF TLINE. "Internal table have values returned by FM.
DATA : ls_table LIKE LINE OF lt_table.   "Workarea to loop around.
DATA : lv_string TYPE string.
DATA : lt_string TYPE string_table.

LOOP AT lt_table INTO ls_table. "looping
  lv_string = ls_table-TDLINE.     "assigning to string variable.
  APPEND lv_string TO lt_string. " appending string to string_table.
 CLEAR lv_string.
ENDLOOP.

Finally set the attribute with the values of string_table , lt_string in WDDOINIT method of the view .

Thanks,

Aditya.