biuan SAP® BUSINESS ONE SDK
API Company / DTC Transaction Object

Description

This interface supports Distributed Transactions for MS-SQL database that are controlled by MS-DTC engine (Microsoft Distributed Transaction Coordinator).

DTC is a system service that coordinates transactions so that work can be committed as an atomic transaction even if it spans multiple resource managers on multiple computers, regardless of failures.

This interface is applicable for the following environment:

  • MS-SQL database server
  • C/C++ interface
  • ODBC connection type
  • DI API only (and not by DI Server)

Property type

Read-write property

Syntax

Visual Basic
Public Property DTCTransactionObject() As Unknown

Remarks

Usage
  1. Create a distributed transaction object externally to the application using the DTC interface.

    GetDTCInterface (&g_pTransactionDispenser);
    g_pTransactionDispenser->
    BeginTransaction(NULL, ISOLATIONLEVEL_ISOLATED, ISOFLAG_RETAIN_DONTCARE, NULL, (::ITransaction**)&g_pTransaction);
  2. The DI COM module receives a handle to a live transaction that is created by the MS-DTC.

    ICompanyPtr pCmp; pCmp->put_DTCTransactionObject (g_pTransaction);
  3. The DI performs a validation of the transaction object by verifying its Isolation Level. After the validation succeeds, the DB module is notified that the current transaction is an outside object and managed externally.
  4. The transaction process is performed as usual, and the change in the flow is transparent to the user. During a DTC Transaction, do not call StartTransaction() and EndTransaction(), otherwise the system returns an error.
  5. To end the DTC transaction, assign a NULL value to the DTC Transaction handle:

    pCmp->put_DTCTransactionObject (NULL);
  6. To get the current DTC handle that is set in SAP Business One, call:

    IUnknown* ptr = NULL;
    HRESULT hr = pCmp ->get_DTCTransactionObject(&ptr);
  7. To check whether a DTC Transaction is set, call:

    bool isDTCSet;
    pCmp->IsDTCTransactionObjectSet(&isDTCSet);
Notes
  • In case an operation fails during a DTC transaction, SAP Business One performs a rollback, which forces other systems under the same distributed transaction to rollback.
  • The DTC transaction scope (the Begin/End user transaction equivalent) is determined by the calls to put_DTCTransactionObject ().
    As long as there is a transaction object set, every operation is performed under this transaction context. It is the Client's responsibility to make sure a valid DTC transaction is assigned, and to assign NULL value when the DTC transaction ends.
  • StartTransaction() and EndTransaction() must not be called during a DTC Transaction.
  • put_DTCTransactionObject () must not be called during a live user transaction.

See Also

Related information


Get Company Service GetCompanyService Service
Creates a new CompanyService.
   Parent: Company Company Object

Progress Indicator ProgressIndicator Event
Progress indicator for long process execution. To be supported in future releases.
   Parent: Company Company Object

Company Service CompanyService Service
The CompanyService enables to manage the company administration data. This includes the following tables: Administration data - OADM (AdminInfo object). Company data -  CINF (CompanyInfo object). Posting Periods - OACT (ChartOfAccounts...
   Parent: Company Company Object

User Tables UserTables Collection
UserTables is a collection of UserTable objects.
   Parent: Company Company Object

Authenticate User Results Enum AuthenticateUserResultsEnum Enumeration
The check results of the username and password.
   Parent: Company Company Object

Bo Data Server Types BoDataServerTypes Enumeration
Database server types.
   Parent: Company Company Object

Bo Supp Langs BoSuppLangs Enumeration
Defines the current resource language. Note: The languages marked with * (asterisk) are country-specific only.
   Parent: Company Company Object

Bo Xml Export Types BoXmlExportTypes Enumeration
Defines the type for exporting an object to XML.
   Parent: Company Company Object

Company Company Object
Company is the primary DI API object that represents a single SAP Business One company database. This object enables you to connect to the company database and to create business objects to use with the company database.



SAP® Business One is the trademark(s) or registered trademark(s) of SAP AG in Germany and in several other countries. Contact
This website is not affiliated with, maintained, authorized, endorsed or sponsored by SAP AG or any of its affiliates