Bagota

New Member
Joined
Oct 14, 2018
Messages
1
Hello everyone,

Not able to put value ZP05 and amount from excel sheet

below is the code

Code:
session.findById("wnd[0]/usr/tabsTAXI_TABSTRIP_HEAD/tabpT\07/ssubSUBSCREEN_BODY:SAPLV69A:6201/tblSAPLV69ATCTRL_KONDITIONEN").verticalScrollbar.Position = 0
jcount = 0
porgvalue = ""
nn = 1
For k = 0 To 1000
    Err.Clear
    session.findById("wnd[0]/usr/tabsTAXI_TABSTRIP_HEAD/tabpT\07/ssubSUBSCREEN_BODY:SAPLV69A:6201/tblSAPLV69ATCTRL_KONDITIONEN/txtKOMV-KBETR[1," & jcount & "]").SetFocus
    If (Err.Number = 0) Then
        porgvalue = session.findById("wnd[0]/usr/tabsTAXI_TABSTRIP_HEAD/tabpT\07/ssubSUBSCREEN_BODY:SAPLV69A:6201/tblSAPLV69ATCTRL_KONDITIONEN/txtKOMV-KBETR[1," & jcount & "]").Text
        If (porgvalue = "") Then
            session.findById("wnd[0]/usr/tabsTAXI_TABSTRIP_HEAD/tabpT\07/ssubSUBSCREEN_BODY:SAPLV69A:6201/tblSAPLV69ATCTRL_KONDITIONEN/ctxtKOMV-KSCHL[0," & jcount & "]").Text = "zp05"
            session.findById("wnd[0]/usr/tabsTAXI_TABSTRIP_HEAD/tabpT\07/ssubSUBSCREEN_BODY:SAPLV69A:6201/tblSAPLV69ATCTRL_KONDITIONEN/txtKOMV-KBETR[2," & jcount & "]").Text = combinevalue
            jcount = 0
            Exit For
        ElseIf (porgvalue Like "*_*") Then
            session.findById("wnd[0]/usr/tabsTAXI_TABSTRIP_HEAD/tabpT\07/ssubSUBSCREEN_BODY:SAPLV69A:6201/tblSAPLV69ATCTRL_KONDITIONEN").verticalScrollbar.Position = 0
            jcount = 0
            Exit For
        Else
            GoTo dbjdown3
        End If
    ElseIf (Err.Number <> 0) Then
        session.findById("wnd[0]/usr/tabsTAXI_TABSTRIP_HEAD/tabpT\07/ssubSUBSCREEN_BODY:SAPLV69A:6201/tblSAPLV69ATCTRL_KONDITIONEN").verticalScrollbar.Position = xnn * nn
        jcount = 0
        nn = (nn + 1)
        GoTo dbjdown31
    End If
dbjdown3:
    jcount = (jcount + 1)
dbjdown31:
Next k
Err.Clear
session.findById("wnd[0]/usr/tabsTAXI_TABSTRIP_HEAD/tabpT\07/ssubSUBSCREEN_BODY:SAPLV69A:6201/btnBT_KONX").press
session.findById("wnd[1]/usr/lbl[1,4]").SetFocus
session.findById("wnd[1]").sendVKey 2
If (Err.Number <> 0) Then
    dbws.Range("F" & i).Value = "Failed"
    dbws.Range("F" & i).Interior.Color = RGB(255, 204, 204)
    GoTo dbxdown
End If
session.findById("wnd[0]/usr/tabsTAXI_TABSTRIP_HEAD/tabpT\07/ssubSUBSCREEN_BODY:SAPLV69A:6201/tblSAPLV69ATCTRL_KONDITIONEN").verticalScrollbar.Position = 0
'''validate Net Value whether matching with Amount?
xporgvalue = ""
xporgvalue = session.findById("wnd[0]/usr/tabsTAXI_TABSTRIP_HEAD/tabpT\07/ssubSUBSCREEN_BODY:SAPLV69A:6201/txtKOMP-NETWR").Text
If (VBA.Round(CDbl(xporgvalue), 2) <> VBA.Round(CDbl(combinevalue & " "), 2)) Then
    jcount = 0
    porgvalue = ""
    nn = 1
    session.findById("wnd[0]/usr/tabsTAXI_TABSTRIP_HEAD/tabpT\07/ssubSUBSCREEN_BODY:SAPLV69A:6201/tblSAPLV69ATCTRL_KONDITIONEN").verticalScrollbar.Position = 0
    For k = 0 To 1000
        Err.Clear
        session.findById("wnd[0]/usr/tabsTAXI_TABSTRIP_HEAD/tabpT\07/ssubSUBSCREEN_BODY:SAPLV69A:6201/tblSAPLV69ATCTRL_KONDITIONEN/txtKOMV-KBETR[1," & jcount & "]").SetFocus 'description column (grid object)
        If (Err.Number = 0) Then
            porgvalue = session.findById("wnd[0]/usr/tabsTAXI_TABSTRIP_HEAD/tabpT\07/ssubSUBSCREEN_BODY:SAPLV69A:6201/tblSAPLV69ATCTRL_KONDITIONEN/ctxtKOMV-KSCHL[0," & jcount & "]").Text
            If (VBA.LCase(porgvalue) = "zp05") Then
                session.findById("wnd[0]/usr/tabsTAXI_TABSTRIP_HEAD/tabpT\07/ssubSUBSCREEN_BODY:SAPLV69A:6201/tblSAPLV69ATCTRL_KONDITIONEN").getAbsoluteRow(k).Selected = True
                session.findById("wnd[0]/usr/tabsTAXI_TABSTRIP_HEAD/tabpT\07/ssubSUBSCREEN_BODY:SAPLV69A:6201/btnBT_KOLO").press
                jcount = 0
                Exit For
            ElseIf (porgvalue Like "*_*") Then
                session.findById("wnd[0]/usr/tabsTAXI_TABSTRIP_HEAD/tabpT\07/ssubSUBSCREEN_BODY:SAPLV69A:6201/tblSAPLV69ATCTRL_KONDITIONEN").verticalScrollbar.Position = 0
                jcount = 0
                Exit For
            Else
                GoTo dbjdown4
            End If
        ElseIf (Err.Number <> 0) Then
            session.findById("wnd[0]/usr/tabsTAXI_TABSTRIP_HEAD/tabpT\07/ssubSUBSCREEN_BODY:SAPLV69A:6201/tblSAPLV69ATCTRL_KONDITIONEN").verticalScrollbar.Position = xnn * nn
            jcount = 0
            nn = (nn + 1)
            GoTo dbjdown41
        End If
dbjdown4:
        jcount = (jcount + 1)
dbjdown41:
    Next k
    Err.Clear
    session.findById("wnd[0]/usr/tabsTAXI_TABSTRIP_HEAD/tabpT\07/ssubSUBSCREEN_BODY:SAPLV69A:6201/tblSAPLV69ATCTRL_KONDITIONEN").verticalScrollbar.Position = 0
    If (Err.Number <> 0) Then
        dbws.Range("F" & i).Value = "Failed"
        dbws.Range("F" & i).Interior.Color = RGB(255, 204, 204)
        GoTo dbxdown
    End If
    jcount = 0
    porgvalue = ""
    For k = 0 To 1000
        Err.Clear
        session.findById("wnd[0]/usr/tabsTAXI_TABSTRIP_HEAD/tabpT\07/ssubSUBSCREEN_BODY:SAPLV69A:6201/tblSAPLV69ATCTRL_KONDITIONEN/txtKOMV-KBETR[1," & jcount & "]").SetFocus
        If (Err.Number = 0) Then
            porgvalue = session.findById("wnd[0]/usr/tabsTAXI_TABSTRIP_HEAD/tabpT\07/ssubSUBSCREEN_BODY:SAPLV69A:6201/tblSAPLV69ATCTRL_KONDITIONEN/txtKOMV-KBETR[1," & jcount & "]").Text
            If (porgvalue = "") Then
                session.findById("wnd[0]/usr/tabsTAXI_TABSTRIP_HEAD/tabpT\07/ssubSUBSCREEN_BODY:SAPLV69A:6201/tblSAPLV69ATCTRL_KONDITIONEN/ctxtKOMV-KSCHL[0," & jcount & "]").Text = "zp05"
                session.findById("wnd[0]/usr/tabsTAXI_TABSTRIP_HEAD/tabpT\07/ssubSUBSCREEN_BODY:SAPLV69A:6201/tblSAPLV69ATCTRL_KONDITIONEN/txtKOMV-KBETR[2," & jcount & "]").Text = combinevalue
                jcount = 0
                Exit For
            ElseIf (porgvalue Like "*_*") Then
                session.findById("wnd[0]").sendVKey 81 'pageup
                jcount = 0
                Exit For
            Else
                GoTo dbjdown5
            End If
        ElseIf (Err.Number <> 0) Then
            session.findById("wnd[0]").sendVKey 82 'pagedown
            jcount = 0
            GoTo dbjdown5
        End If
dbjdown5:
        jcount = (jcount + 1)
    Next k
    session.findById("wnd[0]/usr/tabsTAXI_TABSTRIP_HEAD/tabpT\07/ssubSUBSCREEN_BODY:SAPLV69A:6201/btnBT_KONX").press
    session.findById("wnd[1]/usr/lbl[1,5]").SetFocus
    session.findById("wnd[1]/tbar[0]/btn[0]").press 'option C i selected
End If
 
Last edited by a moderator:

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.

Forum statistics

Threads
1,171,644
Messages
5,876,642
Members
433,201
Latest member
OuedJulius

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top