cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

SAPScript Fails in MC8K

jeff_dillon
Explorer
0 Likes
425

All:

I have a SAPScript that generates a Message Type X error when it runs.  I can run the same steps outside a script and everything is fine, but when a script executes them, it fails.

The script is opening a DP forecasting log for a given day when there are multiple runs that day.  It chooses the job with the latest start time.

I have copied the script below.  Please excuse any typos.

Jeff

>session.findById("wnd[0]/tbar[0]/okcd").text = "/n/SAPAPO/MC8K"

>session.findById("wnd[0]").sendVKey 0

>session.findById("wnd[0]/usr/ctxtJOB1").text = strFileName

>session.findById("wnd[0]/usr/ctxtDAY1").text = strDate

>session.findById("wnd[0]/usr/ctxtDAY1").setFocus

>session.findById("wnd[0]/usr/ctxtDAY1").caretPosition = 9

>session.findById("wnd[0]/tbar[1]/btn[8]").press

>session.findById("wnd[1]/usr/lbl[12,1]").setFocus

>session.findById("wnd[1]/usr/lbl[12,1]").caretPosition = 4

>session.findById("wnd[1]").sendVKey 2

>session.findById("wnd[1]").sendVKey 33

>session.findById("wnd[1]/usr/lbl[1,3]").setFocus

>session.findById("wnd[1]/usr/lbl[1,3]").caretPosition = 6

>session.findById("wnd[1]").sendVKey 2

Accepted Solutions (0)

Answers (1)

Answers (1)

script_man
Active Contributor
0 Likes

Hi Jeff,

what is the line number of the command which caused the error?

Regards,

ScriptMan

jeff_dillon
Explorer
0 Likes

Thanks for your reply.

The short dump occurs on the last line of the script above.  According to ST22, the error is in program CL_GUI_CFW====================CP.

Jeff

script_man
Active Contributor
0 Likes

Hi Jeff,

unfortunately I did not have access to the transaction /SAPAPO/MC8K. But you could try the following:


session.findById("wnd[0]/tbar[0]/okcd").text = "/n/SAPAPO/MC8K"

session.findById("wnd[0]").sendVKey 0

session.findById("wnd[0]/usr/ctxtJOB1").text = strFileName

session.findById("wnd[0]/usr/ctxtDAY1").text = strDate

'session.findById("wnd[0]/usr/ctxtDAY1").setFocus

'session.findById("wnd[0]/usr/ctxtDAY1").caretPosition = 9

session.findById("wnd[0]/tbar[1]/btn[8]").press

session.findById("wnd[1]/usr/lbl[12,1]").setFocus

session.findById("wnd[1]/usr/lbl[12,1]").caretPosition = 1

session.findById("wnd[1]").sendVKey 2

wscript.sleep 500

session.findById("wnd[1]").sendVKey 33

session.findById("wnd[1]/usr/lbl[1,3]").setFocus

session.findById("wnd[1]/usr/lbl[1,3]").caretPosition = 1

wscript.sleep 500

session.findById("wnd[1]").sendVKey 2

Regards,

ScriptMan

jeff_dillon
Explorer
0 Likes

ScriptMan,

Thanks for the info.  I made the changes, but unfortunately I am still getting the same core dump when I run.

One thing I notice -- I get a slightly different popup (more text-like with less graphics) running from a script than running manually.

Jeff

script_man
Active Contributor
0 Likes

Hi Jeff,

they have no other choice then to incorporate after each command a msgbox. They you can watch, in which command the script actually gets out.

for example

. . .

session.findbyid(...

msgbox "Wait for Enter"
. . .

Regards,

ScriptMan