0

I am trying to write a VBA code that imports purchase orders based on an Excel list. Unfortunately SAP only allows input for fields that are visible. I have tried adding in a verticalScrollbar.Position loop, but I haven't found a way to make it work, because after scrolling down the scrollbar the fields in SAP reset.

Does anyone have an idea how to edit below pieces of code so that it can keep adding the fields from Excel into SAP?

I have tried to scroll after each input, scroll after batches, etc., but I keep getting stuck on the fact that SAP "resets focus" somehow.

I have been stuck at this for months and tried everything I could think of. Looking forward to see if someone knows how to do this.

Thank you.

'Loop for SAP Code

For t = 0 To N_Lines - 3
    If Sheets(Sht_Name).Cells(t + 2, 8) = "Box" Then
        SAPSesi.findById("wnd[0]/usr/subSUB0:SAPLMEGUI:0013/subSUB2:SAPLMEVIEWS:1100/subSUB2:SAPLMEVIEWS:1200/subSUB1:SAPLMEGUI:1211/tblSAPLMEGUITC_1211/ctxtMEPO1211-EMATN[4," & t & "]").Text = Sheets(Sht_Name).Cells(t + 2, 4)
    End If
Next t

'Loop for Quantities

For t = 0 To N_Lines - 3
    If Sheets(Sht_Name).Cells(t + 2, 8).Value = "Box" Then
        SAPSesi.findById("wnd[0]/usr/subSUB0:SAPLMEGUI:0013/subSUB2:SAPLMEVIEWS:1100/subSUB2:SAPLMEVIEWS:1200/subSUB1:SAPLMEGUI:1211/tblSAPLMEGUITC_1211/txtMEPO1211-MENGE[" & "6," & t & "]").Text = Sheets(Sht_Name).Cells(t + 2, 6)
    End If
Next t
Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
  • I have made a detailed description how you can scroll table controls here: [Reading text in Table Control](https://stackoverflow.com/questions/68685911/reading-text-in-table-control). – Sandra Rossi Jun 29 '23 at 15:14

0 Answers0