Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

cl_gui_textedit: how to get the line length?

0 Kudos
1,346

Hi everybody!

How can I get the character length of a line in a cl_gui_textedit?

Thank you!

5 REPLIES 5

monalisa_biswal
Contributor
0 Kudos
725
Use CALL METHOD lr_text_edit->get_text_as_r3table
        IMPORTING
          table = lt_text.   " text as R/3 table to get text in internal table. 

Then loop into the internal table and use strlen function to find length of each line.

0 Kudos
725

Hi Monalisa!

Thank you for your answer! Probably I didn't formulate my question clear enough. I don't want to know how many characters have been entered in each line so far (and this is whatt strlen will return), but rather how many characters can be entered in each line, e.g. in the width of the text window. There should be, no doubt, a simple way to find this out.

Best regards

Alexander.

0 Kudos
725

You can specify wordwrap_position for the text editor as given below: This will wrap text to next line after the specified number of characters

* 255 chars in one line 
 CREATE OBJECT lr_text_edit
      EXPORTING
        wordwrap_mode     = 2 " 0: OFF; 1: wrap a window border; 2: wrap at fixed pos
        wordwrap_position = 254   " pos of wordwrap, only makes sense with wordwrap_mode=2
        parent   = lr_custom_cont.     " Parent Container

Sandra_Rossi
Active Contributor
0 Kudos
725

For the same window size, you'll be able to enter 100 "l" but only 50 "W", because of the proportional font, so the answer will be "variable". Could you explain why you need the "line length" please?

muttepawar-2009
Active Participant
0 Kudos
725