‎2011 Nov 18 5:41 AM
I have created a PR Clarification mail sending program. The Program has a text editor where the user can type his query and also button for adding attachment on the same screen.
For this I am using the function module get_text_as_stream which I am calling through the object of the class cl_gui_textedit. Through this method I am reading the text which the user types in the screen and then sending it via mail.I have added pushbutton for attaching files. On click of this push button I call the 'F4_FILENAME' function to get the file name and then GUI_UPLOAD to upload the file to a separate internal table.
CALL METHOD new_text->get_text_as_stream
EXPORTING
only_when_modified = cl_gui_textedit=>false
IMPORTING
text = it_mail
is_modified =
EXCEPTIONS
error_dp = 1
error_cntl_call_method = 2
OTHERS = 3
.
The program works fine when I am not attaching any files. It reads the texts properly in the internal table. But the problem is when I try to attach files. When the file is attached the file gets loaded properly and is also sent via mail but the mail text which is typed in text editor is not read at all. The result is that I get a blank mail with the attached file and the text is missing.
I have checked the above code in the debug mode.
When no attachments are given the internal table it_mail gets populated with the data from the screen. But when I upload the attachment the internal table IT_MAIL remains blank though the sy-subrc becomes zero.
Any idea why?
Edited by: abap4kirti on Nov 18, 2011 6:43 AM
Edited by: abap4kirti on Nov 18, 2011 6:45 AM
‎2011 Nov 18 6:12 AM
In the Exporting parameter make
only_when_modified = true.
and see if it works.
‎2011 Nov 18 6:21 AM
Thanks for the quick reply.
But initially that parameter was set to true only. It didnt work which is why I made it false but still no data is fetched.
‎2011 Nov 19 12:15 PM
Hi,
When you are attaching the file,the contents of the text editor are cleared since it is leaving the screen.For this everytime you perform the file upload,before 'F4_FILENAME' ,save the data to the internal table.
We had a similar problem that when user attached a file on custom screen and navigates to/fro ,the data disappears
Solution : We saved the data into internal table by reading it from screen and used the set_text to put the data back from internal table to screen
Hope it Helps,
Regards
Byju
‎2011 Nov 22 10:18 AM
Hi,
If that issue is not solved yet, please provide the code used to send the email...
Kr,
Manu.
‎2012 May 30 12:34 PM
Hi,
I am also facing similor kind of problem,
can you please tell me how you solved.
My Problem is
"I am using this FM in Modulepool screen, when the first time the PAI is called the FM is reading the text correctly but it is not reading the TEXT for next times"
I tried with both the options only_when_modified = true and false.
thanks in advance
Regards,
Ram
‎2012 May 30 3:22 PM
‎2022 Sep 08 10:17 PM