M3 Company and Division
M3 API calls use the M3 Settings for the Company (CONO) and Division (DIVI) configurations.
Sequence overview
Follow these guidelines:
-
Place an M3 Settings function before the M3 API call.
-
Set the desired Company and Division by assigning variables to the Company and Division parameters.
-
Instead of using variables you can also, for example, use input elements containing the Company and Division.
All succeeding API calls will use the Company and Division as set by the M3 Settings function.
You can use another M3 Settings function later in the sequence to change Company or Division again, if needed.
Use inside a loop
If you use an M3 Settings function inside a loop that is controlled by a repetitive M3 API, the data from the M3 API controlling the loop is fetched using the Company and Division set when entering the loop. It will not use the Company and Division set by the M3 Settings function inside the loop. This is because the actual API call for the loop is only executed once, when entering the loop.
If you execute an M3 Settings function inside a loop in the first iteration, but not in the succeeding iterations, the Company and Division that is set by the M3 Settings function in the loop will be used. This Company and Division set will be used for all succeeding M3 API calls in the loop, that is, even for iteration two, three, and more. It will also be used for all succeeding M3 API calls after the loop.
Use of default values
If you want to use default Company and Division values as defined by EC control properties, API reference parameters, or the setting in MNS150, do so by specifying null
values for both Company and Division, for example, use the widget and do not map anything to the input parameters.
This action may be necessary for these events:
-
If you dynamically change the Division using the M3 Settings function to fetch data from several M3 Divisions, and then you want to go back to the original settings as defined by EC control properties, API reference parameters, or the setting in MNS150 for the last API call.
-
If you want to use default Company or Division values as defined by EC control properties, API reference parameters, or the setting in MNS150 for all M3 API calls in the mapping. In this event, you do not need to use the M3 Settings function.
Variable values
Use the String data type for Company and Division variable values. String values must be enclosed in "" (double quotation marks), for example, "123"
. Even if Company is an integer value, use double quotation marks. If Division is specified, Company must also be specified, or else a runtime error will occur. In the case where only Company is specified, the default "blank" Division will be used.
-
Company must be an integer value between 0 and 999.
The parameter value can be max length 3 characters and is trimmed before the integer check.
So, "1", " 1 ", " 1", " 01", and "001", are all valid companies and will be used when establishing a new API connection to M3.
-
Division must be an alphanumerical value with max length 3.
The parameter value is not trimmed.
The default value is an empty string ("").
So, "A", "A ", "A ", " A " and " A", are different divisions in M3 and will be used as is, including leading blanks, when establishing a new API connection to M3.