Liquid UI - WS Reference Library

call()


Purpose

With call(), you can call a function in WS.

Functions called with this command are always SAP function modules on the SAP server itself. The call command is useful when users need to use a standard BAPI or when a user wishes to link a screen element to an action to be executed. This method also works well with functions.


Syntax

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


Options

The call() command takes the following options:

"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 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 logon data will be used instead of the RFC logon 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 into an array.


Options Detail

Goto the SAP Easy Access Screen and open the 'SAPLSMTR_NAVIGATION.E0100.sjs' Script File. All additions will be made to this file. The console window of this screen appears for the following options as shown below:

in.parameter

  1. This option is used to send 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 values of the parameters from the BAPI function using the call() command. As per the code, this option returns the name of the company from the RETURN table using the call() method.

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 an 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 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 we will specify that we will return row values up to 3000 characters in width:
  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

  • Calling BAPIs and using ABAP Packed Structures

    By using the call command with extra structure object, you can get different type of data from the native SAP Function Module.

    rfcResult = call("BAPI_ALM_ORDER_GET_DETAIL",{"in.NUMBER":"000000815289","out.ES_HEADER(type:z_BAPI_ALM_ORDER_HEADER_E)":"z_bapi_order_header","table.ET_OPERATIONS(width:3000,type:z_BAPI_ALM_ORDER_OPERATION_E)":"z_bapi_order_operations"});

    Learn more about Call command in practical.