Liquid UI - Documentation - 23.17 Multi-Language Structure for Language independent scripts

23.17 Multi-Language Structure for Language independent scripts


Prerequisites

Purpose

The Multi-Language Structure for language-independent scripts, allows you to quickly implement new languages for existing scripts. The scripts help in displaying the Liquid UI texts in the respective language based on the language key. So, when the user specifies a language key, for example, ES, which is used for Spanish, then the text on the screen will be displayed in Spanish. Similarly, the text will appear on the screen based on the language key input by the user, and that is how we achieve the multi-language structure for language-independent scripts.

In this article, you will learn how to customize your SAP screens using WS scripts to implement multiple languages on SAP GUI. We will walk you through the following steps:


User Interface

Create a file SESSION.sjs and include this file in your scripts folder.

The SESSION.sjs file identifies the language you have used to log into SAP, and loads the required script file based on language. Here, we used the switch command to work on multiple languages.

switch(_language) {
   case 'E':
      load('languageEN.sjs');
      logonLanguage = languageEN;
      break;
   case 'F':
      load('languageFR.sjs');
      logonLanguage = languageFR;
      break;
   case 'S':
      load('languageES.sjs');
      logonLanguage = languageES;
      break;   
   default:
      logonLanguage = languageEN;
      break;
}
 

// Create a file languageEN.js and include this file in your scripts folder.

 

Note: English is the default language that will be displayed if the user doesn't enter a language key on the SAP logon page.

 
  • var languageEN = {
       "inputfield": {   
          "delstatus": "Delivery Status"
       },
       "pushbutton": {      
          "exit": "Exit",                                    
          "gotoeasyaccess": "Goto SAP Easy Access"
       },
       "texts": {      
          "salesdata": "Sales Data",
          "headertxt": "Header Text",
          "matlnum": "Material Number"
       },
       "message": {      
          "msgponum": "Enter PO number"
       },
       "controls": {
          "sales": "P[Sales]",                                 
          "itemoverview": "P[Item overview]",                                 
          "itemdetails": "P[Item detail]",                                    
          "ordparty": "P[Ordering party]",                                    
          "procurement": "P[Procurement]",                  
          "shipping": "P[Shipping]",
          "reasonforrej": "P[Reason for rejection]",
          "listofsalesorders": "P[list of sales orders]"
       },
       "pageexists": {
          "sales": "Sales"
       }
    };
    

// Create a file languageES.sjs and include this file in your scripts folder.

The languageES.js file is the script file that displays the texts on the SAP screen in Spanish. When the user enters the language key ES, the entire transaction on the screen will be displayed in Spanish.

var languageES = {
   "inputfield": {   
      "delstatus": "Status entrega"
   },
   "pushbutton": {      
      "exit": "Salida",                                    
      "gotoeasyaccess": "Ir a SAP Easy Access"
   },
   "texts": {      
      "salesdata": "Los datos de ventas",
      "headertxt": "Texto de cabecera",
      "matlnum": "Número material"
   },
   "message": {      
      "msgponum": "Ingrese el número de pedido"
   },
   "controls": {
      "sales": "P[Ventas]",                                 
      "itemoverview": "P[Resumen de posiciones]",                                 
      "itemdetails": "P[Detalle posición]",                                    
      "ordparty": "P[Solicitante]",                                    
      "procurement": "P[Aprovisionamiento]",                  
      "shipping": "P[Expedición]",
      "reasonforrej": "P[Motivo de rechazo]",
      "listofsalesorders": "P[Lista de pedidos]"
   },
   "pageexists": {
      "sales": "Ventas"
   }
};

// Create a file languageFR.sjs and include this file in your scripts folder.

The languageFR.js file is the script file that displays the text on the SAP screen in French. When the user enters the language key FR, the entire transaction on the screen will be displayed in French.

var languageES = {
   "inputfield": {   
      "delstatus": "Status entrega"
   },
   "pushbutton": {      
      "exit": "Salida",                                    
      "gotoeasyaccess": "Ir a SAP Easy Access"
   },
   "texts": {      
      "salesdata": "Los datos de ventas",
      "headertxt": "Texto de cabecera",
      "matlnum": "Número material"
   },
   "message": {      
      "msgponum": "Ingrese el número de pedido"
   },
   "controls": {
      "sales": "P[Ventas]",                                 
      "itemoverview": "P[Resumen de posiciones]",                                 
      "itemdetails": "P[Detalle posición]",                                    
      "ordparty": "P[Solicitante]",                                    
      "procurement": "P[Aprovisionamiento]",                  
      "shipping": "P[Expedición]",
      "reasonforrej": "P[Motivo de rechazo]",
      "listofsalesorders": "P[Lista de pedidos]"
   },
   "pageexists": {
      "sales": "Ventas"
   }
};

// Create a file SAPMV45A.4001.sjs inside your script folder for deleting control and adding elements that appear on the transaction screen.
//Now, let's start adding Liquid UI Script to the above file.

The following code consists of an if condition, which helps in the deletion of all columns except for the sales column on the screen, then we create a text field textbox and a header text. Further, we update the column name and create an input field named Delete Status. Also, add a pushbutton to allow exit and navigation back to the SAP Easy Access Screen.

if(_page.exists(logonLanguage.pageexists.sales)){
   del(logonLanguage.controls.itemoverview);
   del(logonLanguage.controls.itemdetails);
   del(logonLanguage.controls.ordparty);
   del(logonLanguage.controls.procurement);
   del(logonLanguage.controls.shipping);
   del(logonLanguage.controls.reasonforrej);
   del(logonLanguage.controls.listofsalesorders);

   text(logonLanguage.controls.sales, logonLanguage.texts.salesdata);

   text([0,89], logonLanguage.texts.headertxt,{ "size":20});
   textbox([1,89], [4,125], {"name":"z_va02_hdrtxt", "textfont":"Arial", "textheight":"12", "textweight":"5"});

   columnheader("SAPMV45A_TCTRL_U_ERF_AUFTRAG,2", logonLanguage.texts.matlnum);     //Material column
   inputfield( [4,0], logonLanguage.inputfield.delstatus, [4,17], {"name":"z_va02_delstatussize":22});

   pushbutton([TOOLBAR], logonLanguage.pushbutton.exit, '/nVA02');
   pushbutton([TOOLBAR], logonLanguage.pushbutton.gotoeasyaccess, '/n', {"group":"A+"});
 
   message("W: "+logonLanguage.message.msgponum);
}

To verify the multi-language structure for language-independent scripts, we’ll walk you through the following.

  1. Logon to your SAP GUI with the login credentials, and mention the language key to which you want to customize the screen. Here, we are using EN (English).
     
     
  2. Now, navigate to VA02 second screen, then the following screen appears.
     
     
  3. Logon to your SAP GUI with the login credentials, and mention the language key as ES, the language key for Spanish.
     
     
  4. Navigate to the VA02 second screen to check the customizations in the text. Then, appears the following screen:
     
     

    Similarly, let’s check whether we are getting the same customizations when we logged in with the French language.

  5. Logon to your SAP GUI with the login credentials, and mention the language key as FR, which is the language key for French.
     
     
  6. Navigate to the VA02 second screen to check the customizations in the text. Then, appears the following screen:
     
     

Hence, we have come to know that we can customize the screen using the script for any language.


Can't find the answers you're looking for?