Skip to Content
Author's profile photo Former Member

Baby don’t you know my number … use enumerations in SBO

I have wondered many times why SAP Business One uses such a lot of numbers.
When a programmer wants to adress a certain form type, i.e. a sales invoice form, he/she must use a number in order to get it.

Typical numbers a programmer will learn first are “133,139,149 …”. These are the sales document form types.

I don’t know about you, but I personally have a really bad memory concerning numbers.
To me, writing down important telephone numbers is crucial, because I just cannot memorize them.
Usually, I tend to write them down on paper, ignoring Outlook and other technological mumbo jumbo.
This is done for the simple reason that my paper notes will never suffer a hard disk failure or a virus.

When phone numbers are concerned, I can still see the need why people memorize them. It is nice to have imortant information at hand.
Looking at SBO form types, I strongly felt (and still do) that there is no reason at all to learn these numbers by heart.
After all, noone is going to ask me could you give me the number of the order form, I need to give it a ring real quick.

That is why I got into using enumerations in my programs real quick – a bad memory for numbers.

SAP Business One comes with a number of built-in and ready to use enumerations. These include a form type enumeration, which you are using when evaluating the Pval.FormType variable.
In the SAP TechDemo Addon I created some more enumerations I thought useful.

Keeping track of your numbers
The most important enumeration is enSAPFormTypes, which you can see below.
It (will somewhen) contain all available SAP forms and in addition all the forms of all addons my company creates.
The TechDemo sample gives you the basic  idea. The enumeration is maintained in the base assembly which must be  inherited / used by all addons.
In this way, it prevents the existance of two forms with the same number between all addons I might write in future.
In addition, we will be able to provide a list of all formtypes we use to any other company which writes addons. In this way clashes between addons of other companies could be avoided.

And finally… I do not need to remember the numbers any more.
Use enumerations as well, they make life so much easier .

Lutz Morrien

Public Enum enSAPFormTypes As Integer
    sapSalesInvoice = 133
    sapBusinessPartner = 134 ‘Stammdaten Geschäftspartner
    sapCompanyDetails = 136 ‘Firmendaten
sapGeneralSettings = 138
    sapSalesOrder = 139 ‘Auftrag

‘Sbo TechDemo Forms


    ‘This part of the enumeration keeps track of all type numbers given to
    ‘ any new form in any addon you create
    STDWelcomeForm = 2000100000
    STDFormSimpleForm = 2000100001
    SDTFormUICalculator = 2000100002
    SDTFormToCome4 = 2000100003
End Enum


Assigned tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member
      Enumerations certainly work well when dealing with small to medium number of form types, for example those used within a single add-on project.

      However I found it doesn't scale very well to the whole product.  There are hundreds of different form types within the SAP Business One, and I find you get diminishing returns from defining them all as enumerated values.

      I currently have a list of around 350 form types & their titles, would this be of any use for your TechDemo?


      Author's profile photo Former Member
      Former Member
      Blog Post Author
      That would be great,
      I just included a couple in the Techdemo.

      I had to write a new enum, since the one furnished with SBO cannot be extended. (Or can it?).

      It would be great if you send it to me or even better post it on Http://


      Author's profile photo Former Member
      Former Member

      I've done a small VBA program that give the list of all the menus and their respective UID. I can have it in all Business One available language.

      As you know, it could be very useful to have them when you want to open a system form, using the ActivateMenuItem function

      for example, their are
      Module (UID 1509569)
      ----> Administration
      ------------>Choose Company (UID 3329)
      ------------>Define foreign currency exchange rates (UID 3333)
      ------------>System Initialization
      ------------------------>Company Details (UID 8193)
      ------------------------>General Settings (UID 8194)

      There are about 450 menus. Do you think it could be interesting to had them in your TechDemoAddOn.

      Let me know and I'll send it to you

      Author's profile photo Former Member
      Former Member
      Blog Post Author
      Thanks for sharing, Sébastien!

      I could definitely make use of that.

      I would use the us english name in order to set a standard everybody can relate to.

      I'd also be interested in the little prog, if you are willing to share that as well.

      My email is lutz.morrien[remove me and set AT]

      Thank you in advance,
      Lutz Morrien