on 08-30-2016 11:47 AM
Hi,
I'm developing an application with some calls to function modules on SAP. The function modules which just one call without need to encapsulate between a beginContext and endContext works fine, but when I need to call a function module that need to call before it's execution to another function call, for example BAPI_TRANSACTION_COMMIT, and needs to execute with beginContext/endContext it works fine but the next call after that everytime fails:
This works ok:
RfcRepository rfcRepository = rfcDestination.Repository;
IRfcFunction rfcFunction = rfcRepository.CreateFunction("ZCAU_LOG_000557");
rfcFunction.SetValue("MATERIAL", idMaterial);
rfcFunction.SetValue("CENTRO", centro);
rfcFunction.SetValue("ALMACEN", almacen);
rfcFunction.Invoke(rfcDestination);
result = rfcFunction.GetDecimal("STOCK");
This works ok, but after this the next call fails.
RfcRepository rfcRepository = rfcDestination.Repository;
IRfcFunction rfcFunction = rfcRepository.CreateFunction("BAPI_GOODSMVT_CREATE");
RfcSessionManager.BeginContext(rfcDestination);
rfcFunction.Invoke(rfcDestination);
IRfcTable result = rfcFunction.GetTable("RETURN");
IRfcFunction rfcFunctionCommit = rfcRepository.CreateFunction("BAPI_TRANSACTION_COMMIT");
RfcSessionManager.EndContext(rfcDestination);
The next call after this returns the following message:
SAP.Middleware.Connector.RfcCommunicationException: Connection with convid [64494310] was canceld, closed or broken.
Then the next call works fine again.
Anyone can help me?
Thanks!
In general you may want to enable tracing, look into the trace logs. On the SAP side look into the ST22.
Is the above code complete? Seems you do not invoke the rfcFunctionCommit.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
95 | |
11 | |
10 | |
9 | |
9 | |
7 | |
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.