SharpSapRfc icon indicating copy to clipboard operation
SharpSapRfc copied to clipboard

Cannot create invoices when using BAPI transactions

Open kawazoe opened this issue 7 years ago • 3 comments

I am trying to create an invoice in SAP using the BAPI_ACC_DOCUMENT_POST function. The call goes through correctly and I get a valid document id from the response but the invoice never appears in SAP. This is expected since we use BAPI transaction. This mean that I need to call BAPI_TRANSACTION_COMMIT once I am done creating my document. The final code looks something like this:

var result = _connection.ExecuteFunction(new CreateInvoiceFunction(invoiceDto));
_connection.ExecuteFunction("BAPI_TRANSACTION_COMMIT");

return result;

Even then, the invoice does not appear in SAP. We looked at the SAP traces and we see both functions called correctly. This works when using the SAPNCo library directly. I also tried to wrap both calls in a BeginContext and EndContext using the RfcSessionManager class but it also didn't changed anything.

Any idea of what might be causing this?

kawazoe avatar Nov 08 '16 20:11 kawazoe