-2

I'm trying to write a function to copy BOMs (SAP ERP) from an old part to a new part, only changing material quantity. To do this I need to know how many rows of materials are in each particular BOM, which changes depending on the part. When I use the script recorder in SAP GUI, it seems to refer to each row relative to the top of the screen. First row is 0, second is 1, and so on. If I scroll down, there's a new 0 row. Is there an easier way to find how many rows have data in them?

Example row 0:

wnd[0]/usr/tabsTS_ITOV/tabpTCMA/ssubSUBPAGE:SAPLCSDI:0152/tblSAPLCSDITCMAT/txtRC29P-MENGE[4,0]

example of such a BOM

There are additional rows if you were to keep scrolling.

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
bcherb2
  • 1
  • 2
  • 1
    It's hard to fully understand your question. Write a function in ABAP? In VBA? Can you show what have you tried? Can you give more details? – Nelson Miranda May 31 '18 at 21:41

1 Answers1

0
SAPsession.findById("wnd[0]/usr/tabsTS_ITOV/tabpTCMA/ssubSUBPAGE:SAPLCSDI:0152/tblSAPLCSDITCMAT").rowcount

will give you the number of rows on the subpage. You then just need to loop through them.

In VBA, something like:

    allrows  = SAPsession.findById  ("wnd0]/usr/tabsTS_ITOV/tabpTCMA/ssubSUBPAGE:SAPLCSDI:0152/tblSAPLCSDITCMAT").rowcount

For row = 0 to allrows
  product = session.findById("wnd0]/usr/tabsTS_ITOV/tabpTCMA/ssubSUBPAGE:SAPLCSDI:0152/tblSAPLCSDITCMAT/ctxtRC29P-IDNRK[4," & row & "]").Text
next row
Nick
  • 3,454
  • 6
  • 33
  • 56