Now that we have an information category with a view and a sorting order (with the desired sorting option), we have what we need to create an API.  To do so, we must start CMS015. There we will choose to create a transaction ID called LstMCHEADU2.  Note that you can call the transaction whatever we like, so long as the first characters in the name are “Lst”. We can then join the transaction with the information category that we have just created.

M3 custom list open

The view for CMS015/E is then extended, and we are presented with additional options:

M3 custom list open

Now Comes the Fun Part - You Get to Define Your API

First, your sorting option. Since in our example we wanted to filter by facility and costing type, we need to select your sorting order with the sorting option where these two fields were the first keys. We must also select the view that we made to make sure we get the desired output.

Once we have selected our sorting order, we can then move to the filter control options.  The “No. filters” field will determine just which fields we can filter by. Note that the number of filters and which fields are determined by the sorting option of the sorting order that we chose to use.  That’s why it was so important to create a sorting option with the key fields with the proper sequence.

Since in this example we only want to filter by facility and costing type, you can choose option “2-Facility, Cstng type”.  But just for our consideration, had we chosen option “3-Facility, Cstng type, Item number”, we would also be able to filter on item number, i.e. we would have to provide a single item number and not be able to show the costing of any other items.  However, for our purposes this would too restrictive, so we stop at “2-Facility, Csting type”.

How to Filter by Item Number or Costing Date

But how do we get to filter by item number or costing date?  After all, we did not select a filter-option where these fields were available…

By using a selection field!  When we choose a field as selection field, that field is then added as an optional range filter for the API, which is exactly what you want for both item number (KOITNO) and costing date (KOPCDT). To do this, we simply enter the relevant fields in “Selection fld 1” and “Selection fld 2”.

Please note that only fields in the master table can be used as selection fields in CMS015 (or filters in general). In our example, the master table is MCHEAD, so we would only be able to use fields from that table, and not any fields from the joined tables (MITMAS and MITFAC).

We now have our API!

But before we add it to the MI-repository, we can simulate it in CMS100. To do this, simply chose option 11-Simulate list in CMS015/B1, and we are taken to CMS100 where we can play around with our API.  In CMS100 we can add different values to the filters to see how the API will work and are also able to change the design of the API on the fly.

Perhaps we would like to see how the API will behave using a different number of filters?  Maybe we want to add another selection field?  Or maybe we want to try a completely different sorting option or view?  Here we can try it out without actually making any changes to the API.

M3 custom list

Once we are satisfied with how the API works and we have the settings you want, you will need to release it to the MI-repository so that it becomes an active API.  This is done in CMS015 with option “20-Update Mi repository”.  Once we have don this, the API will appear in MRS001 under program CMS100MI.

M3 transaction

Putting our API to Work – Using our Newly Created API

We are now able to use this API in whichever way we would like. In our example, we want to use it with a VinceXL export function. The first thing that must be done is to make sure that VinceXL is aware of this new API. To make sure of this, we will need to send the new MI-repository (with our new API) to VinceXL.  This is done through the VinceXL by clicking on the button “Update Repository” for the M3- environment in which we just created the API.

vince - amazone api

Note that the Update Repository button is only available for the users that have been defined as administrators for your company.  If you are not an admin, please contact the person authorized to help you with this upload.

Once the upload of the MI-repository is complete, you can create a VinceXL  function using this API.

export mchead

If you’d like to learn more about creating custom list API’s, Click here to view part 1.

If you have any questions contact us here

Download content as .PDF

Custom list API’s CMS100MI

Share...