Application Development 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: 

Creating Excel Using OLE through ABAP

Former Member
0 Kudos

Hi Experts,

Can anyone help me in running an abap program to give an Excel file using OLE..

Regards,

Seshadri

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi ashu,

thank u 4 ur fm.

Its ok,can u provide me the coding...

7 REPLIES 7

Former Member
0 Kudos

Hi,

All the fields which are to be passed to this FM <b>MS_EXCEL_OLE_STANDARD_DAT</b> are to be CHAR type

so the data will be downloaded as 25 only you can't get 25.00 using this fun module.

<b>

Reward points if useful</b>

Regards

Ashu

Former Member
0 Kudos

Hi Seshadri,

You can try using the function module "SAP_GUI_PROGRESS_INDICATOR".

You may cre3ate objects for the worksheets and then callthis function modules...

Regards,

Dhayanandh.S

Former Member
0 Kudos

Hi ashu,

thank u 4 ur fm.

Its ok,can u provide me the coding...

0 Kudos

Hi Dhayanandh,

Can u provide the code.

I like ur function module and ur explanation,but if i could get the code then it will be helpful..

0 Kudos

Hi Seshadri,

Here is ur expected coding...

REPORT ZCREATEEXCEL.

TYPE-POOLS OLE2.

DATA: EXCEL TYPE OLE2_OBJECT,

WORKBOOKS TYPE OLE2_OBJECT,

WORKBOOK TYPE OLE2_OBJECT.

DATA: FILENAME LIKE RLGRAP-FILENAME.

  • START THE EXCEL APPLICATION

CREATE OBJECT EXCEL 'EXCEL.APPLICATION'.

PERFORM ERR_HDL.

  • PUT EXCEL IN FRONT

SET PROPERTY OF EXCEL 'VISIBLE' = 1.

PERFORM ERR_HDL.

  • INFORM USER OF THE CURRENT STATUS

CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'

EXPORTING

PERCENTAGE = 0

TEXT = TEXT-I08

EXCEPTIONS

OTHERS = 1.

  • CREATE AN EXCEL WORKBOOK OBJECT

CALL METHOD OF EXCEL 'WORKBOOKS' = WORKBOOKS.

PERFORM ERR_HDL.

CALL METHOD OF WORKBOOKS 'ADD' = WORKBOOK.

PERFORM ERR_HDL.

  • EXCEL FILENAME

CONCATENATE SY-REPID '_' SY-DATUM6(2) '_' SY-DATUM4(2) '_'

SY-DATUM(4) '_' SY-UZEIT '.XLS' INTO FILENAME.

CALL METHOD OF WORKBOOK 'SAVEAS' EXPORTING #1 = FILENAME.

FORM ERR_HDL.

IF SY-SUBRC <> 0.

WRITE: / 'OLE ERROR: RETURN CODE ='(I10), SY-SUBRC.

STOP.

ENDIF.

ENDFORM.

hope it helps..

0 Kudos

Hi,

can anyone please provide some info that how to link 2D,3D,4D Graphics in this code..

0 Kudos

Hi seshadri,

you can use the submit button and use the CPROG=> REKH0004 you can utilise the graphics in this..

hope it helps...