Prerequisites
- Products: Liquid UI WS, Liquid UI Server or Local DLL, Client Software
- Commands: text(), textbox(), pushbutton(), message(), inputfield(), columnheader()
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 given 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 Inerface
//Create the SESSION.sjs file inside your scripts folder.
//Now, let’s add the Liquid UI script to the above file and save it
Customization
The SESSION.sjs file identifies the language you have used to log into SAP and loads the required script file based on the language. Here, we used the switch command to work on multiple languages.
switch(_language) { case 'E': //Load English language file load('languageEN.sjs'); //Set logonlanguage to English logonLanguage = languageEN; break; case 'F': //Load French language file load('languageFR.sjs'); //Set logonLanguage to French logonLanguage = languageFR; break; case 'S': //Load Spanish language file load('languageES.sjs'); //Set logonLanguage to Spanish logonLanguage = languageES; break; default: //Default to English if language code is not recognized logonLanguage = languageEN; break; }
// Create the file languageEN.js inside your scripts folder.
//Now, let’s add the Liquid UI script to the above file and save it.
Note: English is the default language on the SAP login 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" "sales": "P[Sales]", "itemdetails": "P[Item detail]", "or dparty": "P[Ordering party]", "procurement": "P[Procurement]", "shipping": "P[Shipping]", "reasonforrej": "P[Reason for rejection]", "listofsalesorders": "P[list of sales orders]" }, "pageexists": {"sales": "Sales"
}
};
// Create the languageES.sjs file inside your scripts folder.
//Now, let’s add the Liquid UI script to the above file and save it.
The languageES.js file is the script file to display the texts on the SAP screen in Spanish. When you input the language key as ES, the entire transaction 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 the languageFR.sjs file inside your scripts folder.
//Now, let’s add the Liquid UI script to the above file and save it.
The languageFR.js file is the script file to display the texts on the SAP screen in French. When you input the language key as FR, the entire transaction 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 the SAPMV45A.4001.sjs file inside your scripts folder for deleting control and adding elements that appear on the transaction screen.
//Now, let's add Liquid UI Script to the above file and save it.
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 push button 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); }
SAP Process
To verify the multi-language structure for language-independent scripts, we’ll walk you through the following.
- Log into SAP GUI, and specify the language key (e.g., EN for English) to customize the screen.
- Now, navigate to VA02 screen enter the value in the Order input field, and hit Enter, then the following screen appears.
- Log on to your SAP GUI with the login credentials, and mention the language key as ES, the language key for Spanish.
- Now, navigate to the VA02 second screen to check the customizations in the text, and then the following screen appears.
- Similarly, let’s check whether we are getting the same customizations when we log in with the French language.
- 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.