on 01-28-2011 7:49 AM
Hi Experts,
I have a excel file which will automatically create a sales order to SAP, information is picked from excel cells. My problem is, if some of the products are out of stock, back order window appears and script fails.
How to write a code, which considers following:
If some product(s) are out of stock, system would press F5, (session.findById("wnd[0]").sendVKey 5), which will approve back order.
if not, the script would ignore code (session.findById("wnd[0]").sendVKey 5) and continue
D
There is only one Possible Way to do this,
You can check if the backorder Window pops up and then do press F5 (or any Key you need ...)
PLace this code where the Window will popup
on error resume next
If err.number > 0 then
if session.findbyId("wnd[1]").Text = "Backorder" Then ' here goes the Caption of the backorder-Window
'Do some Keypress
session.findById("wnd[1]").SendVKey 5 'dont know the KeyCode you need (dont have access to that TA
End if
end if
On error Goto 0
Greetings
Thomas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Thomas,
And thanks for your prompt reply!
I was unable to implement this. I tried this:
On Error Resume Next
If session.findById("wnd[1]/usr/txtRV03V-ARKTX") Then
session.findById("wnd[1]/usr/txtRV03V-ARKTX").SendVKey 5
End If
On Error GoTo 0
Can you please advice, if you see the error here?
Where exactly should I place the code ("wnd[1]/usr/txtRV03V-ARKTX") ?
D
Hi Degnic,
since I dont have Access to that TA, i can only guess how your Code works and when something should happen...
thats why I only can guess yoour Problem...
you wrote:
I have a excel file which will automatically create a sales order to SAP, information is picked from excel cells. My problem is, if some of the products are out of stock, back order window appears and script fails.
If some product(s) are out of stock, system would press F5, (session.findById("wnd[0]").sendVKey 5), which will approve back order.
if not, the script would ignore code (session.findById("wnd[0]").sendVKey 5) and continue
So you do have a code which is allready running except for the Backorder -Problem..?
than you have to place the code where the Backorderwindow would Open...
For example ...
'Salesorder Create (I suggest F11 is pressed)
session.findById("wnd[0]").SendVKey 11
On error Resume next
'now its time for Backorder - Check
If session.findById("wnd[1]").Text = "" Then 'here goes the Caption of the WindowBar
session.FindById("wnd[1]/usr/txtRV03V-ARKTX").SendVKey 5
End if
On error goto 0
Thomas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.