Skip to main content

SAP Material Management

SAP Material Management

Introduction

This sample shows the automation of SAP GUI desktop client.

The idea behind sample is to perform a simple action like creating material upon which the more complex automation can be built.

During execution the bot makes use of both desktop and SAP driver.

Prerequisites

  1. Configured Debtor Notification Channel. Config name parameter is related to notification.channels.config value from ControlServer configuration.

To run SAP automation the initial setup must be performed as described in SAP Driver node preparation

To run the Automation process (AP), the node should have Capabilities specified in the AP Details tab. Capabilities for SAP: AP_RUN, DESKTOP, SAP

repo id: eu.ibagroup.samples.ap:easy-rpa-sap-ap:jar:full:<easyRPA version>

module class: eu.ibagroup.easyrpa.ap.creatematerial.SapAp

The package of the automation process can be found in the following directory: https://<CS URL>/nexus/repository/rpaplatform/eu/ibagroup/samples/ap/easy-rpa-sap-ap/<version>/easy-rpa-sap-ap-<version>-bin.zip

The source code: https://code.easyrpa.eu/easyrpa/easy-rpa-samples/-/tree/dev/easy-rpa-sap/easy-rpa-sap-ap

SAP GUI version 7.50, 7.60

configuration params:

keydefault valuerequireddescription
sap.pathC:/Program Files (x86)/SAP/FrontEnd/SAPgui/saplogon.exeno
sap.connectionS4HANA 1909no

secret vault:

aliasvalue
sap.user{"user": "RPABOT", "password": "Password1"}

AP module is implemented in eu.ibagroup.easyrpa.ap.productsreader.ProductsReaderAp class and consists of a single task CreateMaterial.

In standalone mode the AP can be started from main method of eu.ibagroup.easyrpa.ap.creatematerial.LocalRunner  class.

Included Steps

Execution starts with desktop driver opening Sap Logon. After first window is loaded the bot clicks on the connection defined in sap.connection setting.

Then the bot types in User and Password retrieved from sap.user secret vault alias

After successful login the bot enters /NMM01 transaction code in upper left field.

/N prefix signifies that the transaction will be open in the same window

MM01 corresponds to new material creation

Create Material (Initial Screen) Page. The bot fills in the fields 'Industry Sector', 'Material Type fields' and clicks Continue.

Select View(s) popup appears, where the bot selects 'Basic Data 1' and clicks on the green check.

Next opens the Create Material page, where Description field is set to 'EasyRPA material. Material code: 2353' and base unit is set to AU.

All is set, the bot presses Ctrl+S to save material and the view returns to Create Material (Initial Screen) Page.

Now to logoff the bot enters /nex which means to finish session without warnings.

Finally to close the last SAP Logon window the bot runs the command TASKKILL /F /IM saplogon.exe /T which immediately terminates the application.

As the last step the bot sends an Excel file with information on materials created via email.


You can later check newly created material by using transaction code MM60. Start typing in code or name in material field and you'll see it in a dropdown list.