cancel
Showing results for 
Search instead for 
Did you mean: 

Convertion of SAP data into Excel format (without file)

Former Member
0 Kudos

Hello,

I'm looking for a FM to convert a SAP internal table into Excel format. Instead of an Excel file I need the binary Excel data in a SAP internal table again.

The FM SAP_CONVERT_TO_XLS_FORMAT is not usable because it stores the converted data into a given file.

Has anybody an idea how I can solve my problem?

Thanks in advance, Kay

Accepted Solutions (1)

Accepted Solutions (1)

athavanraja
Active Contributor
0 Kudos

Welcome to SDN.

in the function module you have mentioned the following lines of code makes it to save it to a file.

<b>call method l_iref_document->save_document_to_url</b>

instead copy the FM to your custom name space and modify that portion to call method

<b>call method l_iref_document->SAVE_DOCUMENT_TO_TABLE</b>

Hope this helps.

Regards

Raja

Former Member
0 Kudos

Hello Raja,

your idea looks nice but dosn't solve the problem in all. The usage of the Desktop Office integration (the FM is using this functionality) requires a SAP frontend to use GUI controls.

I need a solution which works in batch mode. The data of an internal table should convert into a binary data stream (Excel format). After the conversion a mail with the binary data as attachement can created through FM SO_NEW_DOCUMENT_ATT_SEND_API1.

Regards

Kay

Former Member
0 Kudos

Kay,

Concatenate the individual fields, separated by the tab character, into a variable. Then write the variable field to the application server.

  • >>Code <<

data: w_output(100) value '/home/ftp400/test_output'.

DATA: wa_string(255).

data: field1(10) value '1111111111',

field2(10) value '2222222222'.

open dataset w_output for output in text mode ENCODING DEFAULT.

*CONSTANTS: w_tab TYPE x VALUE '09'.

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

*need to declare constants as follows:

*class cl_abap_char_utilities definition load.

constants:

w_tab type c value cl_abap_char_utilities=>HORIZONTAL_TAB.

CONCATENATE field1

w_tab

field2

into wa_string.

transfer wa_string to w_output.

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Kay,

Can u be more specific in ur requirement? Do you mean that the data should be stored again in itab but no excel file should be generated?? If so, what is the purpose of doing this. Mebbe we can think of a different workaround if you could tell the exact need for it.

Cheers,

Sam