Additional Blogs by Members
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member
0 Kudos

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


 

4 Comments