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 Output

Former Member
0 Likes
1,097

Hi All,

I need to create a excel output which has header combined for two fields. like

month 1

quantity value

under month1 i need to have two sub headers quantity and value. I'm able to prepare the excel file till the level where each data has header. so now how to add header combined to two columns.

right now i'm using SAP_CONVERT_TO_CSV_FORMAT and then manually inserting the header i.e quantity and value.

and this excel has to be sent as an attachment to external email id which i'm doing it by BCS class.

Please help how to insert the header data combined to two columns.

can the attributes in the class CL_ABAP_CHAR_UTILITIES will be helpful.

I'm using the carraige return and horizontal tab to construct the data from CSV to Excel.

9 REPLIES 9
Read only

Former Member
0 Likes
1,038

You can create excel by using DOI technique by using this method you can manuplate your excel output as you want.

Please go through the below links.

/people/alvaro.tejadagalindo/blog/2009/02/05/excel-ole-and-abap--create-fancy-reports

https://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/204d1bb8-489d-2910-d0b5-cdddb3227820

You can also find topics related to OLE in saptechnical, search by keyword OLE and you will get it.

Hope this will help you.

Read only

0 Likes
1,038

Hi Sheelesh,

OLE and class gui front end services will download the excel to the path you have given, but my program will be run in background and the excel need to be sent as an attachment to the external email id.

So i cannot go ahead with those FM's.

If you have any idea if we can use them for background also, please can you tell how to use them for background.

Thanks,

Bharathi.

Read only

0 Likes
1,038

Hi,

Are you trying to download the excel file to the presentation server using the OLE and class gui front end services and then try to use it as a attachment and send a E-mail in background? If so am afraid its not possible. Ensure you are downloading the file to the application server and then run it in the background.

Regards,

Vik

Read only

0 Likes
1,038

Hi,

I'm not downloading the excel and attaching the file,

I'm preparing the data in excel format in the internal table and using this internal table i'm sending the excel as an attachment to the email in back ground,

The problem is related to header.

Merging the header column for two columns.

like under month i need two sub columns quantity and value.

month 1

quantit value

Read only

0 Likes
1,038

Hi,

Well in that case you may try to have another internal table with the quantity and value columns concatenated into a single column seperated by certain amount of space using offsets and then use this internal table and merge with the header column and check.

Regards,

Vik

Read only

0 Likes
1,038

but vik, in this case we will get the quantity and values under one column,but these should be under two columns but heading for it should be one above....so thinking of how to achieve it....

Read only

0 Likes
1,038

Hi Bharathi,

The cells can be merged using OLE concept. To suit your requirement, the two header cells for quantity and values should be merged such that the quantity and value columns appear seperately.

Check this link for a sample code as to how to merge cells using OLE concept

[]

Regards,

Vik

Read only

rainer_hbenthal
Active Contributor
0 Likes
1,038

The only way to do this is OLE. In background there is no gui and therefore no OLE. Pull your own conclusions now....

Read only

Former Member
0 Likes
1,038

solved...