Skip to Content

Writing data to excel with vba


I'm trying to get all the unique material numbers from this view and export it into excel. I need to do this with vba. I'm already able to connect to SAP en control my GUI with vba. I also can read tables from SAP but this view keeps giving me troubles.

I already tried every link google gave my but nothing gave my a satisfying answer.

My last hope was something like this:

session.findById("wnd[0]/usr/tbl/XXXX/SAPLSD_QFLYER3TCTRL_/XXXX/SD_QFLYERV/txt/XXXX/SD_QFLYERV-MATNR[3," & i &"]")

and iterate over i until that cell was empty. But only the cells that are visible have an id so i would have to also scroll trough the list. but this isn't practical at all.

Maybe a function call would work but I haven't been able to get this to work.

I hope someone can help me.

capture.png (53.5 kB)
Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • Best Answer
    Feb 14 at 03:22 PM

    Hello Benjamin,

    you can find an approach for your problem here. A maintenance view is from type GuiTableControl as in the question. In this solution the content from each field in column was read. All you have to do is to put each entry in an array, to sort the array and to delete the duplicates. You can find a way how to do that here.

    Best regards

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Stefan

      Thank you for your response.
      It does work, but I have more than 2000 entry's so scrolling through the table en copying one cell at a time is too slow.

      Is there anyway to do this process maybe in the background or read multiple values at once?