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: 

PDF attached to an email when used CALL FUNCTION 'Z_CONVERT_OTF_2_PDF_MAIL_ATTCH'

0 Kudos

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.

5 REPLIES 5

Tomas_Buryanek
Active Contributor

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.

-- Tomas --

0 Kudos

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.

0 Kudos

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...).

-- Tomas --

FredericGirod
Active Contributor
0 Kudos

Sandra_Rossi
Active Contributor
0 Kudos

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.