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

Getting problem while calling method g_editor->get_text_as_r3tab

Former Member
0 Likes
1,714

Hello Gurus,

I have a requirment of to give 2 text editor on the screen and get the input from the user and print it.

I am using call method g_editor->get_text_as_r3table to retrive the data.

on my save event I called g_editor->get_text_as_r3table method and pass my 1 internal table and flush it by call method cl_gui_cfw=>flush

again I call call method g_editor->get_text_as_r3table method and pass my 2ne Internal table and flush it

but when i chek my Internal table, both the Internal table having same data of my second Text editor.

Can ou help me to solve this problem

How can i get First Text editor data on 1st internal table

and Second Text editor data on 2 nd internal table

Thanks in adv.

Kaustubh

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,342

Hello Marcin,

Thanks for your reply,

I have use the CALL METHOD r_textedit->set_text_as_r3table to set the data it working. it save my old data into internal table,

But when i enter some new lines into same editor and click on save, I am not getting new data which i enter in editor on my internal table.

it is showing old dat only which i set by CALL METHOD r_textedit->set_text_as_r3table.

I think its proble with CALL METHOD g_editor2->get_text_as_r3table on first run it fetch the data properly after any event its not fetch the data.

Can you help me how I will fetch the updated data which is enter on Editor.

Thanks

Kaustubh

7 REPLIES 7
Read only

Former Member
0 Likes
1,342

Hi,

You should have 2 different editors.

For Ex : g_editor and g_editor_2

g_editor->get_text_as_r3table

g_editor_2->get_text_as_r3table

Read only

Former Member
0 Likes
1,342

Hi cagatay ,

Thanks for your reply..

You solved my one proble...

its working fine now but one problem still active....

when first time I entered some data and click on save it will give me the screen input on my internal table.

but if I made some modification on same test or I enter same new ilnes and click on save it will refresh my internal table

I am not getting any data on my internal table if I modify the Text editor contant

Can you help me on this I am not getting what is happaning ....

Thanks for your fist reply...

Kaustubh

Read only

0 Likes
1,342

I think you will need also to use method set_text_as_r3table in PBO in order data don't flush after each PAI.

Refer below program for the logic:



REPORT zglxx_pro_re_textedit_oo_pmi.

DATA: r_textedit TYPE REF TO cl_gui_textedit,
      r_cont     TYPE REF TO cl_gui_custom_container.

DATA: itab TYPE TABLE OF char255.

CALL SCREEN 100.


MODULE pbo OUTPUT.
  IF r_cont IS INITIAL.
    CREATE OBJECT r_cont
      EXPORTING
        container_name              = 'CUSTOM_CONTROL'.

    CREATE OBJECT r_textedit
      EXPORTING
        wordwrap_mode          = cl_gui_textedit=>wordwrap_at_fixed_position
        parent                 = r_cont.
  ENDIF.

  CALL METHOD r_textedit->set_text_as_r3table    "set your internal table content in order to keep data
    EXPORTING
      table = itab.


ENDMODULE.                   


MODULE pai INPUT.
  REFRESH itab.

    CALL METHOD r_textedit->get_text_as_r3table  "now set new internal table
      IMPORTING
        table = itab.

ENDMODULE.                  

Regards

Marcin

Read only

Former Member
0 Likes
1,343

Hello Marcin,

Thanks for your reply,

I have use the CALL METHOD r_textedit->set_text_as_r3table to set the data it working. it save my old data into internal table,

But when i enter some new lines into same editor and click on save, I am not getting new data which i enter in editor on my internal table.

it is showing old dat only which i set by CALL METHOD r_textedit->set_text_as_r3table.

I think its proble with CALL METHOD g_editor2->get_text_as_r3table on first run it fetch the data properly after any event its not fetch the data.

Can you help me how I will fetch the updated data which is enter on Editor.

Thanks

Kaustubh

Read only

0 Likes
1,342

Kaustubh,

Are you sure you are using same editor both in PAI and PBO (namely g_editor , not g_editor2 )?

The code I gave you will take the input from itab during PBO, and tabke it back there during PAI and again show it on screen in PBO (after dialog step). So, I think there is something with addressing both text editors.

Try to achieve this for first editor, then if it works do the same for the second one.

Regards

Marcin

Read only

Former Member
0 Likes
1,342

Hello

Please find the below code I am using........

module USER_COMMAND_1000 input.
  CASE sy-ucomm.

    WHEN 'EXIT'.
      PERFORM exit_program.

    WHEN 'SAVE'.
*   retrieve table from control
      refresh g_mytable.
      CALL METHOD g_editor->get_text_as_r3table
*              EXPORTING
*                  ONLY_WHEN_MODIFIED = 1
              IMPORTING
                  table = g_mytable.

      refresh g_mytable1.
      CALL METHOD g_editor2->get_text_as_r3table
              IMPORTING table = g_mytable1.

     ENDCASE.
endmodule.                 " USER_COMMAND_1000  INPUT


module STATUS_1000 output.
*   set status
  SET PF-STATUS 'ZZEDITOR'.
*   create control container
    CREATE OBJECT g_editor_container
        EXPORTING
            container_name = 'TEXTEDITOR1'
        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 = 'TEXTEDITOR1'.

*   create calls constructor, which initializes, creats and links
*   TextEdit Control
    CREATE OBJECT g_editor
          EXPORTING
           parent = g_editor_container
           wordwrap_mode =
              cl_gui_textedit=>wordwrap_at_fixed_position
           wordwrap_position = line_length
           wordwrap_to_linebreak_mode = cl_gui_textedit=>true.

*   to handle different containers
    g_container_linked = 1.

      CALL METHOD g_editor->set_text_as_r3table
              EXPORTING
                  table = g_mytable.

Edited by: Thomas Zloch on Apr 1, 2010 5:12 PM - please use tags around your creations!

Read only

Former Member
0 Likes
1,342

Thanks Marcin and Cagatay,

You solved my problem....

Its working now

Thanks again for your help.........

Kaustubh