on 09-28-2006 8:41 PM
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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
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
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
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.