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: 

Unable to refresh data text editor using class CL_GUI_TEXTEDIT

Former Member
0 Kudos
3,758

Hi all,

I am using CL_GUI_TEXTEDIT->SET_TEXT_AS_STREAM to display text in dialog program. It is displaying the message.

When i come back to the intial page of the transaction and change the document number. It is showing the previous data.

I have debugged the code and found that the data in the internal table passed to the method SET_TEXT_AS_STREAM is Different but still it is displaying the previous value.

Please help me how to proceed to display new data.

Regards,

Gautham

6 REPLIES 6

Former Member
0 Kudos
1,058

I Think there might be some clear or refresh problem. Before coming to the initial screen, clear the output field you are displaying the text in the PAI and proceed.

Thanks,

Vamshi.

former_member194669
Active Contributor
1,058

Hi,

I have done is moving from text_editor to other screen i just free the container

and recreate thru PBO of the same screen.

I know this is not right way but it works perfectly


form f_exit_screen.
  if not g_editor is initial.
    call method g_editor->free
      exceptions
        others = 1.
    if sy-subrc ne 0.
    endif.
    free g_editor.
  endif.

  if not g_editor_container is initial.
    call method g_editor_container->free
      exceptions
        others = 1.
    if sy-subrc <> 0.
    endif.
    free g_editor_container.
  endif.

  call method cl_gui_cfw=>flush
    exceptions
      others = 1.
  if sy-subrc ne 0.
  endif.
  leave program.
endform.                                 " F_exit_program


module status_1300 output.
  if g_editor is initial.
    g_repid = sy-repid.

    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.
    endif.

    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.
    if sy-subrc ne 0.
    endif.
  endif.

endmodule.                    "status_1300 OUTPUT

aRs

Former Member
0 Kudos
1,058

HI Gautham

I m also using the CALL METHOD editor->set_text_as_stream, but the data is not getting refreshed. PLease provide your inputs if your issue is resolved.

Your inputs are very useful in solving my problem.

P.S: the below is the code for ur quick ref:

CREATE OBJECT:

container EXPORTING container_name = 'TEXTEDIT',

editor EXPORTING parent = container,

handle.

event-eventid = cl_gui_textedit=>event_f1.

event-appl_event = 'X'. "system event

APPEND event TO event_tab.

event-eventid = cl_gui_textedit=>event_f4.

event-appl_event = 'X'. "application event

APPEND event TO event_tab.

CALL METHOD: editor->set_registered_events

EXPORTING events = event_tab.

SET HANDLER handle->handle_f1

handle->handle_f4 FOR editor.

it_text1[] = it_text[].

CLEAR it_text[].

CALL METHOD editor->set_text_as_stream

EXPORTING

text = it_text1.

CLEAR : lv_lines , lv_lines_to.

DESCRIBE TABLE it_text1 LINES lv_lines.

lv_lines_to = lv_lines + 1.

ENDIF.

Thanks

Sudha

Edited by: h_sudha on Jun 12, 2011 9:18 AM

Clemenss
Active Contributor
0 Kudos
1,058

Hi gautham,

without going into the details you did not provide: This is a common GUI control trouble: If you do not call the free method of the container, the 'old' container will live on with it's content.

So make sure that before you CREATE a new object, you call method FREE of the container and then free the object.

In debugger you may observe the number of the instance of all created instances.

Regards,

Clemens

Former Member
0 Kudos
1,058

thanks much for your insights.

FWIW:

I have the problem with container and textedit within a Function Module/Group

  (dynpro on screen in Fu.Group),

but not if it is within a report

  (container/textedit on dynpro/screen on Report).

Using method SET_TEXT_AS_R3TABLE() to populate the Textedit and a

CALL METHOD cl_gui_cfw=>flush EXCEPTIONS OTHERS = 1.

When the problem exists (calling the Fu.Group/Module)

in the debugger I can see the Object IDs changing,

because I delete (clear) the objects and recreate them every time. (both container and textedit)

The new text is loaded into the newly created textedit object, which is inside the newly created custom_container object.

But when the screen of the Fu.Group displays, then:

the title of the screen has changed alright,

but always the same text displays,

as when the Fu.Group/Module was called the first time in the SapGui session.

So somehow there is life beyond the deleted and newly created objects (container and textedit),

which keeps displaying the old text.

The new text displays only since adding this:

namely using the container's FREE method before deleting the container object, like:

  O_CUSTOM_CONTAINER->FREE(

     EXCEPTIONS
       CNTL_ERROR        = 1
       CNTL_SYSTEM_ERROR = 2
       OTHERS            = 3
   ).

And I noticed that the FREE has to be called with the "original" container object;

because calling the FREE method only subsequently with a newly created container, did not help;

(So this was "solved" using FREE after the Screen has been displayed and exited, and then next time creating new objects)

FWIW

CALL METHOD cl_gui_cfw=>UPDATE_VIEW ...

did not solve this.




0 Kudos
114

Thank you very much for your explanation ! , actually solved the issue for module pool as well. pretty weird even after FREE statement of the object keep displaying the same text , using both   go_container->free). , go_textedit>free).  solved it !