Supply Chain Management Blogs by SAP
Expand your SAP SCM knowledge and stay informed about supply chain management technology and solutions with blog posts by SAP. Follow and stay connected.
cancel
Showing results for 
Search instead for 
Did you mean: 
Kevin_Hunter
Product and Topic Expert
Product and Topic Expert
11,135
Recently I started to experiment building Digital Manufacturing Cloud POD plugins and soon learned that it can be quite time consuming just to build the basic structure of the plugin without adding any functionality.

In my first plugin I created the file structure and files manually (with lots of copying and pasting from samples) which was a good learning experience but by no means efficient.

I then created a blank template from this first plugin and used that for several other plugins, this consisted of copying the template into Business Application Studio and manually making all the required changes. Not quite as time consuming as my first attempt but still prone to errors and still takes me around 30 minutes before I start adding real functionality.

So how could I do this quicker, easier and less error prone? I needed something that asked me a few questions about the plugin I wanted to develop then automatically create all the file structure and files. What came to mind was Yeoman which I had seen used on another type of project. So, after reviewing the Yeoman documentation I wrote a Yeoman generator to scaffold my plugins automatically.

So, lets build a custom POD plugin to see how easy it is using this Yeoman generator.

For this blog I am going to use Business Application Studio but you can also use Visual Studio Code if you prefer (you need to install the cloud foundry CLI and the MultiApps CLI if you want to use VS Code). You can use Business Application Studio in a trial account if you don't have access to a licensed version.

Lets start by opening Business Application Studio.


 

If you do not already have a development space available then you need to press the "Create Dev Space" button. Give the Dev Space a name and select SAP Fiori as the kind of application you want to create.


 

Business Application Studio will now start to create the dev space and after some time it will display that the dev space is running. Click on the name of the dev space to open the dev space.


 

Once opened you should see the following.


We now need to create a folder to hold our POD plugin, there are several ways of doing this and everybody has there own preference. I prefer to click Terminal >> New Terminal and do it in the command line


I type :

cd projects

mkdir podplugin

 

Now you can press the open folder button and select the folder you just created.

 


OK, now we are ready to start creating the POD plugin and to make this really easy I have written and released a yeoman generator that does a lot of the work for you.

So first we have to install the generator (note that Yeoman is already installed in Business Application Studio), to do that open a terminal again and type the following command:

npm install generator-dmcpodplugin

 


Now the tool is installed we can let it do its magic by typing

yo dmcpodplugin

 


The generator will ask multiple questions eg name of your plugin, namespace, host etc and then automatically creates all the files and folder structure required for the POD plugin and then installs all the dependencies.

 


The plugin is now ready for you to add whatever functionality you want it to have but I have included sample configuration in the plugin that allows to to package and deploy the plugin straight away, so lets do that.

We need to package everything into an MTAR file first so right click on the mta.yaml file and select Build MTA Project from the menu.

Once its has completed you should see an MTAR file with the same names as you plugin

 


 

This MTAR file can now be uploaded to BTP - Note you need the appropriate subscription and roles to be able to deploy this file.

Right click the MTAR file and select Deploy MTA Archive from the menu.

At the top of the screen you will be asked for details of where this plugin should be deployed such as username, password, tenant and space.

Once deployed you should see a message saying that it was started and available at a specific URL - take a note of this URL as you will need it.


This means that the POD Plugin is now hosted in BTP and is ready to be added to DMC using the Service Registry.

Open your DMC launch pad and open the Manage Service Registry app. Select the

UI Extensions tab and press Create


Add a name and description for the plugin, type should be POD Plugin, URL is the URL noted in the previous step with Https:// added to the front of it.

Path should be / followed by the name you gave to the podplugin so in my example it is /yeomanPlugin

Namespace is the namespace given in the yeoman questions but with the dots replaced by slashes and the name of the project added to it. In my example the namespace was sap.custom.plugins and the name of the plugin was yeomanPlugin so the entry would be sap/custom/plugins/yeomanPlugin

Check the Enabled checkbox and press Create


 

The POD Plugin is now available for use so lets try it.

 

Open the POD Designer app and select Create.

Give the POD a name and select one of the POD types you answered Yes to in the yeoman questions. Ive selected Operation Activity.


Press Create.

Drag a "Plugin Container" from the controls list into the middle of the page then find your plugin in the plugin list and drag it onto the Plugin Container. Click the default check box and press the configuration gear wheels in the top right hand corner of the screen.


Notice that the configuration panel shows the configuration defined in the builder/propertyEditor.js file .

Type in anything you want into the two text fields and press save.

Finally, press the glasses icon to open a preview of the POD.


 

You can now see the custom POD plugin where the text in the header bar and the text in the panel match whatever you defined in the configuration.

Congratulations, you have built a custom POD plugin.

 

 
44 Comments
patty_1982
Contributor
0 Kudos

Very useful blog. I have a question: this is a way for creating a new plugin. Is there a way for extending a standard plugin (like SFC card or others)?

Thank you!

Patrizia

Kevin_Hunter
Product and Topic Expert
Product and Topic Expert
Hi Patrizia,

We have discussed this via email but repeating here for the community.

At the moment the is no way to extend a standard POD plugin. At the moment you would have to build a custom POD plugin from scratch that does the same as the standard one.

We are discussing internally how to approach this in the future, we might release the source code of the plugins or we may change the design to allow them to be extended. Watch this space as they say.

Thanks

Kevin
Very good blog. Is there any way to test the plugin without deploying it? That is, running the plugin directly in BAS?

Thank you

Luís

 
Kevin_Hunter
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Luis, thanks for your comments. At the moment the only way to test it is to deploy it, however I know the development team are working on a way to test it without deploying it so watch this space.

Thanks

Kevin

Matthias_Kolley
Explorer
0 Kudos
Hi Kevin,

 

Thank you for this awesome explanation and the yo generator!

Are you planning to provide generators for the other types of UI Executions like "ExecutionPlugin"?
(https://github.com/SAP-samples/digital-manufacturing-extension-samples/tree/main/DMC_UIExtensions/PodPlugin_ExamplePlugin/exampleplugins/webapp)
sunita_sarkar
Explorer
0 Kudos
Hi ,

 

Which Role is required to deploy the "This MTAR file can now be uploaded to BTP – Note you need the appropriate subscription and roles to be able to deploy this file"

I can't the starting URL which I will add in Manage Service Registry on DMC.

Thanks and regards,

Sunita Sarkar
sunita_sarkar
Explorer
0 Kudos
Hi Kevin ,

 

I can't find my plugin in the plugin list.

 

 

Thanks and Regards,

Sunita
Kevin_Hunter
Product and Topic Expert
Product and Topic Expert
0 Kudos
Thank you Matthias,

Yes I am planning to expand it to cover execution plugins as well but I am so busy on project work right now that I haven't had the time to do it yet.

Thanks

Kevin
Kevin_Hunter
Product and Topic Expert
Product and Topic Expert
0 Kudos
Hi Sunita,

Im guessing you worked it out since I also see your next question.

For anyone else reading this you will need the following roles

Business_Application_Studio_Developer if you want to use BAS to write the plugin (you can also use VS Code if you want too)

Business_Application_Studio_Extension_Deployer - this role allows you to deploy the extension.

You also need to be allocated as a Space Developer in the space where you want to deploy the plugin.

 

 

Thanks

Kevin
Kevin_Hunter
Product and Topic Expert
Product and Topic Expert
0 Kudos
Can you use the developer tools in chrome (f12) to see what error you can see when loading the POD Designer and / or your POD ?

Typically its a CORS issue.

 

Thanks

Kevin

 
Matthias_Kolley
Explorer

Awesome.

In the meantime I found the github repo for it and maybe I can dedicate some time to help with the generator cause I already have some more usecases that can be achieved by extending the generator.

 

Matthias

sunita_sarkar
Explorer
0 Kudos
Hi Kavin,

I have the below roles .

 



































Business_Application_Studio_Administrator Allows administrators to manage (export and delete) user data.
Business_Application_Studio_Developer Allows developers to load and develop applications using SAP Business Application Studio.
Business_Application_Studio_Extension_Deployer Allows extension developers to deploy simple extensions.
Connectivity and Destination Administrator Operate the data transmission tunnels used by the Cloud Connector and manage the destination configurations, certificates and subaccount trust.
DMCConfigurator Configurator For Digital Manufacturing Cloud

 

 

 

Thanks and regards,

Sunita
sunita_sarkar
Explorer
0 Kudos
Hi Kavin,

 

How can I resolve the CORS issue?

 

 

 

Thanks and regards,

Sunita
Kevin_Hunter
Product and Topic Expert
Product and Topic Expert
0 Kudos
Your CORS settings are in the MTA.YAML file , the url listed in this file must match the url of the system trying to access the plugin otherwise it will reject it.

Thanks

Kevin
sunita_sarkar
Explorer
0 Kudos
Hi Kevin,

 

Thank you so much .I have resolved the issue.

 

Thanks and regards,

Sunita
rixiobarrios
Associate
Associate
0 Kudos
Hi Kevin, there is no url field in my MTA.YAMl file. I open it in the YAML editor and text editor but still not URL. My plugin is not showing in the plugin list under the POD designer after I register it.

 

Thanks

 

Rixio
Kevin_Hunter
Product and Topic Expert
Product and Topic Expert
0 Kudos
Hi Rixio,

Apologies I just noticed your question. Reach out to me internally and we can sort it out .

Thanks

Kevin
emre_sap
Participant
0 Kudos
Dear Kevin,

 I created my custom plugin successfully but even I change my Main XML file and customize it on dev space, Plugin in the pod never gets updated. ( I even tried f12-f5 while disable cash marked on the developer console)


Is there another way to update the plugin or is it not reading the Main XML page?


Thanks for your help

1)


2)

Kevin_Hunter
Product and Topic Expert
Product and Topic Expert
Hi Emre,

This is quite a common thing to happen and is normally a cache issue. Try closing all the DM tabs in your browser then flush your cache and try again. You can also try incognito mode.

To see if you are loading the latest version you can go to the sources tab in chrome developer tools and look to see which controller is being loaded.

Hope this helps

Thanks

Kevin
emre_sap
Participant
0 Kudos
Thank you, Kevin!

I found a little different way and it works!

Best Regards
Kevin_Hunter
Product and Topic Expert
Product and Topic Expert
Just to keep this thread as up to date as possible, we are now adding the ability to extend the standard plugins , this is currently (release 2308) possible with 14 of the existing plugins (including the SFC card) and more are on the way with each new release.

Thanks

Kevin
benwildridge
Explorer
0 Kudos
Great news, thanks for letting us know!
Kevin_Hunter
Product and Topic Expert
Product and Topic Expert
0 Kudos
Hi All,

After many many (too many) attempts I have upgraded a lot of the package versions to get rid of the security vulnerabilities which then caused lots of other issues ........

Hopefully all fixed now (Version 1.0.17)  so please reinstall and let me know if there are any issues.

 

Thanks

Kevin
Matthias_Kolley
Explorer
0 Kudos
Hello Kevin,

 

This is great news.

So there is one thing I'm currently still curious about.

Is there a dedicated "subscribe to get update notifications" about POD-Plugin development? Or are you going to keep us updated here in this comment section?

 

Anyway, thanks for giving is this update.

Matthias
Kevin_Hunter
Product and Topic Expert
Product and Topic Expert
Hi Matthias, since this is a non official tool there no way to subscribe to notifications other than watching this comment section.

However since the changes to the core plugins is official it was announced in the the whats new section when the new version of DM was released.

 

Thanks

Kevin
UdayMS
Participant
0 Kudos

Hello kevinhunter

I have few questions on this.

  1. Where can I find a list of plugins which can be extended
  2. My requirement is to have a Quantity Confirmation Plugin in a Workcenter and Operation Type of POD where the option of Quantity confirmation is not coming. Should we go for custom plugin in this case or is there a way to enable it?
  3. In case of any custom plugins, how does data mapping take place as in if I create some field named Workcenter in my view, where does data binding happen for this. IS it in the application level or from the framework itself once integrated with POD

Kindly provide your inputs on this

Thanks

Uday

 

Kevin_Hunter
Product and Topic Expert
Product and Topic Expert
0 Kudos
Hi Uday,

 

1 - We add new plugins to the list of extendable plugins with every new release and the latest list can be see in the POD Developers Guide https://help.sap.com/docs/sap-digital-manufacturing/pod-plugin-developer-s-guide/implementing-core-p...

2 - Some plugins are specifically limited to certain POD types due to the functionality of the plugin not being compatible with other POD types , the Order Confirmation plugin was designed for process orders and you dont typically use operation or work center pods for process orders . However if you have a good use case for it then suggest it as a product enhancement and the product team can take a look. In the mean time I would suggest a custom plugin depending on the use case (you can configure Qty as a field in an operation and work center POD if you didnt already know)

3 - What data and how you bind it is up to you in the custom plugin code. Depending on the use case it could be read from the framework using the pod selection model, it could be retrieved from the database using the APIs or it could be passed into the plugin as part of an event handler. In your example of workcenter you can use the pod selection model as it already knows which work center has been selected in the POD. To quote the POD developers guide "The POD application maintains a single model called the POD Selection model, which can be accessed and updated by all plugins. This model contains the current state of the selections for the POD and other context information. Plugins can read and update information in the POD Selection model as needed."

 

Hope this helps

Thanks

Kevin
UdayMS
Participant
0 Kudos
Hello kevinhunter

Thanks so much for the help. For POD we have the structure for the app as per documentation. If we want to build a custom plugin or extend a DMC core plugin, what project artifacts need to be imported to BAS? As per documentation, we have 4 files but what would be the entire structure like we have for POD and where do we modify the Visual part of core plugin?

 

Thanks

UDay
javierrubio_01
Explorer
0 Kudos
Hi,

So what are the steps to develop a custom plugin and execute it from a Digital Manufacturing Cloud POD?. My understanding is that the custom plug is a UI5 component that can be embedded in the standard POD.

If I need to enhance the standard POD by adding a new search field ( sales order ) and display results in the worklist based on this new field, do I need to develop a new xml view with the search field in my plug in?.

How do I link up my plug's controller and the POD's controller?. I usually do that by leveraging EventBus ( EventBus.publish in the custom component and EventBus.subscribe in the main app ). But how does the main app ( standard POD ) 'listen' to the plug's event ?.

Yet, how do I pass the new custom search field to the API to fetch data?. Is this coded in my custom plug in or do I need to extend the standard POD?. Do I need to enhance the API as well?

Thanks,

Javier
Kevin_Hunter
Product and Topic Expert
Product and Topic Expert
0 Kudos
Hi Javier,

This question has been answered in your SCN question https://answers.sap.com/questions/14031235/custom-pod-plugin.html?url_id=text-global-profile-inbox-q...

Thanks

Kevin
RuslanAliev
Explorer
0 Kudos
Hello Kevin,

Thank you for the blog. The article on plugin development is excellent. I have a question regarding the creation of a filtering plugin. Do you happen to have an example or any resources that could assist in developing a plugin for data selection, perhaps based on a Custom field in an order?

Your guidance or any provided examples would be greatly appreciated.

 

BR,

Ruslan
Kevin_Hunter
Product and Topic Expert
Product and Topic Expert
0 Kudos
Can you explain the use case a little more ? What do you want to filter ? SFCs? Where should the filter output be displayed .....

Thanks

Kevin
RuslanAliev
Explorer
0 Kudos
We would like to extend the standard WC Selection Plugin and add a field for choosing SFC based on a custom order characteristic. Alternatively, the second option is to create our own plugin.
Kevin_Hunter
Product and Topic Expert
Product and Topic Expert
0 Kudos
Sorry Ruslan,

Can you be even more specific (the devil is always in the details) .

What do you want to filter in the WC Selection ?

The WC Selection plugin allows you to select which work center / resource the operator is using and when selected this is passed to the work list plugin which displays the SFCs .

If you want to filter the SFCs that are displayed then you would modify the worklist plugin rather than the WC selection plugin.

Thanks

Kevin
Matthias_Kolley
Explorer
0 Kudos
When you want to extend a Core Plugin you can check the explanations (including link to examples) for "Core Plugin Extensions"
https://help.sap.com/docs/sap-digital-manufacturing/pod-plugin-developer-s-guide/implementing-core-p...
RuslanAliev
Explorer
0 Kudos
Hello Kevin,

We would like to add an additional field to the search. Let's call it 'Color,' for example. This color is stored as custom data in the order. Users can specify a work center and a color, and the worklist will display SFC/orders that match the work center and the value in the color field. For instance, only orders with the label 'RED.' If the user wishes to change it, they can do so and receive a list of orders for the 'GREEN' value.

I hope the situation is clear now?

 

BR,

Ruslan
RuslanAliev
Explorer
 

Thank you for your comment. Of course, we have already done that, and we found an example of how to add the field, but it does not affect the results. Therefore, we have a question about how to correctly add the field for the search.

And we were also puzzled by such a comment:

* Allows modifying input search filter for use in loading worklist. This function
* can be overriden by custom extensions as follows for OverrideExecution.Instead,
* OverrideExecution.Before and OverrideExecution.After.
* <p>
* Only SFC, Shop Order or Process Lot can be used in a search filter using
* the following format:
* <pre>
* sfc,SFC001 (SFC)
* pl,PL001 (Process lot)
* ordr,SO001 (Shop Order)
* </pre>
* The input search filter might already have something defined (i.e.; "sfc,SFC001") so be carfule
* before replacing it. Only one of the filters are allowed to be returned (i.e. multiples not supported)


 

Perhaps you know, does this mean that only sfc, pl, ordr can be used? Or is it just a warning about the format?

 

BR,

Ruslan
Kevin_Hunter
Product and Topic Expert
Product and Topic Expert
0 Kudos
Depending on your desire to custom develop there may be a solution without custom development. In the work center work list you have the ability to add custom data fields into the GUI using configuration.


 

Would that be enough for you ?

If not then you will have to make a change to 2 plugins , one to allow you to select which colour you want and the other to display the worklist.

Thanks

Kevin
RuslanAliev
Explorer
0 Kudos
We are aware of this possibility.
We are not satisfied with just displaying the field in the list. So, it seems we'll have to go with the second option. Am I correct in understanding that, in any case, the data selection plugin will retrieve all orders, and only then in the work list, we will be able to filter the necessary ones? Will this affect the speed of the plugin's operation?
Kevin_Hunter
Product and Topic Expert
Product and Topic Expert
0 Kudos
OK then yes you will have to go for the second option where the selection plugin would have to be modified to allow you to add an additional search criteria and then pass that criteria to the work list plugin to filter the data. This shouldn't have any impact on the speed as you could just keep the same data query and then filter the results to only show the colour. Or !! How about just modifying the worklist plugin to add a colour selector in the header bar as a filter.

You will have to play around with core extensions to see what is possible with the work list plugin. I havent built a core extension for the work list plugin so I dont know.

Thanks

Kevin
RuslanAliev
Explorer
0 Kudos
Thank you for your time and ideas.

I find the second option more intriguing. We will explore the extensions of both plugins.

 
angelbryan
Explorer
0 Kudos

Hello @Kevin_Hunter. Is this tutorial still working?  I don't see my custom plugin in the plugin list on POD designer.

JavierRubio
Explorer
0 Kudos

Hi Kevin,

I want to enhance the standard POD PTO_PACK_POD/POD for Packing operation by adding a new search field ( similar to custom supplier field described in the examples ).

I am not sure whether I need to create a custom plugin and embed it in this standard POD ( I tried that but the custom plugin is never called ), or I need to clone the examples provided by SAP, manipulate them in BAS and deploy it?.

Can you please guide me on this?. I'd very much appreciate it. Thanks,
Javier 

cothe
Discoverer
0 Kudos

Hello.

Your tutorial is very nice and working well. But I have one wondering.

Can DM Plugins be deployed to Cloud Foundry only? What about Kyma runtime?

Thanks a lot.

Jeongjin Kim