Skip to Content
0
Former Member
Feb 07, 2007 at 05:31 PM

Call SAP function from VB - Structure member not found "<unknown>"

1040 Views

Hello,

(I don't know if this is the appropriate forum, but I didn't find any which seem to match my topic ...)

I use the following VB code to call the SAP function ARCHIV_PROCESS_RFCINPUT:

Dim bapiControl As SAPBAPIControl

Dim logonControl As SAPLogonControl

Dim functions As SAPFunctions

Set bapiControl = New SAPBAPIControl

Set logonControl = New SAPLogonControl

Set functions = New SAPFunctions

Set bapiControl.Connection = logonControl.NewConnection

' do login

...

Set functions.Connection = bapiControl.Connection

Dim myFunction As SAPFunctionsOCX.Function

Set myFunction = functions.Add("ARCHIV_PROCESS_RFCINPUT")

Dim myStructure As SAPFunctionsOCX.Structure

Set myStructure = functions.CreateStructure("OARFCIN")

' the following values are just examples

myStructure("ARCHIV_ID") = "01"

myStructure("ARC_DOC_ID") = "1234567890123457890"

myStructure("AR_OBJECT") = "TIF"

myStructure("DOC_TYPE") = "FIIINVOICE"

myStructure("BARCODE") = "1"

myFunction.Exports("DOCUMENT_ENTRY") = myStructure

At this point execution stops with the following error message:

Err.Number: 1006

Err.Description: Structure member not found "<unknown>"

Err.Source: wdtfuncs

What is wrong? The function ARCHIV_PROCESS_RFCINPUT needs one input parameter called "DOCUMENT_ENTRY" which is of type OARFCIN ...

ARCHIV_CONNECTION_INSERT, which has only Strings as input parameters (no structures), works fine ...

I tried all variations I could think of:

myStructure.Value("ARCHIV_ID") = G_csDefaultRepository

instead of myStructure("ARCHIV_ID") = G_csDefaultRepository

declaring bapiControl, logonControl and functions as Object, and instanciating them with CreateObject(...)

myFunction.Exports(0).Insert "DOCUMENT_ENTRY", myStructure

instead of myFunction.Exports("DOCUMENT_ENTRY") = myStructure

(which gave me a "Collection member not found" error) ...

Nothing worked ...

What is wrong with this code??

Thanks for help!

Regards

Steffi