on 03-24-2014 10:28 AM
Hi,
I am trying to update a database table from excel using a VBA Macro.
I am able to connect to SAP and able to read data from SAP using a RFC. Similarly after updating certain values, i want to update a table in SAP.
Below are the steps I am doing apart from basic settings.
' Call RFC
Set MyFunc = R3.Add("UPDATE_TVARVC_VIA_RFC")
' Get reference and Values TVARVC
Set oParam4 = MyFunc.Tables("TVARVC")
2. Loop over the active cells and populate oParam4
" add values as below
oParam4.Rows.Add
oParam4.Value(1, "NAME") = ..................
oParam4.Value(1, "TYPE") = ..................
oParam4.Value(1, "NUMB") = ..................
Do it for all columns in the table line.
My query is how to identify active cells and make the above code dynamic in step 2.
Thanks in Advance,
Best,
Aneel
Hi Aneel,
You can try the following:
e.g.
. . .
for j = 1 to ActiveCell.SpecialCells(11).Column
oParam4.Rows.Add
if j=1 then oParam4.Value(j, "NAME") = ActiveSheet.Cells(1,j).Value
if j=2 then oParam4.Value(j, "TYPE") = ActiveSheet.Cells(1,j).Value
if j=3 then oParam4.Value(j, "NUMB") = ActiveSheet.Cells(1,j).Value
. . .
next j
. . .
Regards,
ScriptMan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello.
You have an customized functionmodule UPDATE_TVARVC_VIA_RFC created in your System?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.