cancel
Showing results for 
Search instead for 
Did you mean: 

execute SAP GUI Scipt automatically

Former Member
0 Kudos

Hi all,

Can anybody tell me if it is possible to attach an SAP GUI script to a certain table so that the script starts itself when someone presses Enter from the keyboard for a field of the table. The table may be e.g. the table on the right hand side of the structure editor in eCATT ( tr. SECATT, http://help.sap.com/saphelp_47x200/helpdata/EN/2a/121e3bd711bb04e10000000a114084/frameset.htm )

Kind regards:

Svetlana

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos
Former Member
0 Kudos

Hi Ruturaj,

Thanks a lot for your hints, the links are really goodu2026

Regarding:

http://www.synactive.com/download/sap%20gui%20scripting/sap%20gui%20scripting%20userguide.pdf

p.4-6: So far I understand, there are only 3 ways to start a script and it seems there is no possibility to run it by keyboard event.

p.7-17, p.18-24: concern SAP GUI for Java as well AppleScript.

http://www.synactive.com/docu_e/specials/guiscripting.html

GuiXT is really good and it is possible to write a GuiXT scipt, which if active calls the necessary Visual Basic script:

ApplyGuiScript " E:\VB_Scripts\Win.vbs "

But I need to execute the Visual Basic script periodically, on every Enter key press in the table of interest. This means I have to activate and deactivate GuiXT every time I need the Visual Basic script.

Do you know if there is a possibility to react on events with a GuiXT script?

Kind Regards:

Svetlana

Answers (1)

Answers (1)

script_man
Active Contributor
0 Kudos

Hi Svetlana,

I think that the reference to synactive was correct. So that you do not have to read so much, you can concentrate on:

On "=TAB02" Fcode="=TAB02" process="...."

where "=TAB02" is the internal function code of the tab. You can use "Input Recording" to find out the function code.

Regards,

ScriptMan

Former Member
0 Kudos

Hi ScriptMan,

I am not sure what you really mean. The program which creates the table uses the following:

ok_code = cl_gui_ecatt_const=>tr_script_attributes

And I start my script, from another script which shows a popup window, with the following code:

Set runner = CreateObject("WScript.Shell")
scriptPath = "E:\VB_Scripts\Copy_Parameter.vbs"
runner.Run "cscript.exe " & Chr(34) & scriptPath & Chr(34), 0, vbTrue

Can you give me an example?

Kind Regards:

Svetlana

script_man
Active Contributor
0 Kudos

Hi Svetlana,

I had previously misunderstood something. But the following notice could you help.:

if not V(_tabrow=0)

...

ApplyGuiScript " E:\VB_Scripts\Win.vbs "

...

endif

Alternatively, you can still show the following system variables:

V(_cursorrow), V(_cursorcol) or V(_tabcol) where the round brackets are as square to understand.

Regards,

ScriptMan

Edited by: ScriptMan on Aug 3, 2009 10:06 AM

Former Member
0 Kudos

Hi ScriptMan,

Your suggestion is really very useful.

When I write the following (NE stands for the inequality operator) :

if &V[_tabrow NE 0]

    ApplyGuiScript "E:\VB_Scripts\Win.vbs" 

endif

the script executes partially as expected. Only partially, because the cursor position in the table is different then 0 also in other situations then the case of interest.

But it is possible to turn on and turn off GuiXT, which is a possible solution, although not very u2018niceu2019.

I have tried to reduce the cases in which the if condition is true using the following:

if &V[_tabcol=3 and &V[_tabrow NE 0]]

ApplyGuiScript "E:\VB_Scripts\Win.vbs" 

endif

But the script executes exactly so often as with the previous if condition.

Do you know what can be wrong?

Kind Regards:

Svetlana

script_man
Active Contributor
0 Kudos

Hi Svetlana,

if I'm doing it on my "old-fashioned" way, then it works:


if  V[_tabcol=3] and not V[_tabrow=0]

     ApplyGuiScript "E:\VB_Scripts\Win.vbs" 

endif

Regards,

ScriptMan

Edited by: ScriptMan on Aug 5, 2009 12:34 AM

Former Member
0 Kudos

Hi ScriptMan,

Thanks a lot for the answer. It is maybe a good idea, but I receive an error message using this "old-fashioned" way u2013 u2018Wrong format for logical expressionu2019.

By the way, it is maybe easier to use an image, instead to relay on such combination of courser positions. For example:

Image (toolbar) "E:\Bilder\gelb.jpg" Start="E:\VB_Scripts\Nur_ein_param.vbs"

Kind Regards:

Svetlana

script_man
Active Contributor
0 Kudos

Hi Svetlana,

I'm working with the version 2007 Q2 2 of GuiXT. Probably it is the difference.

The whole time I thought we absolutely want to intercept an click on a table. In this case, there are also other ways to stimulate the process.

For example:


On "Enter" Process="update.txt"

Pushbutton (10,1) "Test" process="update.txt"

Pushbutton (Toolbar) "@3G\QTest@Test" Process="update.txt"

Regards,

ScriptMan

Former Member
0 Kudos

Hi ScriptMan,

Thanks a lot for the answer. Maybe I will write again when I can return back to this topic.

Kind Regards:

Svetlana