cancel
Showing results for 
Search instead for 
Did you mean: 

VBA - Copy Data from SAP ZMRPN Table with different names into Excel

Former Member
0 Kudos

Hello,

I currently am trying to put all data which was output by a report from ZMRPN into arrays to paste it into excel and recreate the table to further create E-Mails with the specific information. I think it is probably easier to just create the arrays and directly create E-Mails, but I was thinking that since I am new it might be good to see the data and then create the E-Mails script based on Excel data

Im using VBA to start my SAP script.

My first approach was to loop through the table with a 2D array, but then after I finished the code I realized that the columns in the table have different names...

e.g.

Single column

session.findById("wnd[0]/usr/tblZME0PR3ETC_EBAN_9020/txtI_EBAN-WERKS[1,0] 2 columns which are related to each other

session.findById("wnd[0]/usr/tblZME0PR3ETC_EBAN_9020/txtV_LABST2[12,0]").

session.findById("wnd[0]/usr/tblZME0PR3ETC_EBAN_9020/txtV_PRICE2[14,0]")

Also 2 columns which are related to each other just next to the example before.

session.findById("wnd[0]/usr/tblZME0PR3ETC_EBAN_9020/txtV_LABST3[15,0]"

session.findById("wnd[0]/usr/tblZME0PR3ETC_EBAN_9020/txtV_PRICE3[17,0]")

The table is approx 20 rows and 100 columns long.

Please help me out with an approach of how I could copy the table without having to create 100 for loops. Ultimately if I wont find a solution I will be forced to create all the for loops but I honestly don't think this is the correct way/most efficient way.

I am new to VBA/SAP scripting and would like to learn more.

Thanks in advance!!

Accepted Solutions (0)

Answers (1)

Answers (1)

script_man
Active Contributor
0 Kudos

Hi Patrick,

please look at the following link:

https://stackoverflow.com/questions/45721733/excel-vba-code-to-go-to-specific-sap-column-and-find-sp...

You may be able to find an answer to your question there.

Regards,

ScriptMan