Purpose |
With
Call
you can call a
function from a GuiXT script or from an InputScript. The function can
either be an SAP function module on the SAP application server,
or a local dll-function (on the frontend PC), implemented in VC++ or a
similar language. For function modules we use SAP's RFC (Remote Function Call)
interface technology. Please observe that the Call-command via RFC requires the component "InputAssistant". Further functions (like automatic format conversion, bundling of calls) are provided by the "Open Call" interface of GuiXT, see below. |
|||||||||||||||||||||||||||
Examples | Call
"BAPI_USER_GET_DETAIL"
in.USERNAME="MEYER"
out.LOGONDATA="UserLogonData" The SAP function module "BAPI_USER_GET_DETAIL" is called via RFC.
|
|||||||||||||||||||||||||||
Format | RFC call
Call "funcname" in.Name1="value1" in.Name2="value2" ... out.Name1="vname1" out.Name2="vname2" ... ... table.Name1="tab1" table.Name2="tab2" ... dll call: Please observe:
|
|||||||||||||||||||||||||||
Format of the OpenCall Interface |
Call
"functionname"
export.name1="vname1"
export.name2="vname2"
... import.name3="vname3"
import.name4="vname4"
....
Please note:
When converting existing call instructions to the Open Call interface, please note the following:
|
|||||||||||||||||||||||||||
Format of the OpenCall Interface for ABAP OO Remote Method Call |
Call
"classname.methodname"
object="objname"
export.name1="vname1"
export.name2="vname2"
... import.Name3="vname3"
import.name4="vname4"
....
Calls the method "methodname" of the specified object. The object
must belong to the class "classname". If object= is not specified, a
static class method is called. Example: ....
// start a request bundle
// Create ALV object
// allow all standard functions
// Set Title
// Set popup position
// display popup
// run all calls |
|||||||||||||||||||||||||||
Additional options |
|
|||||||||||||||||||||||||||
Additional
options for the case of the Open Call interface |
|
|||||||||||||||||||||||||||
Calling an SAP function module | Passing
parameters Call "funcname" in.Name1="value1" in.Name2="value2" ... out.Name1="vname1" out.Name2="vname2" ... table.Name1="tab1" table.Name2="tab2" ... Restrictions
Handling of tables
Example 1: Call
"BAPI_USER_GET_DETAIL"
in.USERNAME="&V[_user]"
out.LOGONDATA="UserLogonData" Now the variable V[UserGroup] contains the SAP user group. Explanation (see also the interface definition in transaction SE37):
Example 1: Set V[Paramid] "ND9" Set V[Paramva] "Printer2400" // Read user parameters // Clear output parameter table // "found" indicator // Loop through all user parameters Label next_parameterCopyText fromText="ipt" toString="p" line="&V[i]" if Q[ok] Set V[parid] "&V[p](BAPIPARAM1-PARID)"if V[parid=&V[Paramid]] Set V[p](BAPIPARAM1-PARVA) "&V[Paramva]" Set V[found] "X" endif // add parameter to new parameter table CopyText fromString="p" toText="opt" -appendLine // next line Set V[i] &V[i] + 1 goto next_parameter endif // parameter not found: add parameter line Set V[p](BAPIPARAM1-PARID) "&V[Paramid]" Set V[p](BAPIPARAM1-PARVA) "&V[Paramva]" CopyText fromString="p" toText="opt" -appendLine endif // Write back parameters
|
|||||||||||||||||||||||||||
dll Call |
The function is defined, for example, with 2 IN and 3 OUT parameters of the type
__declspec(dllexport) int funcname(char* p1, char* p2, char* p3, char* p4, char* p5)
All parameters (in= and out=)
are passed in the specified order. The maximum length of each
individual string is 4000 characters. Please make sure to specify enough parameters in the
script, otherwise the dll function will access an invalid address.
Example 1: Call "alphanum" Adds leading 0000... to a numeric field. Parameters:
Invocation: Call "alphanum" dll="guixtstring.dll" in="&[Material]" in="8" out="NumMaterial" Examples of results:
Example 2: Call "StripQuotationMarks" Removes the quotation marks from a string. Typically, when generating ASCII text files, double quotation marks are placed around the characters. In SAP ERP, these quotation marks are undesirable. Parameters:
Example: Call "StripQuotationMarks" dll="guixtstring.dll" in="&[QMaterial]" out="SMaterial"
Compiled DLL and Visual Studio Sample Project
You can download and freely use or extend the DLL and the source code.
Please note that you choose the correct target platform in the project depending on whether you want to build for the 32bit or 64bit
version of GuiXT or the SAP GUI.
Download Visual Studio Project Download guixtstring.dll (32bit) Download guixtstring.dll (64bit) |
|||||||||||||||||||||||||||
Tips & Tricks |
|
|||||||||||||||||||||||||||
Components | GuiXT + InputAssistant (with dll: just GuiXT necessary) |