添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

In this blog post I would like to share how you can create sales order in SAP System using SAP Intelligent Robotic Process Automation, aka, SAP iRPA. But,before we start building our bots, we need to get our system ready for this. Following this great blog post from vijay.sharma4 I have my set up ready and running.


What we are trying to do?


Create a sales order in SAP System based on the purchase order and that purchase order will be received from mail attachment (excel) by customer. RPA Bot will follow below steps-
  • Fetch the purchase order mail from outlook and download the attachment and save it in the project folder

  • Read the mail, extract the data in some variables

  • Open the SAP GUI Application, select the system and then logon to system with credentials

  • Enter T Code in SAP Easy Access for creating sales order

  • Enter all the required data, which will need to create sales order

  • Let’s Begin


    Now our system is ready to build bot. Open the desktop studio and follow the below steps-
    Step-1 Create new project
  • Goto File > Create New Project or press “Ctrl + N

  • Fill in the mandatory details in the pop-up, I have maintained below details for my project and then click on save.

  • Step-2 Add Excel and Outlook library script
  • Open the script tab from context menu and right click on script area then select Include library script.

  • Now let’s capture a new page for logon screen, before capturing the page please make sure you open next screen on SAP GUI Application

  • To capture new right-click on your application and select Capture a New Page

  • For capturing all next pages we will choose technology as SAP GUI.

  • Likewise we will capture all the pages which are required to create a sales order. Add the criteria on the pages for the required data.

  • Step-3 Create Workflow
  • Select workflow under context menu. Right click on Global and click on New Workflow.

  • Before you can continue with the rest of the functionalities you need to build your project. This way the script for the workflow will be generated and we can enhance it. Open the script generated by your workflow ( it will have the same name ). Search for your custom activity and step by their name. You can write the rest of the logic in this step. Update SENDER EMAIL ADDRESS , SUBJECT OF YOUR MAIL and PROJECT FOLDER PATH in the below code

  • GLOBAL.step({ saveAttachments: function(ev, sc, st) {
    var rootData = sc.data;
    ctx.workflow('SAPLogon', '4830c49e-2646-41aa-a683-7624c75e8c9c') ;
    // saveAttachments
    ctx.outlook.init();
    var mails = [];
    var i, j, path, filename, attachments, noAttachments;
    // Resets the working mails list.
    ctx.outlook.mail.resetMailCollection();
    // Search the body of email for a keyword. Other criteria are also available.
    ctx.outlook.mail.searchByCriteria({
    fromEmail: "SENDER EMAIL ADDRESS",
    subject: "SUBJECT OF YOUR MAIL",
    hasAttachment: 1,
    dontThrowExceptionIfNoMailFound: true
    // Get the list of mail information for the mails that fit the criteria.
    mails = ctx.outlook.mail.getFilteredTable();
    // Build the working mails list by retrieving each mail.
    if (mails.length) {
    for (i = 0; i < mails.length; i++) {
    ctx.outlook.mail.retrieveMail({
    EntryID: mails[i]['EntryID'],
    StoreID: mails[i]['StoreID']
    // Display some info about each email.
    ctx.log("---------------------------------------------------------");
    for (i = 0; i < ctx.outlook.mail.getCollectionLength(); i++) {
    ctx.log("Mail no: " + i);
    ctx.log("From: " + mails[i]['Sender']);
    ctx.log("Subject: " + ctx.outlook.mail.getSubject(i));
    ctx.log("---------------------------------------------------------");
    // Here we start the procedure of downloading the attachments in the email (if they exist).
    // Get the number of attachments for each email.
    noAttachments = ctx.outlook.mail.getAttachmentsCount(i);
    // Get the name of the attachments.
    attachments = ctx.outlook.mail.getAttachmentsName(i);
    // Download the attachments if they exist.
    if (noAttachments > 0) {
    // Save each attachment separately.
    for (j = 0; j < noAttachments; j++) {
    filename = attachments[j];
    path = "PROJECT FOLDER PATH" + filename;
    ctx.outlook.mail.attachmentSave(i, path, {
    AttachmentName: filename
    ctx.log('File downloaded: ' + filename);
    // Ends “Microsoft Outlook” application.
    ctx.outlook.end();
    sc.endStep(); // Sequence
    return;
  • In the context menu, right click on the folder SAPLogon760Data that will be automatically create when you capture application pages data, click on create item and then create three variables in which mail attachment values will be stored.

  • Next steps are for getting values from downloaded file. Drag and drop Get one value activity three times to getting three values. Add the variable by selecting context path. And then define the row and column for respective item. Do not worry about the code it will generate automatically when you will save it.

  • In this scenario you will have to use some activities like Double click, click, set and keystroke for page. Keystroke will be Enter in our case. So for this, first select the page and write key sequence as e.SAPScripting.key._Enter_

  • Step-5 Execute the bot
  • To execute our bot we first need to build and then run our project. Once Build is success, you will get message as below

  • Artificial Intelligence (AI) 1 Business Trends 363 Business Trends​ 8 Digital Transformation with Cloud ERP (DT) 1 Event Information 462 Event Information​ 15 Expert Insights 114 Expert Insights​ 76 Life at SAP 418 Life at SAP​ 1 Product Updates 4 Artificial Intelligence (AI) blockchain Data & Analytics Intelligent Enterprise Oil Gas IoT Exploration Production Artificial Intelligence (AI) blockchain Data & Analytics Intelligent Enterprise sustainability responsibility esg social compliance cybersecurity risk Catalyst for Efficiency: Revolutionizing SAP Integration Suite with Artificial Intelligence (AI) and Connecting to a RAC Database in SAP Integration Suite: A Step-by-Step Guide Using JDBC Adapter Managing Multiple Projects in Central Business Configuration (CBC) – A Quick Guide in Technology Blogs by SAP How to perform transformations in the SLT system? in Technology Q&A SMB Adapter for SAP Integration Suite in Technology Blogs by Members Integrating SAP SuccessFactors Workforce Analytics with SAP Analytics Cloud in Technology Blogs by Members Composable Architecture: A Practical Example in Technology Blogs by Members