Posted: Fri Nov 07, 2008 6:18 pm Post subject: Sending Excel at attachments
Code:
REPORT zpsendmailexternal .
*This table requires information about how the data in the
*tables OBJECT_HEADER, CONTENTS_BIN and CONTENTS_TXT are
*to be distributed to the documents and its attachments.
DATA: objpack LIKE sopcklsti1 OCCURS 2 WITH HEADER LINE.
*This table must contain the summarized data dependent on each object
*type.
*SAPscript objects store information here about forms and styles,
*for example. Excel list viewer objects store the number of rows and
*columns
*amongst other things and PC objects store their original file name.
DATA: objhead LIKE solisti1 OCCURS 1 WITH HEADER LINE.
*CREATION OF INTERNAL TABLE
DATA : BEGIN OF itobjbin OCCURS 10 ,
vbeln TYPE vbrp-vbeln,
matnr TYPE vbrp-matnr,
werks TYPE vbrp-werks,
fktyp LIKE vbrk-fktyp,
END OF itobjbin .
*This table must contain the summarized content of the objects
*identified as binary objects.
*DATA: OBJBIN LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.
DATA: objbin TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
WITH HEADER LINE.
DATA: wa_itobjbin LIKE itobjbin .
*This table must contain the summarized content of the objects
*identified as ASCII objects.
DATA: objtxt LIKE solisti1 OCCURS 10 WITH HEADER LINE.
*This table must contain the document recipients.
DATA: reclist LIKE somlreci1 OCCURS 5 WITH HEADER LINE.
*This structure must contain the attributes of the document to be sent.
DATA: doc_chng LIKE sodocchgi1.
DATA: tab_lines LIKE sy-tabix.
DATA : v_fktyp LIKE vbrk-fktyp.
*Creating the document to be sent
doc_chng-obj_name = 'OFFER'. " input contains the attributes of the
*document to be sent
doc_chng-obj_descr = 'EMAIL WITH EXCEL DOWNLOAD'. "input contains
*title/subject of the document
*BODY OF THE MAIL
objtxt = 'Hi'.
APPEND objtxt .
objtxt = 'Test for excel download'.
APPEND objtxt.
objtxt = 'Below is the attachment with Billing Document Details'.
APPEND objtxt.
objtxt = 'Regards'.
APPEND objtxt.
WRITE: / 'no authorization to send to the specified number of',
'recipients!'.
WHEN 2.
WRITE: / 'document could not be sent to any of the recipients!'.
WHEN 4.
WRITE: / 'no authorization to send !'.
WHEN OTHERS.
WRITE: / 'error occurred during sending !'.
ENDCASE.
**---------------------------------------------------------------------
** Form build_xls_data_table
**---------------------------------------------------------------------
*text
*----------------------------------------------------------------------
*
*--> p1 text
*<-- p2 text
*----------------------------------------------------------------------
FORM build_xls_data_table .
DATA: con_cret LIKE cl_abap_char_utilities=>cr_lf. "OK for non Unicode
*con_tab TYPE C VALUE '09'. "OK for non Unicode
DATA:con_tab LIKE cl_abap_char_utilities=>newline.
CONCATENATE 'Billing Document' 'Material Number' 'Plant' 'Billing
category' ' ' INTO objbin SEPARATED BY con_tab.
CONCATENATE con_cret objbin INTO objbin.
APPEND objbin.
LOOP AT itobjbin .
CONCATENATE itobjbin-vbeln itobjbin-matnr itobjbin-werks itobjbin-fktyp
INTO objbin SEPARATED BY con_tab.
CONCATENATE con_cret objbin INTO objbin.
APPEND objbin.
ENDLOOP.
ENDFORM.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG. SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG. Every effort is made to ensure content integrity. Use information on this site at your own risk.