Hey All,
Working on a task to call BAPI_CTRADOCUMENT_CREATE from VBA in an Excel spread sheet and am experiencing some problems getting one of the Import parameters.
Here is an excerpt of the code:
' Create instance of BAPI module
Set oCrDocFunc = obFunctions.Add("BAPI_CTRACDOCUMENT_CREATE")
' Create structures for BAPI
Dim I_TEST As Object
Dim I_DocHdr As Object
Dim I_DocNbr As Object
Dim I_Return As Object
' Get structures from BAPI
Set I_TEST = oCrDocFunc.Exports.Item("TESTRUN")
Set I_DocHdr = oCrDocFunc.Exports("DOCUMENTHEADER")
Set I_DocNbr = oCrDocFunc.Imports.Item("DOCUMENTNUMBER")
Set I_Return = oCrDocFunc.tables.Item("RETURN")
end of excerpt
I am using the debugger to step through the program. When the debugger gets to the <b>Set I_DocHdr</b> code the WATCH window shows Error 0 after execution.
Looking at the BAPI there are 2 import parameters; TESTRUN and DOCUMENTHEADER.
TESTRUN is set to be like BAPICTRACAUX-TESTRUN (field)
DOCUMENTHEADER is set to be like BAPIDFKKKO (structure)
Seems to work just fine until it gets to the Set command for the DOCUMENTHEADER.
Can anyone tell me what I am doing wrong?
Thanks,
Bill