Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 9760

Re: g_editor->get_text_as_r3table - not working second time around

$
0
0

Hi,

 

I try to explain by writing little code. I hope this will help:

 

 data : begin of ls_text_tables,                 row_index type sy-tabix,                 text_table type fcom_text, " You can use suitable table type for this            end of ls_text_tables,       lt_text_tables like standart table of ls_text_tables.


* when table button click
 if you call for the first time.
* 1) create editor
* 2) set ls_text_tables-row_index to clicked row tabix
* 3) if you want text from table or text object ( table stxh, search for read_text, save_text function for better understanding. )
* call it and set to ls_text_tables-text_table
* Now set this table to editor.


else.
check ls_text_tables-row_index ne lv_clicked_row_index. " dont need to change editor data. user clicked same row button.


* first check editor has data?
* ls_text_tables-row_index is old clicked row index.
    CALL METHOD G_EDITOR->get_text_as_r3table      EXPORTING        only_when_modified     = cl_gui_textedit=>false      IMPORTING        table                  = ls_text_tables-text_table      EXCEPTIONS        error_dp               = 1        error_cntl_call_method = 2        error_dp_create        = 3        potential_data_loss    = 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.


modify lt_text_tables
  from ls_text_tables. " Now we set old row text data
clear : ls_text_tables.


* Read new clicked row
read table lt_text_tables
      into ls_text_tables  with key row_index = lv_clicked_row_index. " I think you can have this    CALL METHOD G_EDITOR->set_text_as_r3table      EXPORTING        table           = ls_text_tables-text_table " if sy-subrc ne 0 this will be initial      EXCEPTIONS        error_dp        = 1        error_dp_create = 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.

Viewing all articles
Browse latest Browse all 9760

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>