cancel
Showing results for 
Search instead for 
Did you mean: 

Copy and pasting from SAP to Excel with macro

Former Member
0 Kudos

So I am trying to pull data from SAP using scripts. I am new to VBA so please bear with me. I found a topic on stack overflow called VBA pulling data from SAP for dummies and I am confused. What I am trying to do is as follows:

  1. Copy a notification number from a list in excel.
  2. Go to the appropriate screen in SAP and paste this number in the search box.
  3. Open the long text box.
  4. Copy the long text.
  5. Paste into excel.

Here is the link VBA pulling data from SAP for dummies

I can't seem to get by Set session = connection.Children(0) 'Get the first session (window) on that connection. Would it be easier to run the script in the SAP GUI?

Any help is much appreciated. The reason I am doing this is because SAP wont export longtext and it takes an act of God to get it fixed around here.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

I am new user and this discussion was very helpful.However I was wondering on SAP scripts from Google sheets?

Any Ideas experts ?

former_member213011
Participant
0 Kudos

Dear Dylan,

What you described above is actually the same reason why I started with VBA SAP Scripting and ended up joining this forum. So, you have come to the right place.

I think the quick debug for the code is to replace connection.Children(0) with SAPCon.Children(0) since the SAP connection has been declared as SAPCon.

Try and do tell if it works.

Thanks,

Sayuti

Former Member
0 Kudos

Hi Dylan - it could be pretty challanging to do what you are trying to do. I had the same challange to get long text from notifications but we have a transaction code that extracts long text and chops up each line to a separate cell in ALV viewer. So I use this output to dump it into Excel. Without this custom transaction, you can still do it. If you use the SAP's non-graphical editor, then you can cut and paste each line of 65 characters from SAP and paste into Excel.

Hope it helps.

Regards
Umur