The translation process of ABAP objects has always been a software developer’s nightmare because only primitive methods were available. The project steps below show the automation of translating ABAP objects with the SAP RPA product.
1.Introduction
SAP RPA is very simple to use. The RPA process is carried out by matching the translation information from the uploaded excel file with ABAP objects. After the process is complete, the request (via ‘SLXT’ transaction code) containing the translated objects is created by RPA. The bot also takes a screenshot of the request and sends an e-mail to the user.
2.Usage Areas
- Roll-out Projects
- The need for translation into more than one language of a newly written/untranslated product
- Easy translation of many untranslated Z objects in the ABAP dictionary
3.Advantages
- 50% saving on the time spent on translation
- Minimizing user-based translation errors
- Reduced translation effort (80%)
- Translation into multiple languages
4.ABAP Objects
- ABAP Objects already included
- Data Element
- Message Class
- Smartforms
- AdobeForms
- ABAP Objects that can be added
- Domain
- Structure
- Table
- Table Type
- Menu Area
- Reports (with screens)
- ABAP Objects that are not suitable
- Text Tables
5.Detailed RPA Usage Steps
- A separate workflow is created for each ABAP object in the project.
- The workflows created are called by one MAIN workflow.
- We can specify which workflow RPA will call in the ‘Entry Sheet’ section in excel.
- RPA reads the ABAP Objects’ (e.g., Data Element) information such as object name and translation language from separately created ‘Sheets’.
- 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, and the request name that 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: Because the translation interface of ABAP objects, such as ‘Message, Data Element, Domain, Reports’, is almost the same then a dynamic programming method can also be used by defining a general ‘Criteria’.
5.1.Workflow
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 many times as the number of rows of translation information in the Excel file.
- Data element object information is entered.
- The fields to be translated are matched 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 many times as the number of rows of translation information in the Excel file.
- Original Language and Target Language; this is entered by following steps Go to->Translation
- Translation is finished.
5.1.3.Smartforms
- Go to transaction code SE63
- Click Other Text. (The loop should start here. It is also possible to start the loop on SSF interface by using keystroke F3 command)
- Smartforms information in the excel file is filtered by the bot. Smartforms information is appended to the internal table using the method Deep Structure. The loop count is determined by the length of the Deep Structure.
- The SSF object is found by clicking the search button.
- Smartforms object information is entered in the SSF interface.
- It will appear in two GUI Containers. The 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 the original structure of the Smartforms.
- The texts of Paragraph type which do not start with ‘/’ in the Bottom Container are compared with the data in the excel file and the translations are made line by line.
- After the bot completes the translation process click the ‘Save and Active’ button.
5.1.4.Adobeforms
- Go to transaction code SE63.
- Click Other Text. (The loop should start here. It is also possible to start the loop on the PDFB interface by using keystroke F3 command)
- Adobeforms information in the excel file is filtered by the bot. Adobeforms informations is appended to the internal table using the method Deep Structure. The loop count is determined by the length of the Deep Structure.
- It will appear in two GUI Containers. The container at the top is the original structure of the object. The original structure of the object is copied by clicking Copy Source Text (SHIFT F8).
- The data in 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 the path we have set (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.
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 Flow | Check |
Message Class | X |
Data Element | X |
Adobe Forms | X |
SmartForms | X |
Domain |
- Message
Message Class | Message Number | Source Text | Target Text | Source Lang | Target Lang |
ZMO_TEST | 000 | No data found. | keine Daten gefunden | EN | DE |
ZMO_TEST | 001 | Please choose the company code. | Lütfen şirket kodunu seçin. | EN | TR |
ZMO_TEST | 002 | Tax number is not correct. | Vergi numarasi doğru değil. | EN | TR |
- Data element
Data Element | Source Text | DTEXT(55) | REPTEXT(40) | SCRTEXT_L(40) | SCRTEXT_M(20) | SCRTEXT_S(10) | Source Lang | Target Lang |
ZMO_DE_01 | Name and surname | Adı Soyadı | Adı Soyadı | Adı Soyadı | Adı Soyadı | Ad.Soyad. | enUS | trTR |
ZMO_DE_02 | Adress Information | Adres Bilgileri | Adres Bilgileri | Adres Bilgileri | Adres Bilgileri | Adres Blg | enUS | trTR |
ZMO_DE_03 | Phone Number | Telefon Numarası | Telefon Numarası | Telefon Numarası | Telefon Numarası | Tel.No | enUS | trTR |
- Adobeforms
Adobe Forms Name | Source Text | Target Text | Source Lang | Target Lang |
ZMO_TEST12 | enUS | deDE | ||
ZMO_TEST12 | INVOICE NO | RECHNUNG NR | enUS | deDE |
ZMO_TEST12 | INVOICE DATE | RECHNUNGS DATUM | enUS | deDE |
ZMO_TEST12 | SALES ORDER NO/DATE | VERKAUFSAUFTRAG NR/DATUM | enUS | deDE |
- Smartforms
Smartforms | Source Text | Target Text | Source Lang | Target Lang |
ZMO_DENEME | enUS | trTR | ||
ZMO_DENEME | Plate Number: | Plaka Numarası: | enUS | trTR |
ZMO_DENEME | Region | Bolge | enUS | trTR |
ZMO_DENEME | Waybill Number: | Irsaliye No: | enUS | trTR |
ZMO_DENEME | Region | Bolge | enUS | trTR |
ZMO_DENEME | Amoung of Contrat: | Kontrat Miktarı: | enUS | trTR |
ZMO_DENEME | Material: | Malzeme: | enUS | trTR |
ZMO_DENEME | Driver Name: | Sürücü Adı: | enUS | trTR |
ZMO_DENEME | Date: | Tarih: | enUS | trTR |
ZMO_DENEME | Weighing No: | Tartım No: | enUS | trTR |
ZMO_DENEME | TEL : E-MAIL: | TEL : E-MAIL: | enUS | trTR |
ZMO_DENEME | WEIGHBRIDGE RECEIPT | TARTIM FISI | enUS | trTR |
ZMO_DENEME | Weighbridge No : | Irsaliye No: | enUS | trTR |
ZMO_DENEME | Company Name: | Sirket : | enUS | trTR |
ZMO_DENEME | Amount of Coming: | Gelen Miktar: | enUS | trTR |
ZMO_DENEME | Amount of Remaining: | Kalan Miktar: | enUS | trTR |
ZMO_DENEME | Quality Inspection Lot: | Kalite Muayene Lotu: | enUS | trTR |
ZMO_DENEME | PO number: | Satin Alma No: | enUS | trTR |
ZMO_DENEME | Carrier: | Nakliye | enUS | trTR |
- Request
Request Description | Processing Date | Processor |
06.07.2021 Translation | 6.07.2021 | mokay |
Check out our “Translation in Batch Powered by SAP iRPA” demo to see the implementation of this project.