viernes, enero 23, 2009

Campos de extensión de las BAPIs

Directamente copiado del texto de ayuda de los campos ExtensionIn/Out  de las BAPIs:

Txt.brv.
ExtensionIn

Description
With the parameters ExtensionIn and ExtensionOut, it is possible to enhance the interface of a BAPI without modification to achieve the automatic processing of customer-specific data.

The data is passed on in a table. The format of the individual data records of this table is determined via the structure BAPIPAREX. This structure contains several data record fields (VALUEPART1, VALUEPART2 etc.) and a field for the name of an auxiliary structure (STRUCTURE). Because per data record the data is written piecewise consecutively to the data record fields available for the purpose, an auxiliary structure is needed for the interpretation of the data.

In the event that an SAP database table is to be enhanced by additional fields, BAPI table extensions are especially suitable as auxiliary structures. A BAPI table extension can either be already predefined by SAP or created by the customer. Examples of auxiliary structures and BAPI table extensions can be found at the following points:

Description of the various customer enhancement options
Enhancement of BAPI based on existing SAP database tables
Enhancement of BAPI through incorporation of additional customers' own database tables
Enhancement of BAPI by import data that does not show up the database level
Note that only fields of the data type CHAR and similar data types may be used in the BAPI parameter ExtensionIn/ExtensionOut.

If the customer Include contains deviating parameters, the configurable message ME 887 is invoked. However, the data is not adopted in the target structure from the container.

Default
The auxiliary structures have been defined as follows:

Header data:
BAPI_TE_MEOUTHEADER
BAPI_TE_MEOUTHEADERX
Item data:
BAPI_TE_MEOUTITEM
BAPI_TE_MEOUTITEMX
Account assignment data:
BAPI_TE_MEOUTACCOUNT
BAPI_TE_MEOUTACCOUNTX

Ejemplo:
CLEAR le_extensionin.
le_mepoheader-campo_extendido = <valor_del_campo>.
le_extensionin-structure  = 'BAPI_TE_MEPOHEADER'.
le_extensionin-valuepart1 = le_mepoheader.
APPEND le_extensionin TO lt_extensionsin.

CLEAR le_extensionin.
le_mepoheaderx-campo_extendido = 'X'.
le_extensionin-structure  = 'BAPI_TE_MEPOHEADERX'.
le_extensionin-valuepart1 = le_mepoheaderx.
APPEND le_extensionin TO lt_extensionsin.
  CALL FUNCTION 'BAPI_PO_CREATE1'
    EXPORTING
      poheader         = le_header
      poheaderx        = le_headerx
    IMPORTING
      exppurchaseorder = l_numdoc
    TABLES
      return           = lt_return
      poitem           = lt_items
      poitemx          = lt_itemsx
      poaccount        = lt_accounts
      poaccountx       = lt_accountsx
      extensionin      = lt_extensionsin.