Skip to Content

Hi,

I got the requirement to convert a SAP Script to PDF and a Mail to SOST.

But for me Mail is going to SOST, And the PDF options came . But when i click On PDF i couldn’t open the Form. Its shows some Error.

  CALL FUNCTION ‘CLOSE_FORM’
IMPORTING
RESULT 
= RESULT
tables
otfdata
= lt_otf
EXCEPTIONS
OTHERS  = 1.

************************************************************************************
** Convert the OTF File Obtained in a PDF File
************************************************************************************
data: lv_binstr type XSTRING.

CALL FUNCTION ‘CONVERT_OTF’
EXPORTING
FORMAT                      = ‘PDF’
MAX_LINEWIDTH              
= 132
PDF_DELETE_OTFTAB          
= ‘ ‘
IMPORTING
bin_filesize               
= lv_file_size
bin_file                   
= lv_binstr
TABLES
otf                        
= lt_otf
lines                                                 = lt_pdf
.

************************************************************************************
** Convert the Xstring To BINARY
************************************************************************************
CALL FUNCTION ‘SCMS_XSTRING_TO_BINARY’
EXPORTING
buffer     = lv_binstr
TABLES
binary_tab
= lt_binary_tab.


CALL FUNCTION ‘SO_NEW_DOCUMENT_ATT_SEND_API1’
EXPORTING
document_data                   
= ls_gd_doc_data
PUT_IN_OUTBOX                   
= ‘X’
COMMIT_WORK                     
= ‘X’
tables
packing_list                    
= lt_packing_list
OBJECT_HEADER                   
= lt_mail_head
CONTENTS_BIN                    
= lt_mail_bin
CONTENTS_TXT                    
= lt_mailtext
contents_hex                    
= lt_binary_tab
receivers                       
= lt_receivers
EXCEPTIONS
TOO_MANY_RECEIVERS              
= 1
DOCUMENT_NOT_SENT               
= 2
DOCUMENT_TYPE_NOT_EXIST         
= 3
OPERATION_NO_AUTHORIZATION      
= 4
PARAMETER_ERROR                 
= 5
X_ERROR                         
= 6
ENQUEUE_ERROR                   
= 7
OTHERS                           = 8
.
ENDFORM.                    ” ZSEND_MAIL

  LEAR:   ls_mail_bin, ls_mail_head, ls_packing_list.

DESCRIBE TABLE lt_mailtext LINES TAB_LINES.
READ TABLE lt_mailtext Into ls_mailtext INDEX TAB_LINES.
ls_gd_doc_data
DOC_SIZE = ( TAB_LINES 1 ) * 255 + STRLEN( ls_mailtext ).

*#  Creation of the entry for the compressed document CLEAR MAILPACK-TRANSF_BIN.
ls_packing_list
HEAD_START = 1.
ls_packing_list
HEAD_NUM = 0.
ls_packing_list
BODY_START = 1.
ls_packing_list
BODY_NUM = TAB_LINES.
ls_packing_list
DOC_TYPE = ‘RAW’.
APPEND ls_packing_list to lt_packing_list.
CLEAR ls_packing_list.

***********************************************************************************
** To Get the OTF
***********************************************************************************

*PERFORM get_otf.

LOOP AT lt_SOLISTI1 INTO ls_SOLISTI1.
MOVE-CORRESPONDING ls_SOLISTI1 TO lt_mail_bin.
APPEND ls_mail_bin to lt_mail_bin.
CLEAR ls_mail_bin.
ENDLOOP.

DESCRIBE TABLE lt_mail_bin LINES TAB_LINES.
ls_mail_head
= ‘TEST.OTF’.
APPEND ls_mail_head to lt_mail_head.
CLEAR ls_mail_head.

*  Creation of the entry for the compressed attachment
ls_packing_list
TRANSF_BIN = ‘X’.
ls_packing_list
HEAD_START = 1.
ls_packing_list
HEAD_NUM = 1.
ls_packing_list
BODY_START = 1.
ls_packing_list
BODY_NUM = TAB_LINES.
ls_packing_list
DOC_TYPE = ‘OTF’.
ls_packing_list
OBJ_NAME = ‘TEST’.
ls_packing_list
OBJ_DESCR = ‘Subject’.
*MAILPACK-DOC_SIZE = TAB_LINES * 255.
APPEND ls_packing_list to lt_packing_list.
CLEAR ls_packing_list.

endform

Regards,

Sadiq K

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply