SCRIPT RECORDING & PLAYBACK WITH EXCEL INTEGRATION
Below example is for PR Creation
Processing steps as below
Click on customize icon as displayed below and opt for “Script Recording and Playback”
Below pop up will appear
Press button to opt for the path.
Give path for the (VBScript) file.
Press Recording button to start the recording.
Execute the transaction.
Once executed, press Stop button.
Go to the path opted, a vb script file will be available, as below.
Here in this case by the name “ME51N.vbs”
Edit file, with right click, below code will open, this is in simple words output of script
recording.
I have hidden parameters like (Account Assignment, Material, Quantity, Plant, Price,
Material Group) in same sequence as mentioned below
----------------------------------------------INTEGRATION WITH EXCEL---------------------------------------------------
Code PATCH 1
After rem & before rem as below
In below code I have taken 6 columns. Because I want to enter 6 values through excel
(Account Assignment, Material, Quantity, Plant, Price, Material Group)
REM ===
Dim objExcel
Dim objSheet, intRow, i
Set objExcel = GetObject(,"Excel.Application")
Set objSheet = objExcel.ActiveWorkbook.ActiveSheet
For i = 2 to objSheet.UsedRange.Rows.Count
COL1 = Trim(CStr(objSheet.Cells(i, 1).Value)) 'Column1
COL2 = Trim(CStr(objSheet.Cells(i, 2).Value)) 'Column2
COL3 = Trim(CStr(objSheet.Cells(i, 3).Value)) 'Column3
COL4 = Trim(CStr(objSheet.Cells(i, 4).Value)) 'Column4
COL5 = Trim(CStr(objSheet.Cells(i, 5).Value)) 'Column5
COL6 = Trim(CStr(objSheet.Cells(i, 6).Value)) 'Column6
REM ===
Code PATCH 2
After rem & before rem as below
In below code I have taken 6 columns. Because I want to enter 6 values through excel
(Account Assignment, Material, Quantity, Plant, Price, Material Group)
REM ===
aux=col1 & " " & col2 & " " & col3 & " " & col4 & " " & col4 & " " & col5 & " " & col6
CreateObject("WScript.Shell").run("cmd /c @echo %date% %time% " & aux & " >>
%appdata%\ProjCreationLog.txt")
next
msgbox "Process Completed"
REM ====
Update VB Script File
Add code of path1 & patch2 as mentioned below
Replace Account Assignment, Material, Quantity, Plant, Price, Material Group with value as
COL1, COL2, COL3, COL4, COL5, COL6.
These columns will refer value from excel file, mentioned below
Columns maintained in excel for input
Plzz note - excel needs to be open while running script
1. In the last step, open one GUI session at a time
2. Double click on script, pop up will appear “A Script is attempting & press OK
3. Keep the excel open
SEE THE MAGIC ;)
Regards
Aditya