Skip to Content
author's profile photo
Former Member

sap.net connector error

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.

Add comment
10|10000 characters needed characters exceeded

1 Answer

  • Posted on Feb 22, 2005 at 04:40 PM

    Hi!

    When you enter an example in SE37, some field conversion exits are active.

    In your example base_unit_qty will be translated from english PC to database format ST (german :-).

    Try to use ..._iso and PCE (or something like that), than you are language independent.

    Same is valid for material number, if you have values without character -> use CONVERSION_EXIT_ALPHA_INPUT for translation.

    Regards,

    Christian

    Add comment
    10|10000 characters needed characters exceeded