Skip to Content

Slipstream Engine - Check on button which exist or not

Hello,

I'm building a flavor on ME51N. (creation Purchase requisition)

I don't want the there is the document overview parts in the screen:

So for the first time, it's easy I can build a script to press the "Document overview Off" button.

But After for the second time the document overview is already off and the push button changed:

Before it was: session.findById("wnd[0]/tbar[1]/btn[9]")

and now it's session.findById("wnd[0]/tbar[1]/btn[8]")

So I try to build a check like this:

var menu = session.findById("wnd[0]/shellcont/shell/shellcont[0]/shell"); if (menu) {
session.findById("wnd[0]/tbar[1]/btn[9]").press();
}

But I received a popup message that "Error during script execution. Failed to call method 'press' for 'wnd[0]/tbar[1]/btn[9]' control. Submit batch failed: [-102] control not found."

How Can I make a check that the document overview in ON and I have to press the button.

I try other method to detect the left part of the screen but I get the same kind of error .

Thanks,

Emmanuel.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Jan 16 at 05:18 PM

    Hi Emmanuel,

    Put this code in the onLoad event for ME51N. It will check to see if the "Document Overview Off" button exists on the screen, if so then click the button. If not then it will do nothing.

    Also if you need to, you could hide the button after clicking it, that way the user can't turn it on again.

    Thanks, Brian

    if(session.idExists("wnd[0]/tbar[1]/btn[9]"))  //Document Overview Off button
    {
     session.utils.log('pressing Document Overview Off button');
     session.findById("wnd[0]/tbar[1]/btn[9]").press();
    }
    
    
    Add comment
    10|10000 characters needed characters exceeded

  • Jan 16 at 06:14 PM

    This works for me:

    if (session.idExists("wnd[0]/shellcont/shell/shellcont[0]/shell")) { 
    	session.findById("wnd[0]/tbar[1]/btn[9]").press();
    }
    Add comment
    10|10000 characters needed characters exceeded