Batch Translation with SAP RPA – Workflow

Share
Share on facebook
Share on twitter
Share on linkedin
Share on pocket

The translation process of ABAP objects; It has always been a software developer’s nightmare because it is made with primitive methods. This project automates the translation process of ABAP objects with the SAP RPA product.

1.Introduction

The project is very simple to use. The RPA process is completed by matching the translation information from the uploaded excel file with ABAP objects. After the process is completed, the request (via slxt transaction code) containing the translated objects is created by RPA. Additionally, the bot takes a screenshot of this request and sends an e-mail to the user.

2.Usage Areas of the Project

  • Roll-out Projects
  • The need for translation into more than one language of the newly written/untranslated product
  • Easy translation of untranslated Z objects (many) in the ABAP dictionary with this product

3.Advantages of the Project

  • %50 savings on time spent on translation
  • Minimizing user-based translation errors
  • Reduce translation effort (%80)
  • Translation into multiple languages

4.ABAP Objects of the Project

  • ABAP Objects already included in the project
    • Data Element
    • Message Class
    • Smartforms
    • AdobeForms
  • ABAP Objects that can be added to the project
    • Domain
    • Structure
    • Table
    • Table Type
    • Menu Area
    • Reports (with screens)
  • ABAP Objects that are not suitable for the project design
    • Text Tables

5.Detailed Structure of the Project

  • A separate workflow has been created for each ABAP object in the project.
  • The workflows created in one MAIN workflow are called.
  • We can specify which workflow RPA will call in the ‘Entry Sheet’ section in excel.
  • RPA reads ABAP Objects’ information such as object name and translation language from separately created ‘Sheets’ (eg Data Element).
  • It will be sufficient to create a new workflow for the ABAP objects to be added, to ‘REUSE‘ this workflow to the MAIN workflow and to update the excel file.
  • Information such as system information, user name and password, request name, for which RPA will translate, can also be read from excel and defined from RPA Cloud Factory. (There is also a ‘Request Sheet’ in the sample excel file, but I preferred to read it from RPA Cloud Factory.)

Note: Since the translation interface of ABAP objects such as ‘Message, Data Element, Domain, Reports’ is almost the same, dynamic programming method can also be used for objects with similar interfaces by defining a general ‘Criteria’.

5.1.Workflow

Figure 1: Process Diagrams
5.1.1. Data Element
  • Go to transaction code SE63.
  • Click on Transport Object. (The loop should start here.)
  • The bot repeats this process as much as the number of rows of translation information in the Excel file.
  • Data element object information is entered.
  • The fields to be translated are mathced with the data in the excel file.
5.1.2.Message
  • Go to transaction code SE91.
  • Message Class and Message number are entered. (The loop should start here.)
  • The bot repeats this process as much as number of rows of translation information in the Excel file.
  • Original Language and Target Language; it is entered by following steps Go to->Translation
  • Translation is done.
5.1.3.Smartforms
  • Go to transaction code SE63
  • Click Other Text. (The loop should start here. It is also possible to start loop on SSF interface by using keystroke F3 command)
  • Smartforms information in excel file is filtered by the bot. Smartforms informations are appended to the internal table using the method Deep Structure. The loop count is gotten by length of Deep Structure.
  • The SSF object is found using search button and clicked.
  • Smartforms object information is entered in the SSF interface.
  • It will be appeared 2 GUI Containers. Container at the top is the original structure of the object. The number of rows here is calculated by scrolling down.
  • Click Copy Source Text(SHIFT F8) to copy original structure of smartforms.
  • The texts of Paragraph type which does not start with ‘/’ at the Bottom Container are compared with the data in the excel file and the translations are made line by line.
  • When the translation process is completed, the bot click Save and Active button.
5.1.4.Adobeforms
  • Go to trancation code SE63.
  • Click Other Text. (The loop should start here. It is also possible to start loop on PDFB interface by using keystroke F3 command)
  • Adobeforms information in excel file is filtered by the bot. Adobeforms informations are appended to the internal table using the method Deep Structure. The loop count is gotten by length of Deep Structure.
  • It will be appeared 2 GUI Containers. Container at the top is the original structure of the object.The original structure of object is copied by clicking Copy Source Text (SHIFT F8).
  • The data at the Bottom Container is defined as a new variable. Line by line data is compared with the data in the excel file, and the data is set by appending it to a new variable with the REPLACE function.
  • The process is completed by clicking Save and Active.
5.1.5.Main Translation
  • Data is retrieved from RPA Cloud Factory with Declare-Get methods.
  • A simple excel upload Popup is designed from UI Designer to upload Excel.
  • The path of the file from the designed Popup is assigned to the global variable.
  • Excel data is retrieved by using RPA excel methods with path we have( a separate global internal table is used for each sheet).
  • The workflows created with the Reuse method are called.
  • Immediately after the Workflows are finished, the SLXT transaction code is accessed and the necessary information (such as Object Processor, Date, All languages, Workbench request) is entered and the transaction code is executed.
  • Screenshot of each page is taken with the RPA screen-shot method on the incoming screen, and information about the request created is sent to the e-mail address defined in RPA Cloud Factory.
Figure 2: A section from the Main workflow

6.Important Notes

  • The SAP Logon page must be called at every Workflow start.
  • killSAP functions must be called at each Workflow start and end..
  • Every Workflow must start with Start Application and end with Close Application.
  • If the ‘Entry Sheet’ data in the Excel file is ‘X’, workflows should start, otherwise workflows should be terminated with sc.endStep() functions.

7.Important Code Blocks

  • Getting Excel Values

//Get Entry Details

    /****************************************************************************************************************************/

    ctx.excel.sheet.activate(“Entry”);

    var row1 = ctx.excel.sheet.getLastRow(“A1”);

    var col1 = ctx.excel.sheet.getLastColumn(“A1”);

    rootData.ExcelData.Entry = ctx.excel.sheet.getFullRangeValues(“A”,1,String.fromCharCode(64+col1),row1-1,””);

    //Get Data Element Details

    //****************************************************************************************************************************

    ctx.excel.sheet.activate(“Data Element”);

    var row2 = ctx.excel.sheet.getLastRow(“A1”);

    var col2 = ctx.excel.sheet.getLastColumn(“A1”);

    rootData.ExcelData.DataElement = ctx.excel.sheet.getFullRangeValues(“A”,1,String.fromCharCode(64+col2),row2-1,””);

    //Get Smartforms Details

    //****************************************************************************************************************************

    ctx.excel.sheet.activate(“Smartforms”);

    var row3 = ctx.excel.sheet.getLastRow(“A1”);

    var col3 = ctx.excel.sheet.getLastColumn(“A1”);

    rootData.ExcelData.SmartForms = ctx.excel.sheet.getFullRangeValues(“A”,1,String.fromCharCode(64+col3),row3-1,””)

    //Get Adobe Forms Details

    /****************************************************************************************************************************/

    ctx.excel.sheet.activate(“Adobe Forms”);

    var row4 = ctx.excel.sheet.getLastRow(“A1”);

    var col4 = ctx.excel.sheet.getLastColumn(“A1”);

    rootData.ExcelData.AdobeForms = ctx.excel.sheet.getFullRangeValues(“A”,1,String.fromCharCode(64+col4),row4-1,””);

    //Get Message Details

    //****************************************************************************************************************************

    ctx.excel.sheet.activate(“Message”);

    var row5 = ctx.excel.sheet.getLastRow(“A1”);

    var col5 = ctx.excel.sheet.getLastColumn(“A1”);

    rootData.ExcelData.Message = ctx.excel.sheet.getFullRangeValues(“A”,1,String.fromCharCode(64+col5),row5-1,””);

    //Get Request Details

    //****************************************************************************************************************************

    ctx.excel.sheet.activate(“Request”);

    var row6 = ctx.excel.sheet.getLastRow(“A1”);

    var col6 = ctx.excel.sheet.getLastColumn(“A1”);

    rootData.ExcelData.Request= ctx.excel.sheet.getFullRangeValues(“A”,1,String.fromCharCode(64+col6),row6-1,””);

  • killSAP

function killSAP(){

        var __result = ctx.wmi.query(‘Win32_Process’, [ ‘ProcessId’, ‘Name’, ‘ExecutionState’ ], “Name=’saplogon.exe'”);

    if(__result.length > 0) {

      for(var __counter = 0; __counter<__result.length; __counter++) {

            ctx.sleep(500);

        var __result2 = ctx.wmi.query(‘Win32_Process’, [ ‘ProcessId’, ‘Name’, ‘ExecutionState’ ], “ProcessId=”+__result[__counter].ProcessId);

        if(__result2.length > 0) {

          ctx.wmi.killProcess(__result2[0].ProcessId);

        }

      }

      ctx.log(“All running instances of process ‘saplogon.exe’ have been killed.”, e.logIconType.Info);

    }

    else {

      ctx.log(“No found running instance of process ‘saplogon.exe’.”, e.logIconType.Warning);

    }

}

  • Screen-shot Metod

var path = “C:\\Users\\” + ctx.options.userName + “\\Desktop\\” + “name.png”;

                        ctx.screenshot({ ID: “usr”,

                                                X: 0,

                                              Y: 127,

                                             CX: 1920,

                                             CY: 884,

                                         File: path });

  • Embed image as binary to mail body

ctx.base64.encodeStream(ctx.fso.file.read(path, e.file.encoding.Binary));

                                body_text += ‘<img src=”data:image/png;base64,’ + ctx.base64.encodeStream(ctx.fso.file.read(path, e.file.encoding.Binary))+'”>’;

8.Structure of Excel

  • Entry Sheet
Work FlowCheck
Message ClassX
Data ElementX
Adobe FormsX
SmartFormsX
Domain
  • Message
Message ClassMessage NumberSource TextTarget TextSource LangTarget Lang
ZMO_TEST000No data found.keine Daten gefundenENDE
ZMO_TEST001Please choose the company code.Lütfen şirket kodunu seçin.ENTR
ZMO_TEST002Tax number is not correct.Vergi numarasi doğru değil.ENTR
  • Data element
Data ElementSource TextDTEXT(55)REPTEXT(40)SCRTEXT_L(40)SCRTEXT_M(20)SCRTEXT_S(10)Source LangTarget Lang
ZMO_DE_01Name and surnameAdı SoyadıAdı SoyadıAdı SoyadıAdı SoyadıAd.Soyad.enUStrTR
ZMO_DE_02Adress InformationAdres BilgileriAdres BilgileriAdres BilgileriAdres BilgileriAdres BlgenUStrTR
ZMO_DE_03Phone NumberTelefon NumarasıTelefon NumarasıTelefon NumarasıTelefon NumarasıTel.NoenUStrTR
  • Adobeforms
Adobe Forms NameSource TextTarget TextSource LangTarget Lang
ZMO_TEST12enUSdeDE
ZMO_TEST12INVOICE NORECHNUNG NRenUSdeDE
ZMO_TEST12INVOICE DATERECHNUNGS DATUMenUSdeDE
ZMO_TEST12SALES ORDER NO/DATEVERKAUFSAUFTRAG NR/DATUMenUSdeDE
  • Smartforms
SmartformsSource TextTarget TextSource LangTarget Lang
ZMO_DENEMEenUStrTR
ZMO_DENEMEPlate Number:Plaka Numarası:enUStrTR
ZMO_DENEMERegionBolgeenUStrTR
ZMO_DENEMEWaybill Number:Irsaliye No:enUStrTR
ZMO_DENEMERegionBolgeenUStrTR
ZMO_DENEMEAmoung of Contrat:Kontrat Miktarı:enUStrTR
ZMO_DENEMEMaterial:Malzeme:enUStrTR
ZMO_DENEMEDriver Name:Sürücü Adı:enUStrTR
ZMO_DENEMEDate:Tarih:enUStrTR
ZMO_DENEMEWeighing No:Tartım No:enUStrTR
ZMO_DENEMETEL :    E-MAIL:TEL :    E-MAIL:enUStrTR
ZMO_DENEMEWEIGHBRIDGE RECEIPTTARTIM FISIenUStrTR
ZMO_DENEMEWeighbridge No :Irsaliye No:enUStrTR
ZMO_DENEMECompany Name:Sirket :enUStrTR
ZMO_DENEMEAmount of Coming:Gelen Miktar:enUStrTR
ZMO_DENEMEAmount of Remaining:Kalan Miktar:enUStrTR
ZMO_DENEMEQuality Inspection Lot:Kalite Muayene Lotu:enUStrTR
ZMO_DENEME PO number:Satin Alma No:enUStrTR
ZMO_DENEMECarrier:NakliyeenUStrTR
  • Request
Request DescriptionProcessing DateProcessor
06.07.2021 Translation6.07.2021mokay

Supporting your business processes with emerging technologies is the main goal of our business.

exp head deco 3
icon our expertise

Thank you

You’ll receive an email with download link shortly.

If not, reach us on solviamarketing@solviads.com

Created by icon 54from the Noun Project

Thank you

You’ll receive an email shortly.

If not, reach us on solviamarketing@solviads.com