Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

SAP script error checking

_Paul
Discoverer
0 Kudos
766

Hi,

When a command is send to SAP like "SAPsession.FindById("wnd[0]").resizeWorkingPane(170, 25, False)" and an error occurs I'd like to log the error and let the script continue after user input (if needed) to fix the error. Next I want to use the Log to examine the errors and fix them.

I was thinking to do this via an additional sub that handles the sap command and catches the error like this:

****************************************************************

Private sub resize() 'SAPCommand to be executed

SAPCommand(SAPsession.FindById("wnd[0]").resizeWorkingPane(170, 25, False))
SAPCommand(SAPsession.FindById("wnd[0]/tbar[0]/okcd").text = "/nsu3")
SAPCommand(SAPsession.FindById("wnd[0]").sendVKey(0))

End Sub

 

Private sub SAPCommand(input)         '//SAPCommand to be executed

try
    Run SAPCommand
Catch ex as Exception
    Log("Error for: " & input & vbCRLF & ex.tostring)
    msgbox("Fix the error for command: " & input)
end try

end sub

****************************************************************

I know the above code does not workout at all but it's just for illustration of what I'd like to accomplish.

Thanks!

 

2 REPLIES 2

juliborzsei
Associate
Associate
0 Kudos
712

Hi Paul!

I think your question doesn't relate to SAP Emarsys Scripting Language (ESL). ESL is used for creating dynamic personalized content in marketing campaigns in Emarsys. Please double check the Tags and assign the relevant one so that an other subject matter expert can help you with an answer. 

Thank you!

0 Kudos
697

Thanks, I'll have a look!