Skip to Content
avatar image
Former Member

Record and Play Back using SAP GUI API using VBScript

Hi All,

I am new to SAP but has a good experience in developing vb scripts. Now I got a task to automate SAP transcations using VB Script. This is pruely for testing.

I could able to record scripts and modifiy them to suit for testing with dynamic test data from xml and excel.

I am facing a problem when executing the scripts, some times a new pop up gets displays and my script stop executing. This is because of some checks implemented. Can any one let me know how to capture unexpected message box. Is there any way I constantly monitor popup windows and check the content and by pass or take action.

Here an example,

I am creating a sales order and tested this for three times for all this tests I used only one Sold to Party. When I execute this fourth time I will get popup for dynamic credit check. I want to stop the script if I get this popup.

Thanks in Advance.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    avatar image
    Former Member
    Jun 12, 2008 at 01:38 PM

    I was facing this problem as well a couple of months ago...this disadvantage of SAP scripting is when you want to use error handlers, you need to test many times to get those errors (or in your case the pop ups). Most of the times you will see the message of the popup in the status bar as well, then you could do the following, i.e.:

    if session.findById("wnd[0]/sbar").text= "You are not authorized to use Transaction SO99" then
    msgbox "You are not authorized to use Transaction SO99",vbCritical,"Warning: No authorisation"
    

    I guess you are able to do this with popups as well, but carefully watch your statusbar. If the message is also in the status bar then you can use the code I just provided. Or you should play around with "session.findById("wnd[0]/sbar").text". You should be able to download a manual from the SAP, but I didnt like the manual because it is not that clear at all...

    I hope you understand what I just typed, good luck.

    Add comment
    10|10000 characters needed characters exceeded