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: 

How to position the cursor at the end of the text with EDIT_TEXT?

Former Member
0 Kudos

Hello, it wanted to ask to them if somebody could make work the module of function EDIT_TEXT so that it positions the cursor at the end of the text that is visualizing in the text editor. In the documentation it says that passing a ' X' to him in the field scrollend of the parameter Control is obtained that operation. Nevertheless, I did this and the cursor continues appearing at the beginning of the text that visualizes.

Somebody could help me please?

Regards,

Gabriel

PD: The code that I use is the following one:

FORM f_ingresar_comentarios.

DATA: l_action,

l_result LIKE itcer,

l_pedido LIKE thead-tdname,

li_coment_save LIKE i_comentarios OCCURS 0,

li_coment_aux LIKE i_comentarios OCCURS 0 WITH HEADER LINE,

l_lines TYPE i,

l_lines_save TYPE i,

l_lines_insert TYPE i,

l_index TYPE i,

l_index_aux TYPE i,

l_insert,

lwa_control LIKE itced.

CLEAR: l_action.

CLEAR i_comentarios.

REFRESH: i_comentarios,

li_coment_save,

li_coment_aux.

l_pedido = v_pedido.

  • Leemos el texto si es que existe

CALL FUNCTION 'READ_TEXT'

EXPORTING

client = sy-mandt

id = v_id_text

language = sy-langu

name = l_pedido

object = c_ekko

IMPORTING

header = wa_cabecera

TABLES

lines = i_comentarios "Lineas de texto leídas

EXCEPTIONS

id = 1

language = 2

name = 3

not_found = 4

object = 5

reference_check = 6

wrong_access_to_archive = 7

OTHERS = 8.

IF sy-subrc <> 0.

  • Armamos la cabecera por primer comentario para el pedido

CLEAR wa_cabecera.

wa_cabecera-tdobject = c_ekko. "Objeto en tabla TTXID

wa_cabecera-tdname = v_pedido. "Nro de pedido

wa_cabecera-tdid = v_id_text. "ID en tabla TTXID

wa_cabecera-tdspras = sy-langu. "Lenguaje

wa_cabecera-tdlinesize = 70.

ENDIF.

  • Salva comentarios originales

li_coment_save[] = i_comentarios[].

lwa_control-scrollend = c_x. " c_x = 'X'

  • Abre el editor de texto

CALL FUNCTION 'EDIT_TEXT'

EXPORTING

header = wa_cabecera

save = space

control = lwa_control

IMPORTING

newheader = wa_cabecera

function = l_action

RESULT = l_result

TABLES

lines = i_comentarios

EXCEPTIONS

object = 1

id = 2

language = 3

name = 4

linesize = 5.

  • Si cambio los comentarios, actualiza comentarios

CASE l_action.

WHEN c_unchanged.

WHEN c_delete.

WHEN c_update OR

c_insert.

  • Obtiene cantidad de lineas de comentarios originales y modificados

DESCRIBE TABLE li_coment_save LINES l_lines_save.

DESCRIBE TABLE i_comentarios LINES l_lines.

  • Si se insertaron lineas...

IF l_lines > l_lines_save.

  • Calcula cantidad de lineas a insertar para luego calcular valor de

  • indice a partir del cual insertar los nuevos comentarios

l_lines_insert = l_lines - l_lines_save.

l_index = ( l_lines - l_lines_insert ) + 1.

  • Controla que al menos una de las lineas insertadas sea diferente de

  • blanco

l_index_aux = l_lines.

l_insert = c_n.

DO l_lines_insert TIMES.

READ TABLE i_comentarios INDEX l_index_aux.

IF sy-subrc = 0 AND

i_comentarios-tdline <> space.

l_insert = c_s.

EXIT.

ENDIF.

l_index_aux = l_index_aux - 1.

ENDDO.

IF l_insert = c_s.

  • Carga comentarios originales y agrega lineas insertadas

li_coment_aux[] = li_coment_save[].

APPEND LINES OF i_comentarios

FROM l_index

TO l_lines

TO li_coment_aux.

  • Setea variable para indicar actualizacion de comentarios.

v_comentario = 'S'.

  • Agrega usuario y fecha del comentario

CONCATENATE sy-uname

'-'

sy-datum

INTO li_coment_aux-tdline

SEPARATED BY space.

li_coment_aux-tdformat = '*'.

APPEND li_coment_aux.

  • Grabamos el texto

CALL FUNCTION 'SAVE_TEXT'

EXPORTING

  • client = sy-mandt

header = wa_cabecera

  • savemode_direct = c_x

IMPORTING

newheader = wa_cabecera

TABLES

lines = li_coment_aux

EXCEPTIONS

id = 1

language = 2

name = 3

object = 4

OTHERS = 5.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

ENDIF.

ENDIF.

ENDCASE.

ENDFORM. " f_ingresar_comentarios

In addition, I made another program simpler that it uses the same functions and also have the same problem:

*&----


*

*& Report Y_GVA_TEXT *

*& *

*&----


*

*& *

*& *

*&----


*

REPORT y_gva_text .

DATA: wa_cabecera LIKE thead,

i_comentarios LIKE tline OCCURS 0 WITH HEADER LINE.

DATA: l_action,

v_comentario,

l_result LIKE itcer,

v_pedido LIKE thead-tdname VALUE '3',

l_pedido LIKE thead-tdname,

c_a05 LIKE thead-tdid VALUE 'A05',

c_ekko LIKE stxh-tdobject VALUE 'EKKO',

l_lines LIKE sy-tabix,

lwa_control LIKE itced.

CONSTANTS: c_x VALUE 'X',

update VALUE 'U', "Langtext verändert

insert VALUE 'I', "Langtext eingefügt

delete VALUE 'D', "Langtext gelöscht

modify VALUE 'M', "Kein Langtext, Inlinezeile veränd.

unchanged VALUE ' '.

CLEAR: l_action.

CLEAR i_comentarios.

REFRESH i_comentarios.

  • Leemos el texto si es que existe

CALL FUNCTION 'READ_TEXT'

EXPORTING

client = sy-mandt

id = c_a05

language = sy-langu

name = v_pedido

object = c_ekko

IMPORTING

header = wa_cabecera

TABLES

lines = i_comentarios "Lineas de texto leídas

EXCEPTIONS

id = 1

language = 2

name = 3

not_found = 4

object = 5

reference_check = 6

wrong_access_to_archive = 7

OTHERS = 8.

IF sy-subrc <> 0.

  • MESSAGE ID sy-msgid TYPE 'I' NUMBER sy-msgno

  • WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

  • Armamos las cabecera para mostrar los comentarios

CLEAR wa_cabecera.

wa_cabecera-tdobject = c_ekko. "Objeto en tabla TTXID

wa_cabecera-tdname = v_pedido. "Nro de pedido

wa_cabecera-tdid = c_a05. "ID en tabla TTXID

wa_cabecera-tdspras = sy-langu. "Lenguaje

wa_cabecera-tdlinesize = 70.

ENDIF.

lwa_control-noendlines = c_x.

lwa_control-scrollend = c_x.

  • Abre el editor de texto

CALL FUNCTION 'EDIT_TEXT'

EXPORTING

header = wa_cabecera

save = space

control = lwa_control

IMPORTING

newheader = wa_cabecera

function = l_action

RESULT = l_result

TABLES

lines = i_comentarios

EXCEPTIONS

object = 1

id = 2

language = 3

name = 4

linesize = 5.

  • Si cambio los comentarios, actualiza comentarios

CASE l_action.

WHEN unchanged.

WHEN delete.

WHEN update OR

insert.

  • Agrega usuario y fecha del comentario

CONCATENATE sy-uname

'-'

sy-datum

INTO i_comentarios-tdline

SEPARATED BY space.

i_comentarios-tdformat = '*'.

APPEND i_comentarios.

CALL FUNCTION 'SAVE_TEXT'

EXPORTING

header = wa_cabecera

IMPORTING

newheader = wa_cabecera

TABLES

lines = i_comentarios.

ENDCASE.

5 REPLIES 5

former_member214131
Active Contributor
0 Kudos

Hello,

I made a single test of the FM which is 46C. The FM is working fine. I am able to scroll to the end of the text.

I have passed the Parameter SCROLLEND = 'X' and

I have appended a new line at end of the actual text in the text table which is blank line and without tag ( blank ). Then the cursor goes to the extreme end of the long text. I made this check on line editor option.

Hope this helps.

Best Regards, Murugesh AS

0 Kudos

Thanks for your help!

However, it only works using LINE_EDITOR = 'X' and I would need that I work with the other editor.

Former Member
0 Kudos

Murugesh,

I believe that you have mis-read Gabriel's problem.

Gabriel,

The cursor is not positioning at the base of the editor as you have cited.

In order to get this functionality to work, you must set the LINE_EDITOR import paramter to 'X'.

data: hdr like THEAD.

data: l_itced like itced.

hdr-tdobject = 'VBBP'.

hdr-tdname = '4000029521000030'.

hdr-tdid = 'Z005'.

hdr-tdspras = 'E'.

hdr-TDLINESIZE = '100'.

hdr-TDTXTLINES = '3'.

l_itced-SCROLLEND = 'X'.

CALL FUNCTION 'EDIT_TEXT'

EXPORTING

  • DISPLAY = ' '

  • EDITOR_TITLE = ' '

HEADER = hdr

  • PAGE = ' '

  • WINDOW = ' '

  • SAVE = 'X'

LINE_EDITOR = 'X' " here !!!

CONTROL = l_itced

  • PROGRAM = ' '

  • LOCAL_CAT = ' '

  • IMPORTING

  • FUNCTION =

  • NEWHEADER =

  • RESULT =

TABLES

LINES = lines

  • EXCEPTIONS

  • ID = 1

  • LANGUAGE = 2

  • LINESIZE = 3

  • NAME = 4

  • OBJECT = 5

  • TEXTFORMAT = 6

  • COMMUNICATION = 7

  • OTHERS = 8

.

Don't forget those points !!

0 Kudos

Hello John,

I am sure that my understanding is in line with the requirement. Please check my above post. In fact I have checked the same with line editor option which I have mentioned. Anyway I am not sure whether this has helped Gabriel.

Best Regards, Murugesh AS

Former Member
0 Kudos

Gabriel,

Has your question been resolved?

If so, please reward points accordingly.

If not, please provide more details of your issue.

Thanks.