cancel
Showing results for 
Search instead for 
Did you mean: 

Update not working

Former Member
0 Kudos

Hello All,

I'm using .NET connector over RFC to invoke a update BAPI (Z_CRM_XXX) within the CRM. The BAPI is invoked successfully but the record does not get updated with the value i pass as input. The value i'm passing as input is of type decimal and in the proxy it is mapped to ABABP RAW_BCD of length 14. THere is no exception thrown and the BAPIReturn table does not contain any messages. THe code executes successfully but when you look at the BAPI table it does not contain the new value. I'm calling CommitWork as well. I'm trying to update only one value in one table. All other tables passed as parameters contains nothing. When i run the same BAPI using SAPGUI it works and updates the value successfully. I looked at the SQL trace on SAP server when executing thro .NET and looks like the Update's are being called but it uses the existing value and not the new one that is passed in. Any idea's what may be causing this behavior? THe BAPI just requires the first parameters and all other parameters are optional.

Here's the code snippet

Try

Dim It_0 As New SAPConnectorProxy.ZCS_XXXTable

Dim It_MyCS As SAPConnectorProxy.ZCS_XXX

Dim It_1_H As New SAPConnectorProxy.Z_XXXTable

Dim It_2 As New SAPConnectorProxy.ZS_XXXTable

Dim It_3 As New SAPConnectorProxy.ZST_XXXTable

Dim It_4_Consulting As New SAPConnectorProxy.ZEXT_XXXTable

Dim It_5 As New SAPConnectorProxy.ZEXT_XXXTable

Dim It_6 As New SAPConnectorProxy.ZXXXXXXXXXTable

It_MyCS = It_0.CreateNewRow()

Dim Amt As Decimal

Amt = 99

It_0.XXXXXXXX = Amt

It_0.Add(It_MyCS)

Dim Destination1 As New SAP.Connector.Destination()

'

'Destination1

'

Destination1.AppServerHost = "XXX.XXX.XXXX.XXXX.com"

Destination1.Client = XXX

Destination1.Language = "XX"

Destination1.Password = "XXXXXXX"

Destination1.SystemNumber = X

Destination1.Username = "XXXXXXXX"

sapProxy1.Connection = SAP.Connector.Connection.GetConnection(Destination1)

sapProxy1.ZCrm_XXXXXXXX(Me.TextBox1.Text, It_0, It_1, It_2, It_3, It_4, It_5, It_6)

Dim flag As Boolean

flag = sapProxy1.CommitWork()

Catch ex As RfcAbapException

Throw

Catch ex As Exception

'TextBox3.Text = ex.ToString

'TextBox3.Visible = True

Throw

Finally

sapProxy1.Dispose()

End Try

Thanks for your help

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Narayanan,

If you have typed the entire code here in post then it might be a typo but let me just point out-

>>It_MyCS = It_0.CreateNewRow()

>>Dim Amt As Decimal

>>Amt = 99

>>It_0.XXXXXXXX = Amt

>>It_0.Add(It_MyCS)

I think you should be setting the value of table row variable and not in table -

It_MyCs(columnIndex/Name) = Amt

And not lt_0.xxxxx = Amt

Secondly, have you tried to setting the external breakpoints in BAPI and see what values it is receiving.

Regards.

Former Member
0 Kudos

Hello Jitesh,

Yeah, that was a typo. I verified it and i have set the value correctly. No, i haven;t tried setting external breakpoint. Any direction/documentation on how to do it will be helpful. Also today i tried to set a string value instead of a decimal and the string value gets updated correctly. So the issue is now isolated to updating decimal values through .NET connector.

Has anyone tried invoking an update BAPI through VB.NET (.NET connector) to update a decimal value within a CRM table? The .NET connectory proxy generated code maps ABAP RAW_BCD to VB.NET Decimal data type. So i set the value as VB decimal data type and pass it as input. However, CRM tends to ignore that value. Any ideas on how to pass decimal values to CRM through VB.NET (.NET Connector)?

Thanks

Narayanan

Former Member
0 Kudos

Hi Narayanan,

I am not aware of any known problem with decimal datatype as never faced any.

However, I would suggest you to put a external breakpoint in BAPI to see what value it is receiving from .NET application.

Just login into SAP GUI. Run SE37 transaction. Type the name of BAPI. Go to the source code, click on the line of code you want to set breakpoint. Then from the toolbar menu either click on the External Breakpoint icon or from Top menu go to "Utilities->External Breakpoints."

Now run the VB .NET application in debug mode. When the execution hits the breakpoint in BAPI you can check the values of parameters by just clicking on them inside the code.

Do let me know what value do you see there.

And thank you for the "helpful answer point"

Regards.

Former Member
0 Kudos

We debugged the BAPI last night through VB.NET. We checked the tables in which we populate the decimal and string values. We could see the string values but not the decimal ones. So we are passing it correctly through VB.NET but the BAPI ignores it for some reason. I'm suspecting its a marshalling issue.

Has anyone in the forum tried to pass a decimal value to a BAPI invoked from VB.NET using .NET connector? I would like to hear how it was achieved. I know of similar issues with Byte array as well.

Answers (0)