cancel
Showing results for 
Search instead for 
Did you mean: 

Sapscript/Smartform via mail with PDF attachment: logo is missing

Former Member
0 Kudos

Hi all

I'm implementing my function to send Sapscript/smartform via mail.

I need to do it because when a message needs to be sent, I have to insert the message as attachment but also to add a text in the body mail.

So I've just created a simple sapscript having a logo (as graphic) and a little text.

I use the fm CONVERT_OTF to convert the OTF to PDF format and the following code to increase the pdf string from 132 to 255 char:

LOOP AT t_pdf.
      TRANSLATE t_pdf USING ' ~'.
      CONCATENATE l_buffer t_pdf INTO l_buffer.
    ENDLOOP.
    TRANSLATE l_buffer USING '~ '.
    DO.
      MOVE l_buffer TO l_attachment.
      APPEND l_attachment TO x_attachment.
      SHIFT l_buffer LEFT BY 255 PLACES.
      IF l_buffer IS INITIAL.
        EXIT.
      ENDIF.
    ENDDO.

All seem to work fine, but as soon as I open the pdf file attached to the mail I can't see the logo

So after calling fm CONVERT_OTF, I've created a pdf file by method GUI_DOWNLOAD, and then upload this file (by GUI_UPLOAD) into internal table for attachment and send the mail.

Now really all work very fine, becaus I can see the logo

Of course I don't want to dowload the file before sending a mail, but I need to send my print directly as pdf attachment

The two ways seem to be equal, they use the same print and the same functions, only the way to upload the internal table for attachment is different:

1) tha abap code above to expand the line from 132 to 255

2) the method GUI_UPLOAD

So something seems to be wrong in the first way because ithe logo is missing in the pdf attachment generated for the mail

Max

Accepted Solutions (1)

Accepted Solutions (1)

aidan_black
Active Contributor
0 Kudos

Hi,

I guess you do not use the BIN_FILE parameter when calling CONVERT_OTF so therefore the PDF data is returned via table LINES. There can be problems with this in a Unicode system. PDF data returned via table LINES must put into the PDF file without any codepage conversion.

e.g TRANSLATE commands like you use can destroy the PDF data.

Can you try using parameter BIN_FILE when calling CONVERT_OTF so the PDF data is returned as type XSTRING and use the the example BCS_EXAMPLE_8 of SAP Note 1324547 to handle the PDF data returned.

Regards,

Aidan

Former Member
0 Kudos

Hi

I'm not working on unicode system, anyway I didn't see that parameter BIN_FILE, so I didn't use it

I've read the note 1324547 and I've done just as it explaines: now works fine

I don't know why it doesn't work with old manner (i.e data is treated as character-type), but it worls with the new one (If the data is treated as xstring-type)

I can only suppose the data are corrupted while being elaborated for expand to 255 char....but I don't why

Anyway your suggestion works for me

Thank

Max

Former Member
0 Kudos

I was having the same problem as max bianchi and I was able to get the document and its logo emailed by converting the spool to internal table via RSPO_RETURN_SPOOLJOB's BUFFER parameter. Then, I sent this internal table to SO_NEW_DOCUMENT_ATT_SEND_API1's CONTENTS_BIN input parameter.

I think the key to this working was that SCON was configured so that SAPScript/Smart Form email attachments are rendered to pdf documents.

Answers (0)