Page 1 of 1

SAP GUI Scripting API - Maintain Selection Options

Posted: Fri Aug 23, 2013 7:47 am
by leppy
I have been using this for some time to automate SAP but have come across something that I thought there might be a simpler method to do.

I have created a script to run SE16 for table MAPL and then export the data to a file. The only thing I haven't figured out is an easy method to set the Selection Option (Not Equal, Less Than, Etc)

Code: Select all

Func _NotEqual($textfield, $btnname, $value)
	$sess.ActiveWindow().FindByID($textfield).Text = $value
	$sess.ActiveWindow().findById($btnname).press
	$sess.ActiveWindow().findById("usr/tabsTAB_STRIP/tabpSIVA/ssubSCREEN_HEADER:SAPLALDB:3010/tblSAPLALDBSINGLE/btnRSCSEL-SOP_I[0,0]").press
	$sess.ActiveWindow().findById("usr/cntlOPTION_CONTAINER/shellcont/shell").currentCellRow = 5
	$sess.ActiveWindow().findById("usr/cntlOPTION_CONTAINER/shellcont/shell").selectedRows = "5"
	$sess.ActiveWindow().findById("usr/cntlOPTION_CONTAINER/shellcont/shell").doubleClickCurrentCell
	$sess.ActiveWindow().findById("tbar[0]/btn[8]").Press()
EndFunc

Func _ExtractMAPL()
	$sess.SendCommand("/nSE16")
	$sess.ActiveWindow().FindByID("usr/ctxtDATABROWSE-TABLENAME").Text = "MAPL"
	$sess.ActiveWindow().FindByID("tbar[1]/btn[7]").Press()
	_NotEqual("usr/ctxtI11-LOW", "usr/btn%_I11_%_APP_%-VALU_PUSH", "X")
	$sess.ActiveWindow().FindByID("tbar[1]/btn[8]").Press()
	_SaveLocalFile($mypath, "MAPL.txt")
	$sess.ActiveWindow().SendVKey(12)
	$sess.ActiveWindow().SendVKey(12)
EndFunc
Essentially what I want to know is if there is a one- or two-liner to replace _NotEqual. FYI the code is for AutoIt, but the API calls are all standard.

Thanks in advance.