Send email with Attachment from a SAP Unicode system – with func SO_DOCUMENT_SEND_API1

What a looong title :P

The Problem is that reusing code for sending email with attachment from a sap non-unicode to a sap unicode system the att file (in my case was a .pdf) results unreadable, using the function SO_NEW_DOCUMENT_ATT_SEND_API1 or SO_DOCUMENT_SEND_API1 .

A typical call of the function is:

CALL FUNCTION ‘SO_DOCUMENT_SEND_API1′
EXPORTING
DOCUMENT_DATA                   = DOCUMENT_DATA
PUT_IN_OUTBOX                      = PUT_IN_OUTBOX
SENDER_ADDRESS                   = INVOICE_SENDER
SENDER_ADDRESS_TYPE      = ADDR_TYPE
IMPORTING
SENT_TO_ALL             = SENT_TO_ALL
NEW_OBJECT_ID      = NEW_OBJECT_ID
SENDER_ID                  = SENDER_ID
TABLES
PACKING_LIST               = PACKING_LIST
OBJECT_HEADER         = OBJECT_HEADER
CONTENTS_BIN             = CONTENTS_BIN
CONTENTS_TXT             = CONTENTS_TXT
OBJECT_PARA                = OBJECT_PARA
OBJECT_PARB                = OBJECT_PARB
RECEIVERS                       = RECEIVERS
EXCEPTIONS…

And the PACKING_LIST-DOC_SIZE is usually valorized as:

PACKING_LIST-DOC_SIZE   = TAB_LINES * 255.

But the right code that solve the Problem is:

PACKING_LIST-DOC_SIZE   = TAB_LINES * 255 * 2.

Due to the change data representation. Helpful docs on Sap and unicode here.

Please feel free to comment :)

Share this post:
  • Print
  • Digg
  • StumbleUpon
  • del.icio.us
  • Facebook
  • Twitter
  • Google Buzz
  • LinkedIn
  • Tumblr
Posted martedì, giugno 29th, 2010 under Sap.

Tags: , ,

Leave a Reply