Automating export of fs10n query from SAP using VBA

mdpepper1

New Member
Joined
Oct 3, 2013
Messages
2
Currently the manual process exists where users access SAP and select query FS10N to produce a report. This report is then exported from SAP to .XLS format and saved to user's hard drive.
I would like to automate this process with an Excel macro. So far I have implemented VBA code to connect to SAP. So now how do I implement extraction of FS10N report?
Thank you, David
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Currently the manual process exists where users access SAP and select query FS10N to produce a report. This report is then exported from SAP to .XLS format and saved to user's hard drive.
I would like to automate this process with an Excel macro. So far I have implemented VBA code to connect to SAP. So now how do I implement extraction of FS10N report?
Thank you, David

Hello David, I'm sure you pretty much figured it out by now, however, automating SAP for basic functions is actually very easy. Just log in normally, and there's a little icon that looks like a TV with a green / red / blue line... If you click on it, there's a bunch of options, one of which is called: "Script recording and playback..."

If you click on that you'll see a pop up with a play, a record and a stop button. There's also a more (or less) button. If you expand that section you can select where you want your script to be recorded. Just select the area and hit record, once you are done click the stop button. Copy the whole path and open it on a notepad. You can select that thing and past it on your VBA script. The start should look something like this:

Code:
session.findById("wnd[0]").maximize
session.findById("wnd[0]/tbar[0]/okcd").text = "/NFS10N"
session.findById("wnd[0]").sendVKey 0

This is basically saying SAP logged in transaction FS10N. Please note the /N is not mandatory, however for dummy proof purposes I include it in every single one of my macros.

Make sure you're doing all the steps slowly so no mistakes happen, and SAP will do the rest for you. Let me know if you have any questions. I practically automate SAP ECC (and previously FP9) reports for a living :)


HOpe this helps

C
 
Upvote 0
Hello David, I'm sure you pretty much figured it out by now, however, automating SAP for basic functions is actually very easy. Just log in normally, and there's a little icon that looks like a TV with a green / red / blue line... If you click on it, there's a bunch of options, one of which is called: "Script recording and playback..."

If you click on that you'll see a pop up with a play, a record and a stop button. There's also a more (or less) button. If you expand that section you can select where you want your script to be recorded. Just select the area and hit record, once you are done click the stop button. Copy the whole path and open it on a notepad. You can select that thing and past it on your VBA script. The start should look something like this:

Code:
session.findById("wnd[0]").maximize
session.findById("wnd[0]/tbar[0]/okcd").text = "/NFS10N"
session.findById("wnd[0]").sendVKey 0

This is basically saying SAP logged in transaction FS10N. Please note the /N is not mandatory, however for dummy proof purposes I include it in every single one of my macros.

Make sure you're doing all the steps slowly so no mistakes happen, and SAP will do the rest for you. Let me know if you have any questions. I practically automate SAP ECC (and previously FP9) reports for a living :)


HOpe this helps

C

No!

I have not sorted it out yet and it has been put on the back burner! Thank you so much for this. I will put it into action and let you know how it goes.

Many thanks,
David
 
Upvote 0
Code:
session.findById("wnd[0]").maximize
session.findById("wnd[0]/tbar[0]/okcd").text = "/NFS10N"
session.findById("wnd[0]").sendVKey 0

Sorry for necromancing this thread but it was never resolved and it's covering near the exact same issue I have (at least I used the search function!)

I can see the vbs working fine with the code above, adpatly slightly to pull through the correct account details, but what I think the original poster then got stuck at (as do i) is that there is no print option within the next screen so sendVkey or tbar/btn reference wont work. Instead we are trying to use the "Hard Copy" function that doesn't appear to be support in the recording options. Can you tell me what the command line should ready to do this, or to do Alt+F12 then H?
 
Upvote 0
Thinking logically, any command code to do a print screen of the open window directly to the printer would do (shame my knowledge is so bad is can't do this)
 
Upvote 0

Forum statistics

Threads
1,215,447
Messages
6,124,906
Members
449,194
Latest member
JayEggleton

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top