03-13-2023 11:12 AM
Hi all,
I have a requirement, need to add the attachment to an email.
There is one Smart form, I execute it and have the output redirected to an import parameter.
1] After that I've set ls_control_param-getotf = 'X'. to send the pdf output to import parameter job_output_info-otfdata[] (this will be in itcoo format)
2] Converted to email attachment format.
lt_objbin TYPE TABLE OF solisti1 WITH HEADER LINE,
CALL FUNCTION 'Z_CONVERT_OTF_2_PDF_MAIL_ATTCH'
TABLES
t_objbin = lt_objbin
t_itcoo = ls_job_info-otfdata.
But now when I'm using call method to add attachment and passing following parameters.
Getting error as: "LT_OBJBIN" is not type-compatible with formal parameter "I_ATT_CONTENT_TEXT".
Can anyone please suggest what can be done in this case.
Thank you,
Ankita.
03-13-2023 2:54 PM
Hello,
Initial tip: if you are working with files (file data) then I would recommend to always work only with binary data => not with text.
Now nobody here knows what is inside Z_CONVERT_OTF_2_PDF_MAIL_ATTCH function. But lets guess there is function CONVERT_OTF used inside. This FM returns binary data (bin_file TYPE xstring) after it converts "otfdata" to PDF.
You should use this bin_file when attaching PDF to e-mail. To do that first convert bin_file to "SOLIX_TAB", for example using method cl_bcs_convert=>xstring_to_solix. And finally use parameter I_ATT_CONTENT_HEX (solix_tab) and I_ATTACHMENT_SIZE (xstrlen of bin_file), instead of I_ATT_CONTENT_TEXT.
03-13-2023 4:50 PM
Hi Tomas,
Thank you,
You are ryt CONVERT_OTF is used but here in importing we dont have bin_file. Please refer to below screenshot.
03-14-2023 9:09 AM
ankitashinde173 It is Z function module, so you should be able to easily modify it 🙂 I really recommend to use "bin_file" (xstring) parameter. It is much easier to work with xstring. The logic I see in your screenshot is very old (working with "t_lines" and counting 255 size etc...).
03-14-2023 7:24 AM
little bit old coding but should help you
https://blogs.sap.com/2013/05/30/sending-mail-using-oo-2-smartforms/
03-14-2023 11:17 AM
Please don't post code as image, copy/paste the code as text so that people can edit it. Also don't forget to click the button CODE so that it's nicely displayed and we can read it easily.