Liquid UI - Documentation - 7.03 call()

7.03 call()


Purpose

With call(), you can make a call to a function in SAP GUI.

Using this command, SAP function modules existing on the SAP application server or the local dll files are called. The call command is useful when a user needs to use a standard BAPI or wishes to link a screen element to an action to be executed. This command also works well with functions.


Syntax

Format 1: You can make a call to the remote function by specifying the IN parameters first and OUT parameters later.

call('function_name',{"in.parameter":"value","out.parameter":"value", "table.parameter":"value", "currentuser":true});
 

Format 2: You can either mention the directory path or the relative path for the VBScript file. In our example, we are using the relative path, which means the command will look only in the specified script directory.

call('function_name',{"dll":"dll-filename",in.parameter":"value","out.parameter":"value", "table.parameter":"value", "currentuser":true});
 


Options

The call() command takes the following options:

"dll":".."

"dll": dll filename - This option is used to specify the dll filename from which the function is called.

"in.parameter":".."

"in.parameter": valueThis option is used to send a parameter to the function using the call() command.

"out.parameter":".."

"out.parameter": value - This option is used to specify the values to be returned from the data table and to identify the variable where that value will be stored. Multiple out parameters can be returned.

"currentuser":".."

"currentuser": true - This option specifies that the RFC information for the current user's log on data will be used instead of the RFC log on information contained in the guixt.sjs configuration file.

"table.parameter":".."

"table.parameter":table.tablename - This option will return the values of the table, which are accessed using the call command. The value of each row in the table is stored in an array.


Options Detail

Goto the SAP Easy Access Screen and open the 'SAPLSMTR_NAVIGATION.E0100.sjs' script file. The console window of this screen appears, as shown below for the following options:

dll

  1. This option calls a function from the dll file specified in the call() command.

  2. call("GetWeight",{"dll":"GetComWgt", "In":"1", "Out":"z_zprodrec_yield"});
    
  3. As per the code, the GetWeight function is called from the GetComWgt.dll file and displays the in and out parameter values of the called function.

in.parameter

  1. This option sends a parameter to the function using the call command.

  2. call("BAPI_USER_GET_DETAIL",{"in.USERNAME":"&V[_user]","table.RETURN(width:3000)":"zguixt_return"});
    println("name of the user=="+_user); 
    
  3. As per the code, USERNAME is an IN parameter sent to the BAPI function using the call() command.

out.parameter

  1. This option is used to specify the values returned from the data table and to identify the variable where that value will be stored. Multiple out parameters can be returned.

  2. call("BAPI_USER_GET_DETAIL",{"in.USERNAME":"&V[_user]","table.RETURN(width:3000)":"zguixt_return",out.COMPANY":"company"});println("company of the user=="+company);
    
  3. This option returns parameters' values from the BAPI function using the call() command. As per the code, the out parameter returns the name of the company from the RETURN table.

currentuser

  1. This option specifies that the RFC information for the current user's logon data will be used instead of the RFC logon information contained in the guixt.sjs configuration file.

  2. When used, this method will take precedence over an entry in the guixt.sjs for a single RFC user, but in turn is subordinate to an entry in the guixt.sjs configuration file for the rfcconnect array. See rfcconnect for more information.
  3. call("BAPI_USER_GET_DETAIL",{"in.USERNAME":"&V[_user]","table.RETURN(width:3000)":"zguixt_return","currentuser":true});
  4. As per the code, this option displays the RFC information of the current user's logon data.

Note: The currentuser option cannot be used with a single-sign on the configuration.

table.parameter

  1. This option will specify the table that will be accessed using the call() command. The value of each row in the table is stored into an array.
  2. This will specify the table that will be accessed. The value of each row in the table is stored into an array. Width option is used to get the value of each row in the table structure if the total characters in a single row are more than 255 characters. In the following example, we will return data from the table 'RETURN' into the variable 'zguixt_return' and row values up to 3000 characters in width are returned.
  3. call("BAPI_USER_GET_DETAIL",{"in.USERNAME":"&V[_user]","table.RETURN(width:3000)":"zguixt_return"});
     println("return:"+zguixt_return);
    
  4. This option will return the values of the table(RETURN) using the call command.


Example

Making a function call

  1. Create a pushbutton on the Easy Access screen that will make a call to a BAPI function:
    del("X[IMAGE_CONTAINER]");
    pushbutton([2,1] ,"Call Example",{"process":test_call});
  2. Create an inputfield to display the resulting message:
    inputfield([2,20],"1.Message", [2,50], {"name":"z_type","size":"70"});
  3. The screen now appears as follows:
  4. Write a function to call the BAPI function:
    function test_call(){
      call("BAPI_USER_GET_DETAIL",{"in.USERNAME":"&V[_user]","table.RETURN(width:3000)":"zguixt_return"});
      println("return:"+zguixt_return);
      
      for(i=0; i<zguixt_return.length; i++){
        zguixt_var = zguixt_return[i].toString();
        println("TYPE:"+zguixt_var.substring(0,1));
        println("ID:"+zguixt_var.substring(1,21));
        println("NUMBER:"+zguixt_var.substring(21,24));
        println("MESSAGE:"+zguixt_var.substring(24,244));
      }
      set("V[z_type]",zguixt_return[0].toString().substring(24,244))
    }
    
  5. Using the function, we can make a call to the specified BAPI function USER_GET_DETAIL. The input is the username, which is pulled from a table containing the user details. Once the requested data is returned, the function will print the user information into the console and will also display a message on the screen as shown:


Tips and Tricks

  • You can specify the RFC username and password in the WS configuration file (guixt.sjs) which are used to make a function module call in SAP. The password is stored in an encrypted format to ensure security.


Usage details


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