on 08-30-2018 5:37 AM
Hello
This code goes to the seconde field (created on (MARA-ERSDA) in Mara , then fills out "01.01.2018".
session.findById("wnd[0]/usr/ctxtI2-LOW").Text = "01.01.2018"
But if this field is not present in the selection screen. Then the wrong field is entered. VField Last change (LAEDA-MARA)
How i can I fix this.
if the field is not present then it must be added. The field must be filled in regardless of the order of fields.
Thx
Hello Jeneroy,
welcome in the SAP Community.
You can loop over all elements of the screen to find the correct one via its description.
Set User = session.findById("wnd[0]/usr")
For i = 1 To User.Children.Count
If User.Children(CInt(i)).Type = "GuiTextField" Then
If User.Children(CInt(i)).Text = "Created On" Then
User.Children(CInt(i + 1)).Text = "01.01.2018"
Exit For
End If
End If
Next
In my case I use a selection screen which is on the UserArea. I loop over all elements and select the textfield with the name Created On and in the next element I set the date.
Let us know your results.
Cheers
Stefan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Stefan,
Thx for your answer, I have tested and it works 🙂
I have 2 questions:
Question 1:
How should I do it if I want to fill out the low field and the high field: example from 01.01.2018 to 31.01.2018.
Question 2:
How should I do it if I want to use multiple selection (copied from excel) :
example:
01.01.2018
03.01.2018
29.03.2018
Or how I can select the button which belongs to the field “Created on”
Thank you very much
Hello Jeneroy,
to set the low and the high field you can use the following snippet. +1 fills the low and +3 the high field.
Set User = session.findById("wnd[0]/usr")
For i = 1 To User.Children.Count
If User.Children(CInt(i)).Type = "GuiTextField" Then
If User.Children(CInt(i)).Text = "Created On" Then
User.Children(CInt(i + 1)).Text = "01.01.2018"
User.Children(CInt(i + 3)).Text = "31.01.2018"
Exit For
End If
End If
Next
To open the multi selection you can use the following snippet. +4 is the multi selection button.
Set User = session.findById("wnd[0]/usr")
For i = 1 To User.Children.Count
If User.Children(CInt(i)).Type = "GuiTextField" Then
If User.Children(CInt(i)).Text = "Created On" Then
User.Children(CInt(i + 4)).Press
'Your code here
Exit For
End If
End If
Next
Let us know your results.
Cheers
Stefan
Hello Stefan,
Thx for your answer, I have tested and it works 🙂
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.