Internal and External Data Formats 
Use
BAPIs are not end user interfaces, they are programming interfaces that can be used in diverse application areas, for instance, to connect non-SAP systems and PC products to the R/3 System. To meet the requirements of this diverse range of applications, a common strategy for representing data in the BAPI interface must be used.
General Guidelines
Fields in BAPI parameters must be presented in the internal form used in the database and not in a form formatted in the BAPI interface.
A number of exceptions to these guidelines exist. These are described below.
For example, the date in a BAPI must be in the format used internally, YYYYMMDD, where YYYY is the year, MM the month and DD the day.
The graphic below shows the BAPI programming interface where data is transferred at the source code level and not at the application interface level.
BAPI Programming Interface
Exceptions
There are exceptions where the calling program has to map and convert the data between the internal and external data formats in a BAPI.
For these exceptions you can generate function modules that can map and, if required, convert between the internal and external data formats. The section
Converting Between Internal and External Data Formats describes how to generate these function modules. You can use these function modules in the source code of your BAPI for the following:These exceptions are:
In an R/3 System a currency amount field can only be used when accompanied by a currency code. Only then can the decimal point be set correctly. A currency code field must be assigned to each currency amount field. For example, two yen are stored as 0.02 in the field of data type CURR in the database. Non-SAP systems will not understand this syntax.
All R/3 currency data types have two digits after the decimal point, even though currencies do exist with three digits after the decimal point.
For these reasons, the data type CURR cannot be used in the BAPI interface. Adhere to the following guidelines when using currency amount fields in BAPIs:
You can use two function modules for this conversion. The function module BAPI_CURRENCY_CONV_TO_EXTERNAL converts currency amounts from R/3 internal data formats into external data formats. The function module BAPI_CURRENCY_CONV_TO_INTERNAL converts currency amounts from external data formats into internal data formats.
Like currency amount fields, the decimal point in quantity fields and unit of measurement fields must be converted correctly.
A field to indicate the amount or the unit of measure must be assigned to all amount and quantity fields.
Quantity fields have no standard domain that can be used for BAPI structures.
In some situations an internal technical key is maintained in the database alongside the external key. Examples are work breakdown structure plans or networks in project systems.
You must always use the external key in the BAPI interface.
To convert activity codes in networks, the following function modules are provided:
These conversion transactions are not included in the transactions described in the section
In R/3 Systems ISO codes are currently supported for language, country, currency, and unit of measure fields.
If you use one or more of these fields in your BAPI you have to make two fields available for each of these fields in the BAPI interface: one field containing the SAP code and another containing its corresponding ISO code. Use the naming convention, Fieldname_for_SAPCode_ISO for the field containing the ISO code.
For example, the field LANGU contains the language key used internally in R/3, for instance E. The corresponding field for the ISO code would then be named LANGU_ISO and would contain the corresponding ISO code EN.
Implement the BAPI as follows:
Use the domains below for the ISO codes:
Domains for SAP internal codes and ISO codes
Size |
ISO Code Domain |
SAP Code Domain |
Currency key |
isocd |
waers |
Quantity unit |
isocd_unit |
meins |
Language key |
laiso |
spras |
Country key |
intca |
land1 |
For every domain there is a data element of the same name.
In accordance with ISO standard 8601 dates and times must be transferred between two external systems in Universal Coordinated Time (UTC). UTC is the equivalent of the formerly used term GMT (Greenwich Mean Time) and is now used as the unique time reference across the globe.
In the BAPI interface you have to provide a field for the time zone, that is, the location of an object with respect to its local time, as well as a field for the UTC time stamp. You can also specify the local time.
The naming convention for the UTC time stamp field is <Field name for time zone>_ISO.
The following types are provided for dates and time.
These fields are:
For more information see Address Parameters.
BAPIs for Converting Between Internal and External Data Formats (Domain Conversion)
BAPIs are programming interfaces in which, with a few exceptions, only the internal data format should be used. However, application programmers calling a BAPI from within their program may sometimes require the external format, for example, to display data on the screen. In such cases the calling program must be able to convert between the internal and external data formats.
The calling program can use conversion BAPIs to convert data into the required format: These are described in the BAPI User Guide in the section
Service BAPIs for General BAPI Functions.