Usina BRAdvPL Guide
Sign in
← All topics
PRACTICAL GUIDEUnder review

Numbering control with GetSxeNum, ConfirmSxe and RollbackSxe

Connects number reservation, confirmation and cancellation.

Numbering control with GetSxeNum, ConfirmSxe and RollbackSxeAdvPL
01 · OVERVIEW

Overview

GetSxeNum obtains a reservation for alias/field rather than a side-effect-free lookup. The selected index must place the field correctly after branch, and additional group/branch arguments have joint rules. TOTVS discourages direct use in field initializers. ConfirmSxe and RollbackSxe belong to the numbering lifecycle and must follow the actual write outcome. Public GETSXENUM.PRW only obtains and displays a number without completing that lifecycle: useful for recognizing invocation, not a complete workflow. Verify SX8 variants found in examples against the release. (TOTVS, n.d., refs. 1–3; EURAI, n.d., ref. 4)

03 · PRACTICAL EXAMPLE

Commented example

// Fragment: own reservation already obtained and caller write completed.
// lWriteConfirmed must reflect the actual outcome, not a visual choice.
If lWriteConfirmed
    ConfirmSxe(.T.)
Else
    RollbackSxe()
EndIf
Expected result

Illustrates both outcomes for an existing reservation. Not self-contained: requires reservation context, available API and caller error handling. Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

BEST PRACTICES
  • Never confirm a reservation from another flow. Test concurrency, cancellation and write failure; do not promise gap-free numbering universally.
  • Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

Related content

REFERENCES
  1. TOTVS. GETSXENUM(). TDN. Accessed on 2026-10-26.
  2. TOTVS. CONFIRMSXE(). TDN. Accessed on 2026-10-26.
  3. TOTVS. ROLLBACKSXE(). TDN. Accessed on 2026-10-26.
  4. EURAI. GETSXENUM.PRW. universo_do_desenvolvedor_site, commit a5c83e9490302bdb4a0fc5a9d92c2d569a60773c. Exemplo analisado. Accessed on 2026-10-26.
Status
Under review
Page created on
Last reviewed on
Original language
Portuguese
Reviewed by
Usina.BR
0 approved comment(s)

Comments

There are no approved comments yet.

Sign in with Google or Microsoft to comment.

Powered by Usina Docs · Alpha