Skip to Content
0
Former Member
Aug 06, 2012 at 08:17 AM

Attachment mail with excel and Header should be in Bold

1691 Views

Hi abap gurus,

i am able to sending mail with attachment but my requirement is that after sending mail in that Excel Sheet Attachment the Header should be in BOLD.

i have searched in SCN and found only code for mail sending with / without attachments. please post the code for the above requirement.

<removed by moderator>

My code is :

CONCATENATE 'COMPANY CODE'
'SUPPLIER NAME'
'SUPPLIER GSL'
'PAY SITE CODE'
'PAY SITE ADDRESS'
'PAY SITE CITY'
'PAY SITE STATE'
'PAY SITE COUNTRY'
'INVOICE NO'
'VOUCHER NO'
'PO NUMBER'
'PO LINE'
'PO BUYER SSO'
'INVOICE DATE'
'CANCELLED DATE'
'INVOICE ENTRY DATE'
'INVOICE AMT'
'CREATED BY'
'STATUS'
INTO IT_ATTACHMENT SEPARATED BY
CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.
CONCATENATE CL_ABAP_CHAR_UTILITIES=>CR_LF IT_ATTACHMENT INTO IT_ATTACHMENT.
APPEND IT_ATTACHMENT.

* Selecting the mail id's
SELECT INTID
EMAIL
FROM ZTBIDL
INTO TABLE T_ZTBIDL
WHERE INTID = 'RICEF21' AND
OBJ_NAME = 'PIC'.

LOOP AT T_ZTBIDL INTO WA_ZTBIDL.

IT_RECEIVERS-RECEIVER = WA_ZTBIDL-EMAIL.
IT_RECEIVERS-REC_TYPE = 'U'.
IT_RECEIVERS-COM_TYPE = 'INT'.
IT_RECEIVERS-NOTIF_DEL = 'X'.
IT_RECEIVERS-NOTIF_NDEL = 'X'.
IT_RECEIVERS-EXPRESS = 'X'.
APPEND IT_RECEIVERS.
ENDLOOP.

*File Type
LD_FORMAT = 'XLS'.
**File Name
CONCATENATE 'PIC_' SY-DATUM INTO LD_ATTFILENAME.
* Fill the document data.
GD_DOC_DATA-DOC_SIZE = 1.
* Populate the subject/generic message attributes
GD_DOC_DATA-OBJ_LANGU = SY-LANGU.
GD_DOC_DATA-OBJ_NAME = 'SAPRPT'.
GD_DOC_DATA-OBJ_DESCR = PSUBJECT .
GD_DOC_DATA-SENSITIVTY = 'F'.
* Fill the document data and get size of attachment
CLEAR GD_DOC_DATA.
* Populate the subject/generic message attributes
GD_DOC_DATA-OBJ_LANGU = SY-LANGU.
READ TABLE IT_ATTACHMENT INDEX W_CNT.
GD_DOC_DATA-DOC_SIZE = ( W_CNT - 1 ) * 255 + STRLEN( IT_ATTACHMENT ).
GD_DOC_DATA-OBJ_NAME = 'SAPRPT'.
GD_DOC_DATA-OBJ_DESCR = PSUBJECT.
GD_DOC_DATA-SENSITIVTY = 'F'.
* Describe the body of the message
CLEAR IT_PACKING_LIST.
REFRESH IT_PACKING_LIST.
IT_PACKING_LIST-TRANSF_BIN = SPACE.
IT_PACKING_LIST-HEAD_START = 1.
IT_PACKING_LIST-HEAD_NUM = 0.
IT_PACKING_LIST-BODY_START = 1.
DESCRIBE TABLE IT_MESSAGE LINES IT_PACKING_LIST-BODY_NUM.
IT_PACKING_LIST-DOC_TYPE = 'RAW'.
APPEND IT_PACKING_LIST.
**Describe the attachment info
IT_PACKING_LIST-TRANSF_BIN = 'X'.
IT_PACKING_LIST-HEAD_START = 1.
IT_PACKING_LIST-HEAD_NUM = 1.
IT_PACKING_LIST-BODY_START = 1.
DESCRIBE TABLE IT_ATTACHMENT LINES IT_PACKING_LIST-BODY_NUM.
IT_PACKING_LIST-DOC_TYPE = LD_FORMAT.
IT_PACKING_LIST-OBJ_NAME = LD_ATTFILENAME.
IT_PACKING_LIST-OBJ_DESCR = LD_ATTFILENAME.
IT_PACKING_LIST-DOC_SIZE = IT_PACKING_LIST-BODY_NUM * 255.
APPEND IT_PACKING_LIST.

CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
DOCUMENT_DATA = GD_DOC_DATA
PUT_IN_OUTBOX = 'X'
COMMIT_WORK = 'X'
TABLES
PACKING_LIST = IT_PACKING_LIST
CONTENTS_BIN = IT_ATTACHMENT
CONTENTS_TXT = IT_MESSAGE
RECEIVERS = IT_RECEIVERS.

ENDIF.

Message was edited by: Thomas Zloch