Usina BRAdvPL Guide
Sign in
← All topics
FUNCTIONUnder review

GETSXENUM()

GetSXENum(cAlias,cCampo,[cAliasSXE],[nOrdem],[cGroup],[cBranch])

Obtains sequential numbering from SXE/SXF or the numbering server.

GETSXENUM()AdvPL
01 · OVERVIEW

Overview

Alias and field are required; index order, control alias and company group/branch are optional. Default order 1 requires the numbered field immediately after branch. Group and branch take effect when supplied together. TOTVS discourages direct default-initializer calls because numbers can be reserved outside inclusion. (Sources: refs. 1–1.)

02 · SYNTAX

Syntax

GetSXENum(cAlias,cCampo,[cAliasSXE],[nOrdem],[cGroup],[cBranch])

Parameters

cAlias
CharacterRequired

Numbered alias.

cCampo
CharacterRequired

Numbered field.

03 · PRACTICAL EXAMPLE

Commented example

#Include "Protheus.ch"

User Function Ed474()
    // Block not executed: reservation requires confirmation or release workflow.
    Local bReserve := {|cAlias,cField,nOrder| GetSXENum(cAlias,cField,,nOrder)}
    ConOut(ValType(bReserve))
Return Nil
Expected result

Prepares a block without consuming numbers; this is not a full insertion workflow. Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

BEST PRACTICES
  • Tie reservation confirmation or rollback to the actual operation outcome; obtaining a number alone does not justify confirmation.
  • Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

Related content

REFERENCES
  1. TOTVS. GETSXENUM%28%29. TDN. Accessed on 2026-10-27.
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