cancel
Showing results for 
Search instead for 
Did you mean: 

sap.net connector error

Former Member
0 Kudos

I get an error when I try to call BAPI_HU_PACK from a vb.net application. I can call RM_RS_Upload without any trouble so I know I have my connection correct. When I call BAPI_HU_PACK, the application jumps out with "Object referece not set to an instance of an object."

I have ran the same function inside the GUI with SE37 and it ran correctly with exactly the same data as I am trying to pass from the application. I don't actually get an SAP error returned, but rather an application run time error. My SAP system log states "Communication Error, CPIC return code 020, SAP return code 223" My code is below:

Dim proxyme As SAPProxyPack.SAPProxy1

Dim bapItem As New SAPProxyPack.BAPIHUITEM

Dim bapret2 As New SAPProxyPack.BAPIRET2Table

Dim baphuprop As New SAPProxyPack.BAPIHUITMPROPOSAL

Dim baphuhead As New SAPProxyPack.BAPIHUHEADER

Dim bapserial As New SAPProxyPack.BAPIHUITMSERIALTable

Dim bapseritem As New SAPProxyPack.BAPIHUITMSERIAL

With baphuprop

.Hu_Item_Type = "1"

.Material = "01B209AB"

.Pack_Qty = 1

.Plant = "1862"

.Base_Unit_Qty_Iso = ""

.Base_Unit_Qty = "PC"

.Stge_Loc = "0001"

.No_Of_Serial_Numbers = 0

.Number_Pack_Mat = 0

'.Flag_Suplmt_Item = "0"

End With

Try

proxyme = New SAPProxyPack.SAPProxy1

proxyme.Connection = New SAP.Connector.SAPConnection(SAPDestination)

proxyme.Connection.Open()

'MsgBox(proxyme.Connection.SystemRelease)

Call proxyme.Bapi_Hu_Pack("12345", baphuprop, baphuhead, bapItem, bapret2, bapserial)

'Me.DataGrid1.DataSource = bapret2.ToADODataTable

proxyme.Connection.Close()

proxyme.Connection.Dispose()

Catch ex As Exception

MsgBox(ex.Message.ToString)

End Try

Please help.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Are you using version 1.0x or 2.0? Can you please copy the stack trace of the exception?

Regards,

Guangwei

Former Member
0 Kudos

Hello,

What you sent is not what I meant, but it helps too.

From the debugger output, we can see that two different copies of the assembly SAP.Connector.dll were loaded when your program started. One was loaded from the system GAC, the other was loaded from 'c:\documents and settings\dalton_jones\my documents\visual studio projects\plc\plcprodreporting\test\bin\sap.connector.dll'.

I suspect that the latter is a dated old version.

Please remove the reference to the old assembly from your project, if any, and remove the file from the folder. Rebuild you app and have a try to see if it helps.

Regards,

Guangwei

Former Member
0 Kudos

Thanks. I created a new project and made sure it was only using the one instance of the dll and it worked like it should. Sorry it tooks so long to reply, but it took forever for me to get free to test the solution.

Answers (2)

Answers (2)

Former Member
0 Kudos

I have the same problem receiving Communication Error, CPIC return code 020, SAP return code 223

in the log file. The same code works fine against several SAP instance except one. The SAP .NET Connector version is 1.0.3 SE37 works fine. Any idea about what we could check?

Former Member
0 Kudos

Version 2.0

Below is what I think you are wanting. If not, let me know an I will pull up a different trace.

'DefaultDomain': Loaded 'c:\windows\microsoft.net\framework\v1.1.4322\mscorlib.dll', No symbols loaded.

'TEST': Loaded 'C:\Documents and Settings\dalton_jones\My Documents\Visual Studio Projects\PLC\PLCProdReporting\TEST\bin\TEST.exe', Symbols loaded.

'TEST.exe': Loaded 'c:\windows\assembly\gac\system.windows.forms\1.0.5000.0__b77a5c561934e089\system.windows.forms.dll', No symbols loaded.

'TEST.exe': Loaded 'c:\windows\assembly\gac\system\1.0.5000.0__b77a5c561934e089\system.dll', No symbols loaded.

'TEST.exe': Loaded 'c:\windows\assembly\gac\system.drawing\1.0.5000.0__b03f5f7f11d50a3a\system.drawing.dll', No symbols loaded.

'TEST.exe': Loaded 'c:\documents and settings\dalton_jones\my documents\visual studio projects\plc\plcprodreporting\test\bin\sapproxypack.dll', No symbols loaded.

'TEST.exe': Loaded 'c:\windows\assembly\gac\sap.connector\2.0.0.0__50436dca5c7f7d23\sap.connector.dll', No symbols loaded.

'TEST.exe': Loaded 'c:\windows\assembly\gac\system.web.services\1.0.5000.0__b03f5f7f11d50a3a\system.web.services.dll', No symbols loaded.

'TEST.exe': Loaded 'c:\documents and settings\dalton_jones\my documents\visual studio projects\plc\plcprodreporting\test\bin\sap.connector.dll', No symbols loaded.

'TEST.exe': Loaded 'c:\windows\assembly\gac\microsoft.visualbasic\7.0.5000.0__b03f5f7f11d50a3a\microsoft.visualbasic.dll', No symbols loaded.

'TEST.exe': Loaded 'c:\windows\assembly\gac\system.xml\1.0.5000.0__b77a5c561934e089\system.xml.dll', No symbols loaded.

'TEST.exe': Loaded 'c:\windows\assembly\gac\system.web\1.0.5000.0__b03f5f7f11d50a3a\system.web.dll', No symbols loaded.

'TEST.exe': Loaded 'oudjngdl', No symbols loaded.

An unhandled exception of type 'System.NullReferenceException' occurred in system.windows.forms.dll

Additional information: Object reference not set to an instance of an object.