cancel
Showing results for 
Search instead for 
Did you mean: 

Send Smartform converted in PDF via ABAP Proxy

jccarret
Explorer
0 Kudos

Dear all,

I don't manage to send a smartform converted into PDF using ABAP proxy.

I use the following logic :

- call SSF_FUNCTION_MODULE_NAME to get smartform function module

- call smartform function module (with option get_otf)

- call CONVERT_OTF with PDF option

- lo_attachment = lo_attachment_protocol->get_attachment_from_text( data = lv_attachment
                                                                        type = if_ai_attachment=>c_mimetype_pdf
                                                                        name = lv_attachment_name ).

OR

*      lo_attachment = lo_attachment_protocol->get_attachment_from_binary( data = lx_attachment
*                                                                          type = if_ai_attachment=>c_mimetype_pdf
*                                                                          name = lv_attachment_name ).

But Without success.

Can you :

- tell me if my scenario is feasible ?

- Do you have an example ?

- What is the format returned by CONVERT_OTF (Binary directly ?)

Do I have to format data again after CONVERT_OTF ?

Thanks a lot,

Jean-Charles

Accepted Solutions (1)

Accepted Solutions (1)

Ryan-Crosby
Active Contributor
0 Kudos

Hi Jean-Charles,

I believe the format returned by the FM 'CONVERT_OTF' is XSTRING.  In that case you can use the FM 'SCMS_XSTRING_TO_BINARY' to get the contents of the PDF file in binary format if you want to convert in the ABAP Proxy directly.  Another option would be to convert the XSTRING to binary in a java mapping.  I have never gone the route of converting directly in the ABAP proxy but I know that the java mapping option works.

Regards,

Ryan Crosby

jccarret
Explorer
0 Kudos

Hi Ryan,

Thank you for this answer.

I success using FM :

CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'

         EXPORTING

           input_length       = lv_bin_filesize

*          FIRST_LINE         = 0

*          LAST_LINE          = 0

         IMPORTING

           buffer             = lx_attachment

         TABLES

           binary_tab         = lt_pdf2

         EXCEPTIONS

           failed             = 1

           OTHERS             = 2.

For all, Note that lt_pdf2 is different than the outbound table return by CONVERT_OTF (only one column)

Best regards,

Jean-Charles

Answers (0)