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: 
Read only

text control block in not cleared.

Former Member
0 Likes
381

HI Experts,

I am using a text control block in my screen program, and typed something and then save it.

But when i run it again, it not cleared the old data that i typed early.

Can anyone help me that how can i clear the data in text control block.

&----


*& Report ZTEST_SCR

*&

&----


*&

*&

&----


REPORT ZTEST_SCR.

DATA: OK_CODE TYPE SYUCOMM,

g_editor type ref to cl_gui_textedit,

g_editor_container type ref to cl_gui_custom_container.

constants: c_line_length type i value 72.

  • define table type for data exchange

types: begin of mytable_line,

line(c_line_length) type c,

end of mytable_line.

  • table to exchange text

data g_mytable type table of mytable_line.

  • necessary to flush the automation queue

class cl_gui_cfw definition load.

call screen 100.

&----


*& Module STATUS_0100 OUTPUT

&----


  • text

----


MODULE STATUS_0100 OUTPUT.

SET PF-STATUS '100'.

SET TITLEBAR '100'.

if g_editor is initial.

  • create control container

create object g_editor_container

exporting

container_name = 'TEXTEDITOR'

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.

  • create calls constructor, which initializes, creats and links

  • a TextEdit Control

create object g_editor

exporting

parent = g_editor_container

wordwrap_mode = cl_gui_textedit=>wordwrap_at_fixed_position

wordwrap_to_linebreak_mode = cl_gui_textedit=>true

exceptions

others = 1.

ENDIF.

ENDMODULE. " STATUS_0100 OUTPUT

&----


*& Module USER_COMMAND_0100 INPUT

&----


  • text

----


MODULE USER_COMMAND_0100 INPUT.

CASE ok_code .

when 'BACK'.

LEAVE PROGRAM.

WHEN 'SAVE'.

  • retrieve table from control

call method g_editor->get_text_as_r3table

importing

table = g_mytable

exceptions

others = 1.

EXIT.

ENDCASE.

ENDMODULE. " USER_COMMAND_0100 INPUT

Thanks

HI Experts,

I am using a text control block in my screen program, and typed something and then save it.

But when i run it again, it not cleared the old data that i typed early.

Can anyone help me that how can i clear the data in text control block.

&----


*& Report ZTEST_SCR

*&

&----


*&

*&

&----


REPORT ZTEST_SCR.

DATA: OK_CODE TYPE SYUCOMM,

g_editor type ref to cl_gui_textedit,

g_editor_container type ref to cl_gui_custom_container.

constants: c_line_length type i value 72.

  • define table type for data exchange

types: begin of mytable_line,

line(c_line_length) type c,

end of mytable_line.

  • table to exchange text

data g_mytable type table of mytable_line.

  • necessary to flush the automation queue

class cl_gui_cfw definition load.

call screen 100.

&----


*& Module STATUS_0100 OUTPUT

&----


  • text

----


MODULE STATUS_0100 OUTPUT.

SET PF-STATUS '100'.

SET TITLEBAR '100'.

if g_editor is initial.

  • create control container

create object g_editor_container

exporting

container_name = 'TEXTEDITOR'

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.

  • create calls constructor, which initializes, creats and links

  • a TextEdit Control

create object g_editor

exporting

parent = g_editor_container

wordwrap_mode = cl_gui_textedit=>wordwrap_at_fixed_position

wordwrap_to_linebreak_mode = cl_gui_textedit=>true

exceptions

others = 1.

ENDIF.

ENDMODULE. " STATUS_0100 OUTPUT

&----


*& Module USER_COMMAND_0100 INPUT

&----


  • text

----


MODULE USER_COMMAND_0100 INPUT.

CASE ok_code .

when 'BACK'.

LEAVE PROGRAM.

WHEN 'SAVE'.

  • retrieve table from control

call method g_editor->get_text_as_r3table

importing

table = g_mytable

exceptions

others = 1.

EXIT.

ENDCASE.

ENDMODULE. " USER_COMMAND_0100 INPUT

Thanks

1 REPLY 1
Read only

Former Member
0 Likes
355

Note that you have the statement

if g_editor is initial.

My guess is that it is not initial after the first pass, and you need to specifically CLEAR the contents of the container when it is NOT initial.