Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Excel Sheet attachment to mail - Some problem.

Former Member
0 Likes
541

I am having 5 records in ITAB and all these needs to be in the excel attachment along with a mail.

But, when I open the attachment when sent in the mail.

I have all the records in the First Cell.. 1A...

But I need each record in each Colum like 1A, 2A, 3A .....5A.

Please help. I have used the following code.

Actually this will be used in Back ground...

I have gone checked many post in this forum but no one talks abt this in Back ground..

Can any one please help.

My requirement in a nut shell .....

Background -> ITAB -> EXCEL -> Attachment - > Mail - Display should be proper.

I will reward with full points for any positive help.

REPLY ASAP.

Regards

Ramesh

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
483

Hello,

DO like this.


  CONSTANTS: CON_CRET TYPE X VALUE '0D',  "OK for non Unicode
             CON_TAB TYPE X VALUE '09'.   "OK for non Unicode
DATA: IT_ATTACHMENT LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
 DATA: WA_ATTACHMENT TYPE SOLISTI1.
loop at itab.
if sy-tabix = 1.
concatenate CON_CRET itab-field1 CON_TAB WA_ATTACHMENT.
else.
concatenate WA_ATTACHMENT itab-field1  SEPARATED BY CON_TAB.
endif.
APPEND WA_ATTACHMENT   TO IT_ATTACHMENT.
endloop.

Hope this solves ur problem,

Vasanth

I am having 5 records in ITAB and all these needs to be in the excel attachment along with a mail.

But, when I open the attachment when sent in the mail.

I have all the records in the First Cell.. 1A...

But I need each record in each Colum like 1A, 2A, 3A .....5A.

Please help. I have used the following code.

Actually this will be used in Back ground...

I have gone checked many post in this forum but no one talks abt this in Back ground..

Can any one please help.

My requirement in a nut shell .....

Background -> ITAB -> EXCEL -> Attachment - > Mail - Display should be proper.

I will reward with full points for any positive help.

REPLY ASAP.

Regards

Ramesh

2 REPLIES 2
Read only

Former Member
0 Likes
484

Hello,

DO like this.


  CONSTANTS: CON_CRET TYPE X VALUE '0D',  "OK for non Unicode
             CON_TAB TYPE X VALUE '09'.   "OK for non Unicode
DATA: IT_ATTACHMENT LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
 DATA: WA_ATTACHMENT TYPE SOLISTI1.
loop at itab.
if sy-tabix = 1.
concatenate CON_CRET itab-field1 CON_TAB WA_ATTACHMENT.
else.
concatenate WA_ATTACHMENT itab-field1  SEPARATED BY CON_TAB.
endif.
APPEND WA_ATTACHMENT   TO IT_ATTACHMENT.
endloop.

Hope this solves ur problem,

Vasanth

Read only

Former Member
0 Likes
483

Use the function module SAP_CONVERT_TO_XLS_FORMAT to download the internal table to an excel file.

PARAMETERS: p_file LIKE rlgrap-filename DEFAULT 'c:\tmp\test.xls'.

DATA: t100_Lines TYPE STANDARD TABLE OF t001 WITH DEFAULT KEY.

SELECT * FROM t001 INTO TABLE t100_Lines.

CALL FUNCTION 'SAP_CONVERT_TO_XLS_FORMAT'

EXPORTING

i_filename = p_file

TABLES

i_tab_sap_data = t100_Lines.

Regards,

Aparna