cancel
Showing results for 
Search instead for 
Did you mean: 

Automation Server can't create Object

Former Member
0 Kudos

Hi,

I have a requirement to download data into Excel through Java Script (its related to embedding ActiveX contorls into our BSP Application).i have written some part of code which is executing correctly when i run as .html page separatly.

example function:

<html>

<head>

<script language="javascript">

function exceldown()

{

var Excel, Book, sheet;

oExcel = new ActiveXObject("Excel.Application");

oExcel.Visible = true;

oBook = oExcel.Workbooks.Add();

}

</script>

</head>

<body onload="exceldown();">

</body>

</html>

place this code in notepad and save it as .html extension. (call the above function in body onLoad event and execute).

hope its opening Excel file....

But when i execute the same piece of code through BSP application as one of the page its giving the java error like "Automation Server can't create Object".

what could be the problem..?

Leo

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Leo,

All the code executed by the BSP should be in SAP. We cannot execute the java code placed in the notepad through BSP. Instead add this code in the pagewithflogic to make it work.

regards,

manasa

Former Member
0 Kudos

Hi manasa,

javascript function is in my bsp page only.

i am saying that, if i run this function from notepad its working fine.

but when i excute through bsp application its giving the automation error. thats my problem

Thanks.

leo

Former Member
0 Kudos

oh...sorry that i misunderstood your explanation.

anyways, i added you sample code in a test page in my bsp and didnot give me any error. Just curious, where did you place this code in the BSP? pageeswithflowlogic or pagefragments or somewhere else?

also we can add javascript only in the "LAYOUT" section.

regards,

manasa

Former Member
0 Kudos

hi manasa,

here is my code (pagewithflowlogic)

<%@page language="abap"%>

<html>

<head>

<script type="text/javascript" language="JavaScript">

<!--

function exceldown()

{

var inobj = document.getElementById('cellrange');

var Excel, Book, sheet;

Excel = new ActiveXObject("Excel.Application");

Excel.Visible = true;

Book = Excel.Workbooks.Add()

var sheet = Book.ActiveSheet;

sheet.Name = "Purchase Orders";

Book.Worksheets("Sheet2").Delete;

Book.Worksheets("Sheet3").Delete;

sheet.Cells(1,1).Value = "Purchase Order Data";

sheet.Cells(3,1).Value = "Order#";

sheet.Cells(3,2).Value = "Item#";

sheet.Cells(3,3).Value = "Supplier#";

sheet.Cells(3,4).Value = "Material";

sheet.Cells(3,5).Value = "Quntity#";

sheet.Cells(4,1).Value = "ORD100";

sheet.Cells(4,2).Value = "10";

sheet.Cells(4,3).Value = "SUP222";

sheet.Cells(4,4).Value = "MAT1234";

sheet.Cells(4,5).Value = "33";

}

//-->

</script>

</head>

<body onload="exceldown();">

</body>

</html>

when i excute this from my BSP i am getting the error which i explained in my previous post.

from out side (that is plain .htm page) its opening Excel correctly..

does Excel opend from your BSP Application..?

Thanks,

Leo

Former Member
0 Kudos

i am getting the same error as you get.

Message was edited by: manasa

Former Member
0 Kudos

manasa,

in which browser your executing, I Recommend IE.

forget all,

1. take one bsp application with single pagewith flow

logic

2. copy the below code in layout section

<html>

<head>

<script language="JavaScript">

<!--

function exceldown()

{

var Excel, Book, sheet;

oExcel = new ActiveXObject("Excel.Application");

oExcel.Visible = true;

oBook = oExcel.Workbooks.Add();

}

//-->

</script>

</head>

<body onload="exceldown();">

</body>

</html>

3. Activate and execute.

4. now, does empty Excel sheet opend from your

application...?

If so, let me know

Thanks,

Leo

Former Member
0 Kudos

NO, i am getting the same error as you get in IE

Former Member
0 Kudos

leo,

I tried to do some reserach on your issue and i have a partial solution for you. below is the code that opens up an excel sheet in your bsp.

<OBJECT id=Layout_1

style="WIDTH: 880px; HEIGHT: 500px"

classid=CLSID:0002E510-0000-0000-C000-000000000046 name=Layout_1 VIEWASTEXT>

<PARAM NAME="DisplayTitleBar" VALUE="true">

<PARAM NAME="HTMLData" VALUE=" ">

</OBJECT>

also look at

/people/thomas.jung3/blog/2005/07/18/bsp-extension-for-downloading-a-table-applying-an-iterator

hope it helps,

manasa

Message was edited by: manasa

athavanraja
Active Contributor
0 Kudos

in your IE go to

tools->internet options->secutiry->

click on local intratnet and click cusomt level and make sure that for running activex option is marked as prompt or enable.

Regards

Raja