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

how to refresh the textedit object in module pool

Former Member
0 Likes
2,628

Hi All,

I would appreciate if anybody can solve my problem.

Problem is i have created one TEXTEDIT and now when user clicks on the cancel button and come back to the screen the data which was previously entered is still coming up.

Please tell me how to refresh the data in TEXTEDIT.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,284

Hi Mike

I have also facing the same problem as you have.

i think you have not Re-Initialize the container.

Please Reinitialze the contianer. Then automatically you problem would resolved.

Hi Mike

I have also facing the same problem as you have.

i think you have not Re-Initialize the container.

Please Reinitialze the contianer. Then automatically you problem would resolved.

6 REPLIES 6
Read only

Former Member
0 Likes
1,284

Refresh the internal table used to hold the data for the text editor when the Cancel button is pressed.

Manoj

Read only

Former Member
0 Likes
1,284

check this or like this

<b>FU FREE_TEXT_MEMORY

____________________________________________________

Text

SAPscript: Delete all texts in update catalog (Textmemory)

Functionality

All text modules whose object identifiers are defined for storage in the update task are initially stored in the text memory.

The text memory has been created within ABAP memory and as such is preserved even when a transaction is called in call mode in an application program (CALL TRANSACTION, SUBMIT AND RETURN or CALL DIALOG). The same is true for reports and dialog modules. This means that all programs in this CALL hierarchy called by an application program work with the same text memory and thus have access to the same texts.

If an application program wants to insure that the text memory is empty after another transaction has been called in CALL mode, it uses the function module FREE_TEXT_MEMORY, that deletes all text memory texts. In principle, you can call this function module at the beginning of a transaction to insure that the text memory is empty, that is that you are programming and saving things to an empty text memory buffer. In concrete cases, this must be determined by the application program.

Further Information

See the description of the text memory and CALL mode in the SAP Online Documentation for SAPscript (section Program interface -> Textmemory)

Parameters

LOCAL_CAT

Exceptions

NOT_FOUND

Function Group

STXD</b>

rregards

Prabhu

Read only

Former Member
0 Likes
1,285

Hi Mike

I have also facing the same problem as you have.

i think you have not Re-Initialize the container.

Please Reinitialze the contianer. Then automatically you problem would resolved.

Read only

0 Likes
1,284

for this you use at the PBO Event.

for Initialziing the Editor Use below code for the edito


      CONSTANTS: C_LINE_LENGTH TYPE I VALUE 80.
*     define table type for data exchange
      TYPES: BEGIN OF MYTABLE_LINE,
               LINE(C_LINE_LENGTH) TYPE C,
             END OF MYTABLE_LINE.

      DATA G_MYTABLE TYPE TABLE OF MYTABLE_LINE.

      if not g_editor_container1 is initial.
        CALL METHOD g_editor_container1->FREE
          EXCEPTIONS
            CNTL_ERROR        = 1
            CNTL_SYSTEM_ERROR = 2
            others            = 3.
        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.
*   create control container
      CREATE OBJECT g_editor_container1
          EXPORTING
              container_name = 'CUST_CTRL'
          EXCEPTIONS
              cntl_error = 1
              cntl_system_error = 2
              create_error = 3
              lifetime_error = 4
              lifetime_dynpro_dynpro_link = 5.

*&   create Editor
      CREATE OBJECT editor_400
        EXPORTING
           parent = g_editor_container1
           wordwrap_mode = cl_gui_textedit=>wordwrap_at_fixed_position
           wordwrap_to_linebreak_mode = cl_gui_textedit=>true
        EXCEPTIONS
            others = 1.

      CALL METHOD cl_gui_cfw=>flush
        EXCEPTIONS
          OTHERS = 1.
*Delete Text
      CALL METHOD editor_400->DELETE_TEXT
*  EXCEPTIONS
*    ERROR_CNTL_CALL_METHOD = 1
*    others                 = 2
              .
      IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.

Read only

Former Member
0 Likes
1,284

the below code would refresh the long text data.


   if not g_editor_container1 is initial.
        CALL METHOD g_editor_container1->FREE
          EXCEPTIONS
            CNTL_ERROR        = 1
            CNTL_SYSTEM_ERROR = 2
            others            = 3.
        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.

Read only

0 Likes
1,284

actualy it is enough to do the following, assuming you have a container to put the textedit into it:

*********************************************************

DATA: l_parent_container TYPE REF TO cl_gui_custom_container,

l_obj_editor TYPE REF TO cl_gui_textedit, "make this a global variable

l_text_table TYPE re_t_textline,

l_itftext TYPE STANDARD TABLE OF tline,

l_thead TYPE thead.

  • l_parent_container = ... "your container

  • move .... to l_thead... "your text header to read or reread

  • read text from SO10

CALL FUNCTION 'READ_TEXT'

EXPORTING

id = l_thead-tdid "Text-ID

language = l_thead-tdspras "im_request-language?

name = l_thead-tdname "TDIC Text-Name

object = l_thead-tdobject "Texte: Anwendungsobjekt

TABLES

lines = l_itftext

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 SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

  • convert itf text to stream text (SAPSCRIPT_DEMO_NOTE_EDITOR)

CALL FUNCTION 'CONVERT_ITF_TO_STREAM_TEXT'

TABLES

itf_text = l_itftext

text_stream = l_text_table.

IF l_obj_editor IS INITIAL.

CREATE OBJECT l_obj_editor

EXPORTING parent = l_parent_container. " Abstract Container for GUI Controls

ENDIF.

  • discard any previous changes

l_obj_editor->set_textmodified_status( cl_gui_textedit=>false ).

  • übertragen text in editor

CALL METHOD l_obj_editor->set_text_as_stream

EXPORTING

text = l_text_table

EXCEPTIONS

error_dp = 1

error_dp_create = 2.