User-defined API transactions

There are several ways of creating user-defined API transactions in M3 Business Engine, each of them with its own strengths. To decide which approach is the best, the characteristics for each program iare listed below:

  • CRS990MI

    Old structure, not to be used anymore.

  • MDBREADMI

    These transactions are created in program MRS010-MRS012 and allow you to create API transactions based on an existing table index. Due to the fact that the transaction is based on an existing table index, the performance is good. Only the defined output fields are read in the API which also have a positive impact on performance, that is, fewer output fields result in better performance (preferably fewer than 10 fields). This setup is recommended when there is no existing API and you want to list data from a single table.

  • CMS100MI
    These transactions are built upon an information browser category and defined in 'Custom List MI. Open' (CMS015). These transactions are therefore very flexible since you can include related tables, virtual fields, selection possibilities etc. The flexibility however comes with a performance cost; hence these API transactions are recommended when flexibility is key and the data volume is lower. Keep the number of related tables and virtual fields to a minimum, and avoid using virtual fields calling a M3 function unless you expect very few records in the result. It is recommended to use filters corresponding to the selected index (used sorting order).
    Note: If no existing table index that supports your selection fields exists, it is recommended to create a user-defined index to lessen the load on the database and increase performance.

    CMS100MI can return 10,000 records at most.

  • EXPORTMI

    This API transaction can list data from a single table and is based on SQL-like search query. The performance is related to how the search query is constructed, that is, a supporting index that improves performance.

    It is always recommended to:
    1. Specify the table index to be used and filters corresponding to this index. If no index is specified, the default 00-index is used. If filters are used that do not correspond to an index, performance is heavily impacted.
    2. Only specify the exact output fields to be returned since fewer fields improve performance (preferably fewer than 10 fields). Use this API when you want the output as a CSV file or flat file.

    EXPORTMI can return 10,000 records at most. An exception applies if you specify an index and additional filter values which returns more than 10,000 records.

Note: The APIs above also support tables created in XtendM3.

Authorization

The toolbox APIs adhere to normal M3 security for M3 company and divisions as well as facility and warehouse, when that exists as a field in the retrieved table.

The user must also be authorized to access the information to be retrieved, and to access tables based on the functions they are authorized to use. The mapping between function and table is performed in 'Table. Open' (MNS120).

This is an example of user authorization:

Browse program 'Item. Open' (MNS001) is connected to table MITMAS in (MNS120). A user who is authorized to functions (MMS001) can view all data in MITMAS. If user is not authorized to access (MMS001), you cannot access data in MITMAS.

However, there may be an exception to this rule for the CSYTAB table. In the case when the 'Auth indivd pgm' (AUIP) parameter in 'System Settings. Open' (MNS090) is set to 1-'Individual browse program', the browse program for CSYTAB in (MNS120) is ignored. Instead, the user must have authorization to the program where the specific data in CSYTAB is maintained. The 'Constant value' (STCO) field in the table is used to identify the various types of data and to which program a record belongs. Since the table is used by many programs for different purposes, this option is preferred from a security perspective but may require more function security setup.

This is an example of user authorization for CSYTAB:

A user who is authorized to function 'Country. Open' (CRS045)but not to 'Salesperson. Open' (CRS100) can access data with constant value Country (CSCD) but not with Salesperson (SMCD) in CSYTAB.