Application Development 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: 

text editor in DYNPRO: how can I limit text lines?

Former Member
0 Kudos

Hi!

I have a DYNPRO with a TextEditor, but I need limit the line number to 4. Anybody could help me to try?

Thank a Lot

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi try limiting it by the size of the custom control in the screen.

If you want only 4 lines in text edit, keep the custom control size to 4 lines.

Regards

Karthik D

8 REPLIES 8

Former Member
0 Kudos

Hi try limiting it by the size of the custom control in the screen.

If you want only 4 lines in text edit, keep the custom control size to 4 lines.

Regards

Karthik D

Former Member
0 Kudos

Hi,

I am also having the same requirment but in my case no need to restirct the lines. Please share the code for saving the data entered in the Text Editor.

Waiting for your valuable post.

0 Kudos

Hi Balu CH!

At first You must defined a CUSTOM CONTAINER to recibe the textEditor in a DYNPRO,

And implemented this code (I had implemented in the main program):

  • PROCESS FOR TEXTEDITOR (20/09/08)

  • DEFINING VARS

"CONSTANTS: line_length TYPE i VALUE 256.

CONSTANTS: line_length TYPE i VALUE 69. " LONGITUD EDITABLE CAJA

DATA:

g_editor TYPE REF TO cl_gui_textedit,

g_editor_container TYPE REF TO cl_gui_custom_container,

g_repid LIKE sy-repid,

g_relink TYPE c, " to manage relinking

g_mytable(line_length) TYPE c OCCURS 0,

g_mycontainer(30) TYPE c, " string for the containers

g_container_linked TYPE i. "#EC NEEDED

  • TEXTEDIT CLASS.

CLASS cl_gui_cfw DEFINITION LOAD.

  • CREATING TEXT EDITOR

IF g_editor IS INITIAL.

CREATE OBJECT g_editor_container

EXPORTING

container_name = 'YOUR_CONTAINER_NAME'

EXCEPTIONS

cntl_error = 1

cntl_system_error = 2

create_error = 3

lifetime_error = 4

lifetime_dynpro_dynpro_link = 5.

IF sy-subrc NE 0.

  • add your handling

ENDIF.

g_mycontainer = 'YOUR_CONTAINER_NAME'.

ENDIF.

CREATE OBJECT g_editor

EXPORTING

parent = g_editor_container

wordwrap_mode =

max_number_chars = 360

  • cl_gui_textedit=>wordwrap_off

cl_gui_textedit=>wordwrap_at_fixed_position

  • cl_gui_textedit=>WORDWRAP_AT_WINDOWBORDER

wordwrap_position = line_length

wordwrap_to_linebreak_mode = cl_gui_textedit=>true.

  • to handle different containers

g_container_linked = 1.

REFRESH g_mytable. " to initialize table upon OK_CODE 'BACK' at PAI

Former Member
0 Kudos

hi,

check texteditor class method and properties. There is option to fix limit for line length, no of lines, total no of char.

0 Kudos

HI Velu!

The options who I saw refered to the lenght of line (as numer of chars per line) and the lenght of totals chars in texteditor. In my case:

4 lines X 90 chars/line = 360 chars

But if you put one return you can put more lines because you don´t full the chars limit.

Its my subject "who can I limit the numer of lines".

I'm triing with get_line_text, but its checked after leave the texteditor.

And I think its a litle "rude".

Thanks

0 Kudos

hi,

try this method PROTECT_LINES. i think it is useful.

0 Kudos

Hi Velu!

are you sure that protect_lines PROTECT_LINES is usefull to limit the number of lines in a TEXTEDIT?

I understand its usefull for selected texts from...

Thanks a lot for your time

0 Kudos

hi,

PROTECT_LINES is not allow to edit the lines. it means user can't do anything in protected lines.i feel this is your requirement. Use following parameters.

PROTECT_LINES

EXPORTING

FROM_LINE = 5

TO_LINE = 100

EXCEPTIONS

ERROR_CNTL_CALL_METHOD = 1

INVALID_PARAMETER = 2

others = 3.