cancel
Showing results for 
Search instead for 
Did you mean: 

Convert Smartform to PDF issue in ECC5.0 unicode system

former_member677139
Discoverer
0 Kudos

Hello Expert,

The program convert Smartform as PDF format in email attachment.

I copied the same code from 4.6C non-unicode system to ECC5.0 unicode system, but PDF attachment can not be opened by Adobe Reader 8.0 with the message 'There is an error opening this document.The file is damaged and could not be repaired.'.

Making user can input email receiver manually, use FM 'SO_DYNP_DOCUMENT_TRANSFER_API1'.

Here is the source code.

DATA: lsDocumentData TYPE SODOCCHGI1,

lsSize TYPE I,

  • ltPDFData TYPE STANDARD TABLE OF TLINE,

  • ltDocContent TYPE STANDARD TABLE OF SOLISTI1,

ltPDFData LIKE tline OCCURS 0 WITH HEADER LINE,

ltDocContent LIKE soli OCCURS 0 WITH HEADER LINE.

  • Convert otf data into pdf data

CALL FUNCTION 'CONVERT_OTF'

EXPORTING

FORMAT = 'PDF'

MAX_LINEWIDTH = 134

IMPORTING

BIN_FILESIZE = lsSize

TABLES

OTF = OUTPUT_INFO-OTFDATA

LINES = ltPDFData

EXCEPTIONS

ERR_CONV_NOT_POSSIBLE = 1

ERR_OTF_MC_NOENDMARKER = 2

OTHERS = 3.

    • Change table format from TLINE -> SOLISTI1

CALL FUNCTION 'SX_TABLE_LINE_WIDTH_CHANGE'

EXPORTING

LINE_WIDTH_SRC = 134

LINE_WIDTH_DST = 255

TABLES

CONTENT_IN = ltPDFData

CONTENT_OUT = ltDocContent

EXCEPTIONS

ERR_LINE_WIDTH_SRC_TOO_LONG = 1

ERR_LINE_WIDTH_DST_TOO_LONG = 2

ERR_CONV_FAILED = 3

OTHERS = 4.

  • Create new email - Go to email edition screen

lsDocumentData-obj_name = 'PDF'.

lsDocumentData-obj_descr = sy-title.

lsDocumentData-obj_langu = sy-langu.

lsDocumentData-doc_size = lsSize.

CALL FUNCTION 'SO_DYNP_DOCUMENT_TRANSFER_API1'

EXPORTING

DOCUMENT_DATA = lsDocumentData

DOCUMENT_TYPE = 'PDF'

METHOD = 'SNDA'

TABLES

OBJECT_CONTENT = ltDocContent

EXCEPTIONS

DOCUMENT_TYPE_NOT_EXIST = 1

OPERATION_NO_AUTHORIZATION = 2

PARAMETER_ERROR = 3

X_ERROR = 4

DOCUMENT_NOT_SENT = 5

OTHERS = 6.

Your help will be highly appreciated.

Regards,

Wei

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

hi, have you solved the issue ? I'm facing  the same problem from ECC606 non unicode to ECC617 unicode
REgards .

utyuuhi
Advisor
Advisor
0 Kudos

Please see the following notes about this problem:

1320163 - Incorrect PDF data after Unicode conversion
1324547 - Sending a spool request as PDF via e-mail

You should use the export parameter BIN_FILE when you call the function
module CONVERT_OTFF. If not the PDF is returned via the internal table
PDF.

If you don't use the BIN_FILE parameter, you must see to it that the
PDF data which are returned via internal the table are put into the PDF
file without any codepage conversion. e.g TRANSLATE commands can destroy
the PDF data.

As a solution, please use the parameter BIN_FILE when calling
CONVERT_OTF so the PDF data is returned as type XSTRING and then use
the example program BCS_EXAMPLE_8 to handle the PDF data returned and
send as a email.