I tried to execute two BAPI calls using the SAP BAPI activity within a single sequence:
- BAPI_SALESORDER_CREATEFROMDAT2
- BAPI_TRANSACTION_COMMIT
Both calls were executed successfully without any errors, but the data was not saved in SAP. Not sure what is causing the issue.
However, when I used the same BAPI calls via SE37 with the same SAP account, the data was successfully captured in the database after the commit.
Input:
Output
Connection:
Activities:

Hi @Foreverlearning
If you can register data in SE37, I don’t see a problem with the content.
SAP Application Scope and sessions are two different things.
SAP Application Scope is only supposed to be able to take over authentication information.
Therefore, the current specification, which makes the session separate for each activity, cannot be handled.
At this time, we know of no other way than to use InvokeCode to execute “BAPI_SALESORDER_CREATEFROMDAT2” and “BAPI_TRANSACTION_COMMIT” in the same session.
I can give you the InvokeCode sample code if you want it.
Thanks for the explanations. Yes! Could you share the InvokeCode sample?
Hi @Foreverlearning
After installing SAPActivity as a prerequisite.
Import SAP.Middleware.Connector into your namespace.
//Connection
SAP.Middleware.Connector.RfcConfigParameters cfgParams = new SAP.Middleware.Connector.RfcConfigParameters();
cfgParams.Add("NAME", "Test");
cfgParams.Add("ASHOST", "XXXXXXX");
cfgParams.Add("CLIENT", "XXX");
cfgParams.Add("USER", "XXXXX");
cfgParams.Add("PASSWD", "XXXSX");
cfgParams.Add("LANGUAGE", "XX");
Destination = SAP.Middleware.Connector.RfcDestinationManager.GetDestination(cfgParams);
RfcFunction_SalesOrder = Destination.Repository.CreateFunction("BAPI_SALESORDER_CREATEFROMDAT2");
RfcFunction_Commit = Destination.Repository.CreateFunction("BAPI_TRANSACTION_COMMIT");
/*
//Fill in the data
SAP.Middleware.Connector.IRfcTable RfcTable = RfcFunction_SalesOrder.GetTable("ORDER_ITEMS_IN");
RfcTable.Append();
RfcTable.SetValue("ORDER_ITEMS_IN",[TableData]);
SAP.Middleware.Connector.IRfcStructure RfcStructure = RfcFunction_SalesOrder.GetStructure("ORDER_HEADER_IN");
RfcStructure.SetValue("ORDER_HEADER_IN",[StructureData]);
RfcFunction_SalesOrder.SetValue([ValueNAME],XX)
*/
//BAPIExcute
SAP.Middleware.Connector.RfcSessionManager.BeginContext(Destination);
RfcFunction_SalesOrder.Invoke(Destination);
RfcFunction_Commit.Invoke(Destination);
SAP.Middleware.Connector.RfcSessionManager.EndContext(Destination);