on 04-23-2013 2:45 PM
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
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, } catch (Exception ex) { return; } } |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
Hi David,
right. But that's the way how the layers below RFC are currently built - only blocking IO.
Best regards,
Markus
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
Hi , in my applications I generally use pool of BackgroundWorker to execute this calls on another thread.
Yarden
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.