F-03 Clearing - Data from Excel to SAP

maryvlyx

New Member
Joined
Sep 10, 2014
Messages
2
Hi guys,

I am new to creating macro tools using excel VBA and SAP and I am studying on my own.
I just want to ask if you can help me with creating my macro tool for clearing in SAP tcode f-03 because we are having backlogs of open items and this would help.

Here is my recorded VBA from SAP.

If Not IsObject(application) Then
Set SapGuiAuto = GetObject("SAPGUI")
Set application = SapGuiAuto.GetScriptingEngine
End If
If Not IsObject(Connection) Then
Set Connection = application.Children(0)
End If
If Not IsObject(session) Then
Set session = Connection.Children(0)
End If
If IsObject(WScript) Then
WScript.ConnectObject session, "on"
WScript.ConnectObject application, "on"
End If
session.findById("wnd[0]").maximize
session.findById("wnd[0]/tbar[0]/okcd").Text = "f-03"
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/usr/sub:SAPMF05A:0131/radRF05A-XPOS1[4,0]").Select
session.findById("wnd[0]/usr/ctxtRF05A-AGKON").Text = "1992010"
session.findById("wnd[0]/usr/ctxtBKPF-BUDAT").Text = "07.09.2014"
session.findById("wnd[0]/usr/txtBKPF-MONAT").Text = "9"
session.findById("wnd[0]/usr/ctxtBKPF-BUKRS").Text = "lb01"
session.findById("wnd[0]/usr/ctxtBKPF-WAERS").Text = "USD"
session.findById("wnd[0]/usr/sub:SAPMF05A:0131/radRF05A-XPOS1[4,0]").SetFocus
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/usr/sub:SAPMF05A:0731/txtRF05A-SEL01[0,0]").Text = "2000007080"
session.findById("wnd[0]/usr/sub:SAPMF05A:0731/txtRF05A-SEL01[1,0]").Text = "2000007101"
session.findById("wnd[0]/usr/sub:SAPMF05A:0731/txtRF05A-SEL01[1,0]").SetFocus
session.findById("wnd[0]/usr/sub:SAPMF05A:0731/txtRF05A-SEL01[1,0]").caretPosition = 10
session.findById("wnd[0]/tbar[1]/btn[16]").press


The data that I want to use is coming from my excel file. Below is the sample of the data.


Header 1Header 2Header 3Header 4Header 5Header 6
GL Account

<tbody style="margin: 0px; padding: 0px; border: 0px; outline: 0px; font-style: inherit; font-family: inherit; vertical-align: baseline; background-color: transparent; ">
</tbody>
Company code

<tbody style="margin: 0px; padding: 0px; border: 0px; outline: 0px; font-style: inherit; font-family: inherit; vertical-align: baseline; background-color: transparent; ">
</tbody>
YearCurrencyDocument numberClearing Date
181020570002014USD200032577709.09.2014
3400112282

<thead style="margin: 0px; padding: 0px; border: 0px; outline: 0px; font-style: inherit; font-family: inherit; vertical-align: baseline; background-color: transparent; ">
</thead><tbody style="margin: 0px; padding: 0px; border: 0px; outline: 0px; font-style: inherit; font-family: inherit; vertical-align: baseline; background-color: transparent; ">
</tbody>

After the pair of document numbers are cleared, I also want to copy the message from SAP saying that is cleared and paste it in Excel.

I hope I was able to give you a clear view of what I want to achieve.. I also want the script to loop until all updated document numbers are cleared.

Hope you could help guys!

Thanks alot!
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.

Forum statistics

Threads
1,214,981
Messages
6,122,565
Members
449,089
Latest member
Motoracer88

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