A manufacturing plant or an industrial site consists of machinery to process or manufacture goods. These machines continue its functionality as long as they are in good condition. However, due to breakdowns and preventive maintenance they need to be serviced with labor, parts or both. SAP plant maintenance has rich functionality to manage equipment, functional locations and entire PM processes.
To avoid machine breakdown or notify when a breakdown occurs or to make a request for maintenance there is functionality in SAP called PM (Plant Maintenance) Notification. SAP Maintenance functionality is used to alert the department about an abnormal condition in the machinery. It is kind of a trigger to initiate PM cycle. PM notifications can be created using transaction code IW21 within SAP.
It may be noted that external non SAP applications may be monitoring assets and SAP may not be the only application within customers landscape. In this article, I am going to walk you through how integrate SAP with an external system to create PM notification in SAP. In this we are taking external system to be a .NET based application which can be integrated using Visual Studio (Creating console application) which is integrated with SAP to create PM notifications in SAP.
SAP Third party integration for Plant Maintenance
The section below describes a step by step guide on how to integrate with SAP to create PM Notifications using .NET connector. You may require an understanding of .NET and ABAP languages to be able to get the most out of this tutorial.
Step 1: Creating a .NET application referencing SAP NCO libraries
- Create a web application and add reference of sapnco.dll and sapnco_utils.dll (shown in below screenshot) which are required to connect with SAP. If you do not have these libraries , reach out to SAP Basis team or you can download them yourself from SAP Marketplace out here.
Step 2: Develop the .NET code for creating PM Notifications in SAP
- MainClass is used to connect to the SAP system and to create PM Notifications in SAP.
SapBapiConnection cnn = new SapBapiConnection(“SAP_HOST”, “SAP_SYSNUM”, “SAP_CLIENT”, “SAP_USER”, “SAP_PASSWORD”, “SAP_SYSID”, true);
- In the above line we are connecting to SAP using SAP .Net Connector by providing all the SAP credentials such as host server, system number, client, username, password, system id.
- The above line is used to create PM Notifications in SAP by calling a function called CreatePMNotifications with two parameters where,
- First parameter defines the object for a class called PlantMaint which consists of values required to create PM Notifications in SAP.
PlantMaint data =new PlantMaint();
In the below screenshot, you can observe how the values are passed to a function CreatePMNotifications. In this example, we are creating a notification which describes the situation (Oil leak in bearing) for equipment (10003588) in the function location (1034-LABS-002).
- And the second parameter defines the connectivity to SAP.
- Add a class called PMNotificationCriteriaBapi in which the above called CreatePMNotifications method is defined.
- To create PM Notifications in SAP, we use BAPI called BAPI_ALM_NOTIF_CREATE and pass the required values to create PM Notifications in SAP.
- Now Run the Console Application and check in SAP using transaction code IW23.
- In the above screen you can notice the notification number created in SAP.
- Now check with that number in SAP.
Step 3: Check the PM notification returned from application within SAP
- Enter transaction code IW23 in SAP to display the notification.
- Enter Notification number which you get from the console application.
- Click on Enter.
- In the below screen you can see that PM Notification has been created in SAP.
By following the above steps, you can Integrate SAP with an external system to create PM Notifications. We sincerely hope that this was useful and any comment of feedback will be very helpful.
Who we are
We are passionate about SAP consulting and executing SAP Integration projects. Reach out to us for a free assessment of your SAP needs.