The Open Call Interface provides and assumes all data to be in
external format; this is normally the appropriate format for the UI layer.
For particular cases you can use a special notation to exchange field values
in the internal
format.
Data format in the Remote Function Call
The
standard SAP RFC interface uses the internal data format, e.g. you need
to add leading zeros in customer numbers and specify and obtain date
fields in the format YYYYMMDD.
This is not obvious when you work
with the SE37 test environment, since you enter the test input in
external format and also see the test results in external format. As an
example let us look at the SE37 display of a customer order header in the
function module BAPI_SALESORDER_DETAILBOS.
This is how it looks when
your SAP logon language is English and your user defaults are "decimal
point" and date format "MM-DD-YYYYY":
Here DOC_ means "Document type".
A user with German logon
language, decimal separator "comma" and date format
DD.MM.YYYY will see a different test output:
In contrast to both screens above, the standard RFC returns internal values, e.g.
Document number: 0000000701 Rec_Date: 20190512 Document type: TA
Net Value: ######## (packed field, "unpack" option needed)
The SAP conversion exits are special function modules; they consist
mainly of
Removing and adding leading zeros if the given string is numeric ("alpha"
conversion)
Date reformatting according to user settings, e.g. MM-DD-YYYY
Number reformatting (decimal and group separators) according to
user settings
Language dependent conversions, e.g. internal order type "TA" to
English "OR" or French "CMD"
Database driven conversions, e.g. for a functional location
"SWC-EC" a database lookup is performed to find the internal
value "?0100000000000005483", and vice versa
Configurable layout rules e.g. for the project number
Further conversions can be implemented such as a special
material number layout
If you develop GuiXT scripts for users who work in different
languages and with different settings for date and number display, the
conversion rules need special attention and testing. Some rules are not
obvious; for example, an order type "TA" will work in English with the
same meaining as "OR" as long as no "TA" order type is created for
English (table TAUUM, transaction OVA3).
The Open Call Interface always provides the results in external
format as shown in the SE37 environment, i.e. it automatically applies
the appropriate conversion rules for input and output so that you can immediately
work with the UI-format of all values.
There are cases where you prefer to send or receive a value in the
internal format; this is supported with the notation "*xxxx"
instead of "xxxx" in the definition of a GuiXT structured
variable or table variable. You may also use both notations
simultaneously in one stucture if you need a value both in internal and
in external format.
Example We want to read the "ship-to party" of
a customer order using BAPI_SALESORDER_GETDETAILBOS.
The following Version 1 works well for users with
English logon, but will not work in other logon languages if the partner role
"SH" is not defined or has a different meaning in this
language:
GuiXT
// create structures/tables with the fields we need
CreateStructure V[orderpartner] partn_role itm_number customer
CreateTable V[orderpartners] include=V[orderpartner]
// read partner roles for given order number V[aufnr]
Call "BAPI_SALESORDER_GETDETAILBOS" _
export.SALESDOCUMENT="aufnr" _
import.ORDERPARTNERS="orderpartners"
// search "ship-to" partner
CreateStructure V[mysearch] partn_role itm_number
Set V[mysearch.partn_role] "SH"
Set V[mysearch.itm_number] "000000" // header partners
// search partner table
ReadRow V[orderpartner] table=V[orderpartners] match=V[mysearch]
if Q[ok]
Message "Ship-to partner: &V[orderpartner.customer]"
else
Message "Ship-to partner not found"
endif
Version 2 uses the notation "*partn_role".
This requests the internal value of the partner role and thereby will
work in any language:
GuiXT
// create structures/tables with the fields we need
CreateStructure V[orderpartner] *partn_role itm_number customer
CreateTable V[orderpartners] include=V[orderpartner]
// read order
Call "BAPI_SALESORDER_GETDETAILBOS" _
export.SALESDOCUMENT="aufnr" _
import.ORDERPARTNERS="orderpartners"
// search "ship-to" partner
CreateStructure V[mysearch] *partn_role itm_number
Set V[mysearch.*partn_role] "WE" // WE from German "Warenempfänger"
Set V[mysearch.itm_number] "000000" // header partners
// search partner table
ReadRow V[orderpartner] table=V[orderpartners] match=V[mysearch]
if Q[ok]
Message "Ship-to partner: &V[orderpartner.customer]"
else
Message "Ship-to partner not found"
endif
Formatting rules in the case of *xxxx notation
All string type fields are assumed to be and are returned using the
internal format, without applying any conversion rules
Numbers (e.g. decimal packed format or integer) are formatted as
a series of digits, without group separator, but with a decimal
point if decimal places are defined in the SAP data dictionary or
for floating point values