cancel
Showing results for 
Search instead for 
Did you mean: 

Async RFC call using NCo 3.0 ?

Former Member

Hello,

In NCo 2.0 there use to be  BeginSAPInvoke("" ) {} and EndSAPInvoke() {} methods generated by design time.

How do we achieve the same with NCo 3.0 ? Can't find any section about async programming in Programming guide.

cheers

Jitesh

Accepted Solutions (1)

Accepted Solutions (1)

former_member197445
Contributor
0 Kudos

More information, including the example below can be found at this SAP Help Page.  The example provided is somewhat oversimplified, but it should get you started.  To make a long story short, the asynch approach uses standard .NET functionality, not methods baked into the .NET Connector.  The example would be helpful for a Windows Forms client application.  But if you were doing it for a web app, you could use web methods and jquery $.post functions to accomplish the same type of asynchronous call.

Hope that helps.

Example:

The following sample shows the code for asynchronous method call.


private void SAPAsyncSearch()


/* this routine calls RFC_CUSTOMER_GET using .NET asynchronous

* method invocation. When the function is completed asynchronously in SAP,

* the function "myfunction" is called.
*/


SAPConnect();

myAsyncState = null;

myCallback = new System.AsyncCallback(myFunction);


asyncresult = null;

try

{

asyncresult = proxy.BeginRfc_Customer_Get(g_custNo, g_custName, ref brfcknA1Table1,
myCallback, myAsyncState);

}

catch (Exception ex)

{

return;

}


}

Former Member
0 Kudos

Wonder why would these functions has been discontinued?

Thank you for the information though.

Former Member

Dear Case,

this example is for SAP Net Connector 2.0. Not for NCo 3.0 ...

I'm looking for a way to implement async calls with NCO 3.0 too.

Marius

Answers (3)

Answers (3)

MarkusTolksdorf
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi David,

right. But that's the way how the layers below RFC are currently built - only blocking IO.

Best regards,
Markus

MarkusTolksdorf
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello Jitesh,

in .NET Connector 3.0 there is no specific method for supporting asynchronous RFC invocations. However, you could do this on your own by simply running the function module invocation in some other thread as already suggested by Yarden.

Best regards,

Markus

david_burg
Participant
0 Kudos

Hello Markus,

Assuming that .NET Connector will be I/O bound we'll be ~wasting a CPU thread as there is no processing it can do while waiting for the I/O completion. For server application / services where our enterprise customers expect to run hundreds if not thousand transactions per minute, we'd rather not create as many threads as request we are concurrently processing. For more details -> https://docs.microsoft.com/en-us/dotnet/standard/async-in-depth#deeper-dive-into-tasks-for-an-io-bou...

With regards,

David.

Former Member
0 Kudos

Hi , in my applications I generally use pool of  BackgroundWorker to execute this calls on another thread.

Yarden