Liquid UI - WS Reference Library

file()


Purpose

With file(), you can assign alias to SAPWR (SAP Web Repository) files.

The file() command is used to assign short names - also called aliases - to scripts housed in a SAP Web Repository (SAPWR). This command is very useful since SAPWR set a limit of thirty characters on a file name.


Syntax

file("long_filename",{“alias”:"short_filename"});
Note: The file() command is placed in the esession.sjs file if such a file is present. If the scripts are housed in SAPWR, the rfcconnect command must include a 'Client=' statement in the guixt.sjs file.


Options

The file() command takes the following options:

alias

This is used to specify the short filename that will be used instead of the original file name. The syntax is as follows:

{"alias":"shortFilename"}

Assigning an Alias

The file command can be used to assign aliases to files.

In the following example, we will assign an alias to a file in SAPWR with a very long file name.

  1. Create a file in SAPWR with the following filename:

    Purpose

    an_extremely_and_over_the_top_lengthy_script_filename.sjs

  2. Open the 'esession.sjs' file and enter the following code. Create the file if it does not already exist.
    file("an_extremely_lengthy_script_filename.sjs",{“alias”:"longFile.sjs"});
  3. Save the file.

You should now be able to access the file using the alias instead of the actual file name.

Using Regular Expressions

The file() command can be used with regular expressions.

In the following example, we will use a regular expression.

  1. Create a file in SAPWR with the following filename, ZGUIXT.E0100.sjs
  2. Open the 'esession.sjs' file and enter the following code. Create the file if it does not already exist.
    file(/Z.GUIT.SAPLSMTR_NAVIGATION.E0100/,{"alias":"sessmgr"});
  3. Save the file.

You can now access the file using the alias 'sessmgr' instead of the actual file name.

Using a String

The file() command can be used with either strings or with regular expressions. In the following examples we will demonstrate the various usages.

In the following example, we will use a string.

  1. Create a file in SAPWR with the following filename, ZGUIXT.E0100.sjs
  2. Open the 'esession.sjs' file and enter the following code. Create the file if it does not already exist.
    file("Z.GUIXT.SAPLSMTR_NAVIGATION.E0100.sjs",{"alias":"sessmgr"});
  3. Save the file.

You can now access the file using the alias 'sessmgr' instead of the actual file name.