Executing SAP GUI Script From a Web Page
I have an issue when trying to execute some javascript (sap gui script) from a webpage.
When the javascript is executed I get the message:
automation server unable to create object.
However, this exact same javascript when placed in a text file and double-clicked executes just fine through the windows scripting host.
Does anyone have an example of gui script code executing from a webpage? Or any ideas on why it isn't working from the webpage? Both scenarios should be executing the code on the local machine through WSH.
Below is the javascript as well as the webpage executing the javascript:
SAPGUI SCRIPT
if (typeof(application) == "undefined")
sapgui = GetObject("SAPGUI");
application = sapgui.GetScriptingEngine;
if (typeof(connection) == "undefined")
connection = application.children(0);
if (typeof(session) == "undefined")
session = connection.children(0);
if (typeof(WScript) != "undefined")
WScript.connectObject(session, "on");
WScript.connectObject(application, "on");
session.findById("wnd[0]").maximize();
session.findById("wnd[0]/tbar[0]/okcd").text = "/nzsd1067";
session.findById("wnd[0]").sendVKey(0);
session.findById("wnd[0]/usr/ctxtVBAK-KUNNR").text = "6343";
session.findById("wnd[0]").sendVKey(0);
WEBPAGE
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title></title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
<! INPUT PARAMETER SETTINGS:
To Push data to Siebel or SAP the appropriate
field below must be set = TRUE.
Pop_SAP
Pop_Siebel
SIEBEL INPUT PARAMETER: When
Pushing data to a Siebel screen the Query_Type should be set based on the type
of lookup that is requested.
Query_Type = 'SAP' -presents a screen based on a customer SAP Id.
Query_Type = 'SR' -presents a screen based on a Service Request.
Query_Type = '' or null -presents a search screen to locate the proper contact in Siebel
APP_SAP_ID -SAP customer Id
APP_SR_NUM -Siebel Service Request Number
>
<SCRIPT LANGUAGE="VBScript">
Sub LoadContact()
'Siebel Application Object
Dim siebApp 'As SIEBELHTMLLib.ISiebelHTMLApplication
Dim siebSvcs 'As SIEBELHTMLLib.ISiebelService
Dim siebOutputPropSet 'As SIEBELHTMLLib.ISiebelPropertySet
Dim siebInputPropSet 'As SIEBELHTMLLib.ISiebelPropertySet
Dim bool 'As Boolean
Dim errCode 'As Integer
Dim errText 'As String
Dim QueryType 'As String
Dim PopSAP 'As String
PopSiebel = "TRUE"
If PopSiebel = "TRUE" Then
QueryType = "SAP"
If QueryType = "null" Then
QueryType = ""
End If
'Create The SiebelHTML Object
set siebApp = CreateObject("SiebelHTML.SiebelHTMLApplication.1")
If Not siebApp Is Nothing Then
'Create A New Property Set
set siebInputPropSet = siebApp.NewPropertySet
set siebOutputPropSet = siebApp.NewPropertySet
If Not siebInputPropSet Is Nothing Then
siebInputPropSet.SetProperty "ANI", "9738986011"
siebInputPropSet.SetProperty "SAP_ID", "0000516616"
siebInputPropSet.SetProperty "SR_NUM", "null"
siebInputPropSet.SetProperty "Interaction_ID", "168608840053"
siebInputPropSet.SetProperty "Query_Type", QueryType
Else
errCode = siebApp.GetLastErrCode
errText = siebApp.GetLastErrText
MsgBox "Could not Create Siebel Property Set: " & errCode & "::" & errText
End If
'Get A Siebel Service
set siebSvcs = siebApp.GetService ("TAWBS")
If Not siebSvcs Is Nothing Then
siebSvcs.InvokeMethod "TAWPresentAccount", siebInputPropSet, siebOutputPropSet
Else
errCode = siebApp.GetLastErrCode
errText = siebApp.GetLastErrText
MsgBox "Could not Get Siebel Service: " & errCode & "::" & errText
End If
set siebApp = Nothing
End If
set siebInputPropSet = Nothing
set siebOutputPropSet = Nothing
set siebSvcs = Nothing
End If
End Sub
</SCRIPT>
<SCRIPT LANGUAGE="javascript">
function loadSAP()
if (typeof(application) == "undefined")
sapgui = GetObject("SAPGUI");
application = sapgui.GetScriptingEngine;
if (typeof(connection) == "undefined")
connection = application.children(0);
if (typeof(session) == "undefined")
session = connection.children(0);
if (typeof(WScript) != "undefined")
WScript.connectObject(session, "on");
WScript.connectObject(application, "on");
session.findById("wnd[0]").maximize();
session.findById("wnd[0]/tbar[0]/okcd").text = "/nzsd1067";
session.findById("wnd[0]").sendVKey(0);
session.findById("wnd[0]/usr/ctxtVBAK-KUNNR").text = "0000516616";
session.findById("wnd[0]").sendVKey(0);
} // end
</SCRIPT>
</head>
<body onload="loadSAP()">
<H3><FONT face="Arial" size="5">Raytheon Integration Screen</FONT></H3>
<HR style="WIDTH: 882px; HEIGHT: 8px" color="#3366cc" SIZE="8">
<form id="ValidForm" onsubmit="LoadContact(); return false;" language="jscript">
<FONT face="Arial">Load Siebel Screen</FONT> <! <input name="Text1" TYPE="TEXT"
SIZE="10" ID="Text1"> <input name="Submit" TYPE="submit" VALUE="Submit" ID="Submit1">
</form>
<form id="Form1" onsubmit="loadSAP(); return false;" language="javascript">
<FONT face="Arial">Load SAP Screen</FONT> <! <input
name="Text2" TYPE="TEXT" SIZE="10" ID="Text2"> <input name="Submit" TYPE="submit" VALUE="Submit" ID="Submit2">
</form>
</body>
</html>
Hi Bernd,
the following code works in VBS. If you run saplogon.exe you'll get a message box saying '/app'.
Set Wrp = CreateObject ("SapROTWr.SapROTWrapper")
Set SapGui = Wrp.GetROTEntry ("SAPGUI")
Set application = sapgui.GetScriptingEngine
MsgBox application.id
I haven't tried it on a web page, but I don't see why it shouldn't work there. Ok, maybe the MsgBox is command is not available.
Best regards,
Christian
Similar Messages
-
Executing a shell script from a jsp page
Hi,
I'm facing a problem while executing a shell script from a jsp page.
I'm using Runtime.exec() function.
It's working fine for single statement scripts.But if the script consists of any database processing and some other processing statements,it's not returning the correct exit status of the process.
Will u please help me in this.
If there is any other ways to execute a shell script from a jsp page other than Runtime.exec() like RMI etc,.If so let me know.
Thanks in advance.Hello,
It's hard to help you but what you can do is listening to the outputs of your script, you should read the output stream and error stream and send them to the default console.
Check this excellent article : http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html?page=4
Best regards,
Olivier. -
Executing a shell script from a web deployed form
Hi there,
i've got a web deployed form from which i want to execute a UNIX shell script upon clicking a button.. I've used the host command ,and the rsh utility in Windows NT but i'm getting an error message saying
"machine address" Permission denied, rsh can't establish connection " this is the code in the when button pressed trigger
HOST('c:\windows\system32\rsh <<machine address>> opt/apps/wmc/rw.ksh');
the machine address being the unix machine i'm trying to connect to and the last part being the path and the shell script to be executed..
can anybody help me out here ????
Regards
wole
nullJim,
Yes. Use the host command from forms and call the command rexec.
Raymond
null -
SAP GUI call from Web Dynpro Abap
Hi all,
I heard about the possibility to call the SAP GUI directly from my Web Dynpro Abap Application, so that the GUI is integrated in my web browser. But i could not find any information about that.
Maybe you can help me.
Thanks,
JohannesHi Johannes,
Its not possible to directly call your R/3 GUI from your WDA. You can try the "Screen Design Time Conversion" tool in SAP. You can go through this [link|http://help.sap.com/saphelp_nw70ehp1/helpdata/en/30/f2156a26fb4b4d86c5b0ce9f86bfb3/frameset.htm] for further details regarding it.
But please also pay heed to Thomas's advise in [here|Is there a converter for classic dynpros?;.
Regards,
Uday -
Executing a shell script from a java program
Hi,
I'm facing a problem while executing a shell script from a jsp page.
I'm using exec() function.
It's working fine for single statement scripts.But if the script consists of any database processing and some other processing statements,it's not returning the correct exit status of the process.
Will u please help me in this.
If there is any other ways to execute a shell script from a jsp page other than Runtime.exec().If so let me know.
Thanks in advance.I think this shud workMaybe - but it is wrong! Why do you create aReader
and then read bytes which are turned into a String
without worrying about whether or not the bytes area
String and without worrying about the character
encoding if the bytes do represent characters and
without worrying about how many bytes wereactually
read.
Also, both you and the OP should read, digest and
follow the advice given in
http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-
traps.htmlI dont care if it is wrong. This code works for me.
We are here to solve problems not to find which post
is wrong.It is wrong! You are posting bad advice that is very wrong! It may work for you but it is wrong in general! WRONG WRONG WRONG.
If you have a solution then post it I did post a solution! The reference I gave will explain to you and the OP exactly how it should be done.
rather then
posting rude comments.I was not rude! I was explaining just some of what was wrong! -
Execution of Perl Script from HTML DB page.
Hi All,
I have a Perl script which takes 5 parameters and fetches data from one database and insert that data into my database table which is a master table for my project.
Is there any way to execute the perl script from a HTMLDB page by passing parameters.
Pls. provide me inputs if any.
Thanks & Regds.
Kumaraswamy RJ.Check out MOS note 1515609.1.
Regards,
- Loc -
kindly suggest me the php parsing script so that i can fetch the data from a web page.....
suppose we have a url.........
http://abc.com/news/companydetails.aspx?sskicode=x&Exchange=y
and the page contains the various fields.........like
xyz 10
xyz1 20
xyz2 30 etc...
then we have to retrive data from this page trough php script and insert it into database.....
value of xyz , xyz1 n xyz2 should be retrived and further inserted into database.......
thanx ......Should be nice..
But its not working i think.. -
Call SAP GUI actions from Web UI
We have upgraded our CRM system from 4.0 to 7.0. In CRM 4.0 we have some complex actions used in service order. We would really like to be able to reuse those SAP GUI actions from Web UI service order since it would require a lot of work to rewrite them in BSP.. Is it possible to call a SAP GUI action from Web UI? How do we do this?
Regards Andreas
Edited by: Andreas on Jan 17, 2011 1:58 PMThat was very helpful information. I can now see the available actions. The problem now is that one of the SAP GUI actions is using dialog program technique, like CALL SCREEN 9001... Is there a way to handle this also from Web UI or is it impossible?
Thanks and regards
Andreas -
Hi All, -
Can somebody tell me, how can I use a variable instead of hardcoded value into a SAP GUI script?
Because the recorded file is a vbs-file, I have tried to declare a variable as usual:
Dim Count As Integer
Count = 58
But when I try to execute the updated script, even without assigning the Count variable to any places from the script, an error occurs u2013 u2018expected end of statementu2019 (the same error also occurs if I use Count instead of 58). Actually I want to replace all occurrences of number 58 in the script below. Can anybody help me?
Thanks,
Svetlana
If Not IsObject(application) Then
Set SapGuiAuto = GetObject("SAPGUI")
Set application = SapGuiAuto.GetScriptingEngine
End If
If Not IsObject(connection) Then
Set connection = application.Children(0)
End If
If Not IsObject(session) Then
Set session = connection.Children(0)
End If
If IsObject(WScript) Then
WScript.ConnectObject session, "on"
WScript.ConnectObject application, "on"
End If
session.findById("wnd[0]").maximize
session.findById("wnd[0]/usr/tabsTS_SCRIPT_EDITOR_0202/tabpECSC_ED/ssubTR_SCRIPT_REF1:SAPLECATT_MAIN:0402/cntlCC_ECSC_EDITOR/shellcont/shell/shellcont[1]/shell/shellcont[1]/shell/shellcont[1]/shell/shellcont[1]/shell").contextMenu
session.findById("wnd[0]/usr/tabsTS_SCRIPT_EDITOR_0202/tabpECSC_ED/ssubTR_SCRIPT_REF1:SAPLECATT_MAIN:0402/cntlCC_ECSC_EDITOR/shellcont/shell/shellcont[1]/shell/shellcont[1]/shell/shellcont[1]/shell/shellcont[1]/shell").currentCellColumn = "DATA"
session.findById("wnd[0]/usr/tabsTS_SCRIPT_EDITOR_0202/tabpECSC_ED/ssubTR_SCRIPT_REF1:SAPLECATT_MAIN:0402/cntlCC_ECSC_EDITOR/shellcont/shell/shellcont[1]/shell/shellcont[1]/shell/shellcont[1]/shell/shellcont[1]/shell").contextMenu
session.findById("wnd[0]/usr/tabsTS_SCRIPT_EDITOR_0202/tabpECSC_ED/ssubTR_SCRIPT_REF1:SAPLECATT_MAIN:0402/cntlCC_ECSC_EDITOR/shellcont/shell/shellcont[1]/shell/shellcont[1]/shell/shellcont[1]/shell/shellcont[1]/shell").modifyCell 0,"DATA","M_FORMOFADDR"
session.findById("wnd[0]/usr/tabsTS_SCRIPT_EDITOR_0202/tabpECSC_ED/ssubTR_SCRIPT_REF1:SAPLECATT_MAIN:0402/cntlCC_ECSC_EDITOR/shellcont/shell/shellcont[0]/shell").insertRows "58"
session.findById("wnd[0]/usr/tabsTS_SCRIPT_EDITOR_0202/tabpECSC_ED/ssubTR_SCRIPT_REF1:SAPLECATT_MAIN:0402/cntlCC_ECSC_EDITOR/shellcont/shell/shellcont[0]/shell").modifyCell 58,"PNAME","M_FORMOFADDR"
session.findById("wnd[0]/usr/tabsTS_SCRIPT_EDITOR_0202/tabpECSC_ED/ssubTR_SCRIPT_REF1:SAPLECATT_MAIN:0402/cntlCC_ECSC_EDITOR/shellcont/shell/shellcont[0]/shell").modifyCell 58,"PTYP","I"
session.findById("wnd[0]/usr/tabsTS_SCRIPT_EDITOR_0202/tabpECSC_ED/ssubTR_SCRIPT_REF1:SAPLECATT_MAIN:0402/cntlCC_ECSC_EDITOR/shellcont/shell/shellcont[0]/shell").setCurrentCell 58,"PTYP"
session.findById("wnd[0]/usr/tabsTS_SCRIPT_EDITOR_0202/tabpECSC_ED/ssubTR_SCRIPT_REF1:SAPLECATT_MAIN:0402/cntlCC_ECSC_EDITOR/shellcont/shell/shellcont[0]/shell").firstVisibleRow = 53
session.findById("wnd[0]/usr/tabsTS_SCRIPT_EDITOR_0202/tabpECSC_ED/ssubTR_SCRIPT_REF1:SAPLECATT_MAIN:0402/cntlCC_ECSC_EDITOR/shellcont/shell/shellcont[0]/shell").pressEnter
Edited by: Svetlana Balinova on Jul 21, 2009 3:12 PM
Edited by: Svetlana Balinova on Jul 21, 2009 3:13 PMHi Svetlana,
if I have understood correctly, could it be that the following link you could use a bit:
Referencing a variable in 'session findbyId' command (SAP GUI Scripting)
Regards,
ScriptMan -
In ESS we are getting SAP GUI screens instead of web screens??
Hi,
How the problem has come up---
We have transferred the production data and OS into test server and changed the test server IP address to production IP address after shutting down the production server.
Which means that now ITS/ESS will be pointing to the new copied server. After this when this new server was shutdown and old production was started the ESS/ITS points back to the original production server.
Now the problem is that When we execute any transaction from ESS we are getting SAP GUI screen instead of Web screen.
Can somebody tell me why this is happening.
Any pointers to this will be highly appreciated.
Thanks and Regards,
VarunFirst off...what version are you on (backend)? Also, how did you "switch" your ITS instance?A little more info and we will solve this for ya. =)
-
Difference between SAP GUI scripting and eCATT
HI,
What is difference between SAP GUI Script and eCATT.
I know that SAP GUI Script can be used for transaction that have activex controls but can we use these script in eCATT also.
If yes, how?
Thanks,
PriyaHi Priya,
SAPGUI script will only work from an external program, may be VB or vbScript. ECATT can only execute a fixed set of commands e.g. (TCD, SAPGUI etc) or a block of ABAP code. ECATT can both work in foreground and background mode.
In foreground mode you would be able to see the script running on your frontend whereas background mode will create a job in the SAP system.
You can convert your SAPGUI scripts to SAPGUI commands and execute. If you strictly want to execute SAPGUI script from ECATT then you would have to save the script somewhere on your desktop computer and call it from an ABAP block in ECATT.
Bikash -
How can I use Automator or AppleScript to get text from a web page and paste it in execl?
I don't know how to make scripts or complexed automator workflows... that's why I'm asking.
I'm trying to make a simple app or script to ask me what text to extract from a web page, like name, address and phone number of a web page and paste each one of these data in the righ cell of excel.
I was thinking to promt a request from automator or an applescript to ask me which text to extract from the page or to look throught the HTML of the page to search for specific html tags, from which extracting text and then importing it, or paste it to the specified execl cell. Name in the name cell, address in the address cell and so on.
Can somebody help me to make this script?
If you know an alternative, like a software that already do this or another language to use, please tell.Try holding down the alt key as you mark the text to be copied. You can then copy columns to table text.
-
Printing a selection from a web page, word document etc.
It embarrasses me to say, I cannot find a way to print a selection--a paragraph for example--from a web page or a Word document. In Windows it's done with a few mouse clicks: file/print/selection. I'm sure there must be a simple way to do it in Leopard, but what is it?
While there is no "print selection" command, you can use one of the globally available services to open a new window in textedit containing your selection, then print it.
Select something and then go to Safari>Services>TextEdit>New Window Containing Selection
and a new textedit window will open with your selection pasted in. Now you can print it.
I suppose if you do this a lot, you could write a short applescript that'll do this, print it, and quit textedit, and then stick the script in the script menu. Just a thought. -
Error in executing eCATT GUI Script
Hi
I am getting following error (in bold) while executing eCATT GUI Script. This happens only for GUI Scripts and not for TCD scripts. Please help me to solve this issue.
<b>0000000195 Test Scrpt ZGUI_SCRIPT4 Version 1 - SECATT [Without Interruption]
R01 800 SANDEEPK1 E 620 sapnw10 Windows NT MSSQL 26.05.2006 12:42:29
ZGUI_SCRIPT4 [0,109 sec] Version 1 ZGUI_SCRIPT4
Tgt System TEST_ECAT->ECATT_SAPNW10_800_E->T90CLNT090 (R01 800 ALEREMOTE E 620 sapnw10
Windows NT MSSQL)
Error in eCATT function SAPGUI
Destination ECATT_SAPNW10_800_E RFC error
service 'sapgw-1' unknown / CPI-C error CM_PRODUCT_SPECIFIC_ERROR.</b>
Thanks in Advance.
Regards,
Sandeep K.Hi Sandeep,
My self , Sreedhar D, working eCATT using SAPGUI recording.
i think ur problem is resolved. Can u help for the below issue.
Scenario:
And i working on testing server which does not have any trasaction, i have to record the transaction using RFC connection to different machine.
I did all the that process and able to connect remote machine.
i started doing the recoding in SAPGUI after creation of sys. Data container by specifying RFC connection.
I recorded the script, but when i try to execute the same this attached error r coming.
But i recorded the same using TCD(Recorded) using remote connection and able to sucessfully execute.
One more thing also, we used write the script for reading the test data from Excel and pass as parameters using TCD(Recording).
Below is the error
Target sys ECATT_SAPTD120_400_E_0002
Destination ECATT_SAPTD120_400_E_0002 RFC Error
Waiting for ur response. Thanks in Adavance.
Sreedhar d -
SAP GUI Scripting Wizzard Windows7 does not work
Dear Experts,
I am quite a novice when it comes to SAP GUI scripting (let alone any other development), therefore my question might be rather stupid. After my PC was migrated from XP to Windows 7 it is no longer possible to use the SAP GUI scripting wizzard. When you select it from the menue, simply nothing happens.
Does anyone have an idea what I need to do to have this useful tool back on my PC?
We are running SAP GUi 7.1
Thanks for your help
TheoHere is SAP GUI wizard replacement tool...its in auto IT - enjoy
http://www.autoitscript.com/forum/topic/149540-sapwizardudf/
I had the tech guys here install , the latest GUI patch level 15,
and the script development tools not working issue has been fixed
They (SAP?) removed the 'script development tools' menu option!?
I have not installed the MS hotfix, but
My question is, it true the 'Script development tools' is gone?
Other methods
a) This (free) non SAP solution seems to work however...any other ideas?
Scripting Tracker Lite
http://scn.sap.com/docs/DOC-32728
b) The Activate GuiXT tool in SAP GUI also does give you some clues in the element window
and could be an alternative way , to get control names.
eg a radio button is R[P_CONTROL_ID] when it should be radP_CONTROL_ID
c) The SAP script recording and playback , to a vbs script will give you the control names also, if you edit the script.
You must of course have GUI scripting on in rz11
I can't read this note https://service.sap.com/sap/support/notes/1633639 - need a password!
Maybe you are looking for
-
How do I delete a song on my phone that has been downloaded from iCloud?
I listened to a few songs on my phone that were showing up from iCloud. However, it seems now that these songs have been downloaded into my library, though some of them I do not want there because they will play when I have my phone on shuffle. I hav
-
FI Forex gain loss & Exchange Rate difference on Foreign Currency & Chart of Accounts
Dear All, I have queries on following : 1) what is difference b/w Forex gain loss account & Exchange Rate difference on Foreign Currency account . 2) Under which Heads in Balance sheet they should come as per Indian Accounting Standards.
-
Copy and delete using FM - HR_INFOTYPE_OPERATION..
Hi All, I would like to copy the record and delete the record using the FM - HR_INFOTYPE_OPERATION.. Scenario : For Example IT 0010 Existing Record BEGDA ENDDA 01.01.2005 30.09.2007 I would like to copy the records with new b
-
Lost Entire Days Work on Flash Project
I'm getting familiar with Flash CS3 and now I'm wondering: Is it the more complex, the more intricacy that is put into a Flash project, the more dangerous it becomes if you go off in a wrong direction and need to go back to the most recently saved ve
-
What exactly does "Copy items to the iPhoto library" do?
Ok, so I recently switched to a Mac and will never go back. Now, I want to understand how iPhoto works and can't figure out what "Copy items to the iPhoto library" does. I imported one pic each way (checked and unchecked), and whether or not I have t