Application Development 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: 

GET_TEXT_AS_R3TABLE problem

Former Member
0 Kudos

Dear team,

i am using GET_TEXT_AS_R3TABLE

and SET_TEXT_AS_R3TABLE to read the text and retrieve the text in TRIP transaction.

Requirement is one more comment field to enter the text in travel expense . based on that i added one more comments text box using CL_GUI_TEXTEDIT. to save the data i am using one custom table.

Now assume that i have 2 travel requests with expenses. i want to change the text which is entered by me in the custom comment field. First time it is showing the text which is entered by me previously. Now i changed that text and try to save that text GET_TEXT_AS_R3TABLE, in this case it is not retrieving the text from the custom field. Why i donu2019t know. but when i am creating newly it is ok

.but second time why it is not retrieving the data i am not under stand.

Now second problem is now i am opening second travel request , but it is showing the first travel request comments.

If i closes the entire transaction, if i open again it is showing the releated text only. Without closing the transaction if i am opening the travel request at that time it is showing the previous text.

Please help me on this.

Regards,

Surya.

6 REPLIES 6

Sandra_Rossi
Active Contributor
0 Kudos

I already saw that kind of problem, I am pretty sure that it's about either creation or deletion of the control:

either, in the pbo, make sure you create it only once: if control is not bound. create object control...

or, in the pai, when you exit the screen, free the control: call method control->free...

see [sap help|http://help.sap.com/saphelp_nw2004s/helpdata/en/9b/d080c09fc111d2bd68080009b4534c/frameset.htm] for more information

0 Kudos

Thank you Rossi,

What ever u said FREE editor_container. it is already there in my coding.

I got the solution , i did one mistake there. based on event i wrote PBO in one include. and PAI in anthore include.

after modifying that (PBO & PAI should be in same include), it is working fine.

Thank you once agin for u r response Rossi.

Regards,

Surya.

0 Kudos

What you say is very very strange, it should not be a problem to have PBO and PAI in different includes, these last are only for organizational or architecture purpose.

Moreover, call method control->free is not the same as FREE control (there is a difference with flush and things like that if I remember well).

Anyway, if it's solved, please mark the thread as solved.

0 Kudos

Problem solved.

Dear Rossi,

In TRIP transaction,

PBO

If u click on change the travel expense report, in the screen 0002 the FCODE = 'EXPENSAEN'. There u can get person number and trip number, so I thought that what ever the travel comments we entered previously we can fetch here and we can display by using the CALL METHOD TEXT_EDITOR->SET_TEXT_AS_R3TABLE

So I implemented accordingly. It is working fine for to display the comments.

PAI

While saving the data screen will change to 3000, so there I implemented code to save the comments. In debugging I found that, while changing the travel expense report,

Also it is going to screen number 3000, but here we FCODE are space.

But by using sy-subrc, I am getting what I require, in the screen 3000.

So, thatu2019s why I replied that PBO and PAI problem.

Any how my problem is solved, thank you once again for the reply.

Former Member
0 Kudos

hi

please try to put the SET text statments in PBO event based modules

and GET text statements in PAI event based modules.I haven't got any problem as u said

when i used the code below

below is a sample code which worked for me

data:

  • reference to wrapper class of control based on OO Framework

w_editor type ref to cl_gui_textedit,

  • reference to custom container: necessary to bind TextEdit Control

w_container type ref to cl_gui_custom_container.

PBO Module

1) create object: w_container exporting container_name = 'CONTROL',

w_editor exporting parent = w_container.

2) call method w_editor->set_text_as_r3table

exporting

table = t_table[].

PAI Module

case sy-ucomm

when 'SAVE'.

call method w_editor->get_text_as_stream

importing

text = t_table.

endcase.

text = t_table.

NguyenTuan04
Discoverer
0 Kudos

Hi, please check all things below:

  • You need to use method cl_gui_cfw=>flush after calling method get_text_as_r3_table
  • In PBO, before creating object EDITOR, you need to check if it is INITIAL or not.