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
.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"
proxyme = New SAPProxyPack.SAPProxy1
proxyme.Connection = New SAP.Connector.SAPConnection(SAPDestination)
Call proxyme.Bapi_Hu_Pack("12345", baphuprop, baphuhead, bapItem, bapret2, bapserial)
'Me.DataGrid1.DataSource = bapret2.ToADODataTable
Catch ex As Exception