• Introducing Dark Mode! Switch by clicking on the lightbulb icon next to Search or by clicking on Default style at the bottom left of the page!

Transaction Processing (TP) Boundary defined at the BSFN Level (instead of UBE/APPL)

BOster

Legendary Poster
Is it possible to initiate a transaction and define a transaction boundary at the BSFN level and extend it to called BSFNs?

I know I can use JDEDB_COMMIT_MANUAL and JDB_CommitUser/JDB_RollbackUser for DB updates within a single BSFN but I would like to start a TP inside of a BSFN and extend that transaction boundary to other called BSFNs much the same way I would from a UBE or from an APPL and any user handles opened with JDEDB_COMMIT_AUTO would operate within that TP just like they do with UBE/APPL transactions.

The following APIs in jdekprto.h look like they might do something like that, but I can't find any pristine examples where they are used.

KRNL_RTN(JDEDB_RESULT) JDEWINAPI JDB_BeginTransaction(HUSER);
KRNL_RTN(JDEDB_RESULT) JDEWINAPI JDB_CommitTransaction(HUSER);
KRNL_RTN(JDEDB_RESULT) JDEWINAPI JDB_RollbackTransaction(HUSER);
KRNL_RTN(JDEDB_RESULT) JDEWINAPI JDB_CancelUserTransaction(HUSER);
 

jdelisths

Reputable Poster
Hi Brian,

Here is how you can do it:

// create HUSER with manual commit
JDB_InitUser(hEnv, &hUser (JCHAR *)NULL, JDEDB_COMMIT_MANUAL);

// set the hUser before you call jdeCallObject
lpBhvrCom->lpObj->lpGlobalApp->lpTrxnProcessingHuser = hUser;
lpBhvrCom->lpObj->lpGlobalApp->cIncludeInParent = _J('1');


// call bsfns here ..
// jdeCallObject

// commit or rollback
//JDB_CommitUser(hUser);
//JDB_RollbackUser(hUser);

// free user
JDB_FreeUser(hUser);


Hope this helps.
 

BOster

Legendary Poster
Thanks, that does help a lot. I will have to give it a try. I assume I should set the lpBhvrCom values back to what they were after making the jdeCallObject calls?
 

BOster

Legendary Poster
Hari,
Just a follow up. Implemented your solution and it appears to work just fine. TP boundary gets extended to called BSFNs and all their children, etc. This allowed me to accomplish a couple of things w/o using built in APPL TP.

1. Implemented TP on a row exit on a power browse (which, I believe, doesn't support TP).
2. I have a mix of functions that need to write to tables immediately (outside the transaction) and other functions which need to be committed as a single transaction.

Thanks again.
 
Top