cancel
Showing results for 
Search instead for 
Did you mean: 

How to convert script output to excel and send through mail in the report

Former Member
0 Kudos

I need a solution for Converting script into EXCEL and sending Excel as a attachment to the mail. In my current Program I am getting OTF data from script and converting into PDF using Function module ' CONVERT_OTF'

And sending PDF as a mail attachment using Function module 'SO_NEW_DOCUMENT_SEND_API1' it is working fine but

My current requirement is I need to send Excel as a mail attachment instead of PDF.

Hope it is clear for you, please give me possible solutions with sample code..

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

HI,

use this fm

SO_NEW_DOCUMENT_ATT_SEND_API1

thanks

vivekanand

Former Member
0 Kudos

hi

good

CONSTANTS: CON_CRET TYPE X VALUE '0D', "OK for non Unicode

CON_TAB TYPE X VALUE '09'. "OK for non Unicode

*If you have Unicode check active in program attributes thnen you will

*need to declare constants as follows

*class cl_abap_char_utilities definition load.

*constants:

  • con_tab type c value cl_abap_char_utilities=>HORIZONTAL_TAB,

  • con_cret type c value cl_abap_char_utilities=>CR_LF.

CONCATENATE 'EBELN' 'EBELP' 'AEDAT' 'MATNR'

INTO IT_ATTACH SEPARATED BY CON_TAB.

CONCATENATE CON_CRET IT_ATTACH INTO IT_ATTACH.

APPEND IT_ATTACH.

LOOP AT IT_EKPO INTO WA_CHAREKPO.

CONCATENATE WA_CHAREKPO-EBELN WA_CHAREKPO-EBELP

WA_CHAREKPO-AEDAT WA_CHAREKPO-MATNR

INTO IT_ATTACH SEPARATED BY CON_TAB. " Check here

CONCATENATE CON_CRET IT_ATTACH INTO IT_ATTACH. " Check here

APPEND IT_ATTACH.

ENDLOOP.

thanks

mrutyun^

Former Member
0 Kudos

Hi,

Thanks for your reply.

The solution given by you is not suiting my requirement. My requirement is like converting the SAPSCRIPT output (which is OTF data) to excel format through report and sending through mail. But OTF is not a grid, like Excel, i am unable to do the conversion. If it is to PDF, i can do it easily. But the requirement is to put the data into excel file. Is there any way we can do it. Please give your possible solutions.

Thans

Former Member
0 Kudos

Hi,

I think in convert_otf , if u give format as a DAT it ll work ...

try this.

reward points if found useful.

Former Member
0 Kudos

check this

Regards

Peram