Hello Robin,
welcome in the Scripting Language forum.
The following script deletes all entries of a selection screen:
'-Begin----------------------------------------------------------------- '-Directives---------------------------------------------------------- Option Explicit
'-Global Variables---------------------------------------------------- Dim SapGuiAuto, application, connection, session '-Sub EmptyTextFields------------------------------------------------ Sub EmptyTextFields(obj) '-Variables------------------------------------------------------- Dim cntObj, i, Child, Field On Error Resume Next cntObj = obj.Children.Count() If cntObj > 0 Then For i = 0 To cntObj - 1 Set Child = obj.Children.Item(CLng(i)) EmptyTextFields Child If InStr(Child.ID(), "/usr/") Then If InStr(Child.ID(), "-LOW") Or InStr(Child.ID(), "-HIGH") Then Set Field = Child.Parent().FindByID(Child.ID()) Field.Text = "" End If End If Next End If On Error Goto 0 End Sub
'-Main---------------------------------------------------------------- If Not IsObject(application) Then Set SapGuiAuto = GetObject("SAPGUI") Set application = SapGuiAuto.GetScriptingEngine End If If Not IsObject(connection) Then Set connection = application.Children(0) End If If Not IsObject(session) Then Set session = connection.Children(0) End If EmptyTextFields session
'-End-------------------------------------------------------------------It deletes all entries in fields which ID ends with an -LOW or -HIGH. In a selection screen you have in a normal case this scheme of ID names. If your selection screen follows another scheme, change the code in line 17.
Let us know your results and if this code has solved your problem.
Cheers
Stefan