2007 Mar 20 4:20 PM
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
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
2007 Mar 20 5:13 PM
Bill,
Add "Item" sub-object to your SET statement.
Before:
Set I_DocHdr = oCrDocFunc.Exports("DOCUMENTHEADER")
After:
Set I_DocHdr = oCrDocFunc.Exports.Item("DOCUMENTHEADER")
2007 Mar 20 6:00 PM
Sorry, this did not help. DOCUMENTHEADER is a structure and changing the setting to:
Set I_DocHdr = oCrDocFunc.Exports.Item("DOCUMENTHEADER")
Still returns an <b></b>ERROR 0<b></b>
Bill
2011 Jun 07 3:40 PM
Hi,
Could you please share your solution on this as I am stuck on this since a week.
Many Thanks in advance.
Regards,
Neal
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |