on 09-09-2014 1:17 PM
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 1 | Header 2 | Header 3 | Header 4 | Header 5 | Header 6 | ||
---|---|---|---|---|---|---|---|
|
| Year | Currency | Document number | Clearing Date | ||
1810205 | 7000 | 2014 | USD | 2000325777 | 09.09.2014 | ||
3400112282 | |||||||
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!
If you have proper configuration in transaction code OB74, the clearing can be done automatically.
In order to run you only need to run F.13
Please speak to your SAP FICO consultant.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello.
As Basic foundation you may can recreate my Excel VBA template which I have explained here => http://scn.sap.com/docs/DOC-57630
Setup Layout as described (last two columns are reserved for procedure Messages. You just Need to implement your code in module 1_SAP_PROCESS.
Create_Log function is getting Messages (from which you want to take them). It may seems complicated. But in the end it´s really simple.
Best regards,
Holger
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for the help Holger! I did what was stated in your explanation. I just don't understand how I can input my codes there, and how I can change the excel file based on the data that I need to input. I am fairly new with this and I mostly rely on recording scripts and tweaking minor details, so I am not sure what to do next. hope you could help me.
Thanks alot!!
Vedette
Hello.
Please do a new recording with all steps included. I assume you will post a single document per step, right?
type in transactioncode as:
/nF-03
Clear all fields (Independence if they are prefilled or not)
fillin data required
set radiobutton to required step (if Default already set jump into another Option and back)
Please post recording here. Thanks.
Br, Holger
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.