Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

219
Views
.Net SAP Transaction restart from client

I'm using .Net NCo 3.0 library and I tried one example of tRFC wherein I see the transaction ID is created and associated with the RFC function and then invoked, after a successful transaction, the transaction ID is deleted, here we maintain the Transaction details in database for each tRFC operation, so, in this case, if the transaction fails, we can get the ID from the database and we can try again, I would like to know the code implementation of retry mechanism, there is a possibility that the SAP server is down, so when and how to restart and make sure that the transaction initiated is executed only once, no loss of data and no duplication.

TidStore tidStore = new TidStore("clientTidStore", false);

 static RfcTransaction CreateTransaction(TidStore tidStore, out string data)
        {
            RfcTransaction trans = new RfcTransaction(); // This creates a fresh TID.;
            Console.Write("Please enter some input data: ");
            data = Console.ReadLine();

            FileStream dataFile = new FileStream(trans.Tid.TID, FileMode.Create, FileAccess.ReadWrite);
            byte[] utf8Data = Encoding.UTF8.GetBytes(data);
            dataFile.Write(utf8Data, 0, utf8Data.Length);
            dataFile.Close();
            tidStore.CreateEntry(trans.Tid.TID);
            return trans;
        }

        private void SubmitTransaction(RfcTransaction trans, TidStore tidStore, String data)
        {
            try
            {
                IRfcTable dataTable = stfc_write_to_tcpic.GetTable("TCPICDAT");
                dataTable.Append();
                dataTable.SetValue(0, data);

                // Insert the function module into the transaction:
                trans.AddFunction(stfc_write_to_tcpic);
                stfc_write_to_tcpic = (IRfcFunction)stfc_write_to_tcpic.Clone();
                dataTable = stfc_write_to_tcpic.GetTable("TCPICDAT");
                dataTable.SetValue(0, data + " -- data of the second function module");
                trans.AddFunction(stfc_write_to_tcpic);
                trans.Commit(_ECCsystem);
                tidStore.SetStatus(trans.Tid.TID, TidStatus.Committed, null);

                File.Delete(trans.Tid.TID);
                _ECCsystem.ConfirmTransactionID(trans.Tid);
                tidStore.DeleteEntry(trans.Tid.TID);
            }
            catch (Exception e)
            {
                tidStore.SetStatus(trans.Tid.TID, TidStatus.RolledBack, e.Message);
            }
        }
    }
}
    
over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

You need to create your own function with a time interval to check which TID's are not yet processed.

over 4 years ago · Santiago Trujillo Report

0

With regard to deal with and to implement SAP transaction handling at external program side, there are some general explanations in the SAP NetWeaver RFC SDK 7.50 Programming Guide which are quite helpful, I think. Please see chapters 4.3, 4.4 and 5.5. It is more detailed than what is explained in the SAP .NET Connector 3.0 Programming Guide and it can easily be adapted to the NCo programming APIs as well.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!