cancel
Showing results for 
Search instead for 
Did you mean: 

.NET Connector strange beavior

elko_hasse
Participant
0 Kudos

When i use the SAPLogonDestination class to logon to SAP, I only get data back from function module call if the trace property is set to "true".

Why this beavior?

When Trace = false -> no data back and the following error: "Index and length must refer to a location within the string."

When I use the Destination object it works fine with trace = false.

Bug ??????

elko

Accepted Solutions (0)

Answers (1)

Answers (1)

reiner_hille-doering
Active Contributor
0 Kudos

Can you please post the complete call stack when the exception happens?

elko_hasse
Participant
0 Kudos

Thanks for the fast replay.

Here the call stack from Visual Studio:

<STACK>

[<Non-user Code>]

>sapproxy.dll!SAPProxy.SAPProxy.Rfc_Customer_Get(string Kunnr = "", string Name1 = "*", SAPProxy.BRFCKNA1Table Customer_T = {SAPProxy.BRFCKNA1Table}) Line 64 + 0x4b bytes C#

SAPconnectorClient.exe!SAPconnectorClient.frmForm.cmdSearch_Click(Object sender = {System.Windows.Forms.Button}, System.EventArgs e = {System.EventArgs}) Line 173 + 0x4b bytes Basic

[<Non-user Code>]

SAPconnectorClient.exe!SAPconnectorClient.frmForm.Main() Line 3 + 0x1d bytes Basic

</STACK>

Is this what you want/need ?

I am using VB.NET.

elko

Message was edited by: Elko Hasse

reiner_hille-doering
Active Contributor
0 Kudos

Please turn on "Show Non-user code" (right-click in the Callstack window).

elko_hasse
Participant
0 Kudos

Sorry, here all of the code:

<stack>

mscorlib.dll!System.String.Substring(int startIndex = 77, int length = 2) + 0x108 bytes

sap.connector.dll!SAP.Connector.SAPConnection.Open() + 0xa3 bytes

sap.connector.dll!SAP.Connector.SAPClient.RfcInvoke(string method = "Rfc_Customer_Get", System.Object[] methodParamsIn = {Length=3}) + 0xe1 bytes

sap.connector.dll!SAP.Connector.SAPClient.SAPInvoke(string method = "Rfc_Customer_Get", System.Object[] methodParamsIn = {Length=3}) + 0x3a bytes

> sapproxy.dll!SAPProxy.SAPProxy.Rfc_Customer_Get(string Kunnr = "", string Name1 = "*", SAPProxy.BRFCKNA1Table Customer_T = {SAPProxy.BRFCKNA1Table}) Line 64 + 0x4b bytes C#

SAPconnectorClient.exe!SAPconnectorClient.frmForm.cmdSearch_Click(Object sender = {System.Windows.Forms.Button}, System.EventArgs e = {System.EventArgs}) Line 173 + 0x4b bytes Basic

system.windows.forms.dll!System.Windows.Forms.Control.OnClick(System.EventArgs e = {System.EventArgs}) + 0x5e bytes

system.windows.forms.dll!System.Windows.Forms.Button.OnClick(System.EventArgs e = {System.EventArgs}) + 0x33 bytes

system.windows.forms.dll!System.Windows.Forms.Button.OnMouseUp(System.Windows.Forms.MouseEventArgs mevent = {System.Windows.Forms.MouseEventArgs}) + 0x133 bytes

system.windows.forms.dll!System.Windows.Forms.Control.WmMouseUp(System.Windows.Forms.Message m = {System.Windows.Forms.Message}, System.Windows.Forms.MouseButtons button = Left, int clicks = 1) + 0x261 bytes

system.windows.forms.dll!System.Windows.Forms.Control.WndProc(System.Windows.Forms.Message m = {System.Windows.Forms.Message}) + 0x49b bytes

system.windows.forms.dll!System.Windows.Forms.ButtonBase.WndProc(System.Windows.Forms.Message m = {System.Windows.Forms.Message}) + 0x121 bytes

system.windows.forms.dll!System.Windows.Forms.Button.WndProc(System.Windows.Forms.Message m = {System.Windows.Forms.Message}) + 0x85 bytes

system.windows.forms.dll!ControlNativeWindow.OnMessage(System.Windows.Forms.Message m = {System.Windows.Forms.Message}) + 0x13 bytes

system.windows.forms.dll!ControlNativeWindow.WndProc(System.Windows.Forms.Message m = {System.Windows.Forms.Message}) + 0xda bytes

system.windows.forms.dll!System.Windows.Forms.NativeWindow.DebuggableCallback(int hWnd = 462486, int msg = 514, int wparam = 0, int lparam = 1048636) + 0x3d bytes

system.windows.forms.dll!System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods+IMsoComponentManager.FPushMessageLoop(int dwComponentID = 1, int reason = -1, int pvLoopData = 0) + 0x349 bytes

system.windows.forms.dll!ThreadContext.RunMessageLoopInner(int reason = -1, System.Windows.Forms.ApplicationContext context = {System.Windows.Forms.ApplicationContext}) + 0x1f3 bytes

system.windows.forms.dll!ThreadContext.RunMessageLoop(int reason = -1, System.Windows.Forms.ApplicationContext context = {System.Windows.Forms.ApplicationContext}) + 0x50 bytes

system.windows.forms.dll!System.Windows.Forms.Application.Run(System.Windows.Forms.Form mainForm = {SAPconnectorClient.frmForm}) + 0x34 bytes

SAPconnectorClient.exe!SAPconnectorClient.frmForm.Main() Line 3 + 0x1d bytes Basic

</stack>

Thanks,

elko

reiner_hille-doering
Active Contributor
0 Kudos

I have checked the code. It seems that in your situation you connection string ends with "LANG=" and then a nothing or only a single character. Likely you specified a language like "e" instead of "en". The code is currently not safe for this. If you have Trace turned on, you will have something behind the "LANG=e" so it would hide the problem.

Anyway we have to fix it for the future, but you can easily workaround.

elko_hasse
Participant
0 Kudos

Hi,

thanks for your reply. It works ! I just use the two char language code.

I was a little confused by the help text in the property window of VS.net for the property "language" of the SAPlogonConnection control. That made me use the 1 char langu code.

elko