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 filename - This option is used to specify the dll filename from which the function is called. |
|
"in.parameter": value - This option is used to send a parameter to the function using the call() command. |
|
"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": 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.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 |
|
in.parameter |
|
out.parameter |
|
currentuser |
Note: The currentuser option cannot be used with a single-sign on the configuration. |
table.parameter |
|
Example
Making a function call
- 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});
- Create an inputfield to display the resulting message:
inputfield([2,20],"1.Message", [2,50], {"name":"z_type","size":"70"});
- The screen now appears as follows:
- 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)) }
- 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
-
Calling BAPIs and using ABAP Packed Structures
By using the call command with extra structure object, you can get a 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 the call() in practical.
-
Convert user entered value to decimal format with the call()
-
Determine authorizations using SAP Roles and Profiles with the call()
-
Integrating Windows List View Control with SAPGUI and call()