cancel
Showing results for 
Search instead for 
Did you mean: 

Calling a function-module from VB.

Former Member
0 Kudos

I want to call a function-module in SAP from VB.

How do I reference the elements of a structure when the structure is import or export parameter to the function- module. The object used from VB is SAP.Functions.

Can anybody please advice ?

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

I strongly recommend you to move to .NET before answering your question.

Suppose that you want to call the function module YOUR_FUNCTION that has an export parameter YOUR_PARAM of type structure, you can reference the field FIELD1 of the structure as follwos:

Set SAPFunctions = CreateObject("SAP.Functions")

Set SAPFunctions.Connection = oConnection

Set oFunc = SAPFunctions.Add("YOUR_FUNCTION ")

oFunc.Exports("YOUR_PARAM ").Value("FIELD1") = "Hello"

Please have a look at the Structure object using VB Object Viewer.

Regards,

Guangwei Li

Former Member
0 Kudos

Hi Guangweli,

Thanks for the reply and its working but i am facing a small problem in the same after calling the function if I test the same through sap its working fine but from vb if i send the same values i am getting an error message which they worte in the bapi code.

Let me know where the problem is.

Thanks

cmkiran

Former Member
0 Kudos

I got the solution for problem, but i forgot to give the points to the question. Tell me how to add the points to the question so that i can add them.

I need teh solution for sending the values to the structures frm vb 6.0

I used the code as shown below

function.tables("tables_name").feilds("feildname").value =00000

but this is giving some error please update me

Former Member
0 Kudos

If you sent it exactly as you typed it, it may be that you misspelled fields as feilds. I don't know if this is related to your problem, but it may be.