Show TOC Anfang des Inhaltsbereichs

Diese Grafik wird im zugehörigen Text erklärt Beispiel für das Füllen des ExtensionIn-Parameters  Dokument im Navigationsbaum lokalisieren

REPORT REPORT_TRAVELAGENCY .

 

************************************************************************

*                                                                      *

*  Example to show how to fill the EXTENSION_IN Structure in a BAPI    *

*  which uses table extension as possibility for a customer to extend  *

*  SAP functionality without modification.                             *

*                                                                      *

*  In this example we use the BAPI                                     *

*           BAPI_TRAVELAGENCY_CREATE                                   *

*                                                                      *

************************************************************************

 

data x_agencynumber type bapisadeta-agencynum.

data x_agencydata_in type bapisadtin.

data x_cus_data_in type travelag.

data begin of x_extensionin occurs 0.

     include structure bapiparex.

data end of x_extensionin.

data begin of x_return occurs 0.

     include structure bapiret2.

data end of x_return.

data x_bapi_te_sa type bapi_te_sa.

 

* only for this example we hardcode the data, normaly you would

* write an own transaction to fill this fields.

x_agencydata_in-name       = 'Galactical Travel Agency'.

x_agencydata_in-street     = 'Lunatic'.

x_agencydata_in-postbox    = '123456'.

x_agencydata_in-postcode   = '984735'.

x_agencydata_in-city       = 'Luna 1'.

x_agencydata_in-country    = 'Moon'.

x_agencydata_in-region     = 'Moon'.

x_agencydata_in-telephone   = '30457584375374957'.

x_agencydata_in-url        = 'http://lunatic.com'.

x_agencydata_in-langu      = 'E'.

 

x_cus_data_in-planetype    = 'Space Shuttle'.

x_cus_data_in-company      = 'Moon Shuttle Service'.

x_cus_data_in-seatsmax     = 24.

 

* now fill the key of the extension parameter

move 'BAPI_TE_SA' to x_extensionin-structure.

* now normally you fill the object key into the BAPI_TE_SA structure

* but in this case the create will give internal the key for the new

* travel agency, so here only a clear

clear x_bapi_te_sa-agencynum.

* but the other fields we have, so fill

move-corresponding x_cus_data_in to x_bapi_te_sa.

* fill the fields in the data part of x_extension in, take care that

* you have 960 bytes in pieces of 240 byte. Luckily we have less than

* 240 byte so we need only one move.

move x_bapi_te_sa to x_extensionin-valuepart1.

append x_extensionin.

 

CALL FUNCTION 'BAPI_TRAVELAGENCY_CREATE'

     EXPORTING

          AGENCYDATA_IN = x_agencydata_in

     IMPORTING

          AGENCYNUMBER  = x_agencynumber

     TABLES

          EXTENSIONIN   = x_extensionin

          RETURN        = x_return.

          .

*

write : / 'Return messages in handling the bapi.'.

loop at x_return.

  write : / 'return..:', x_return.

endloop.

write : / 'The new travel agency has the number...:', x_agencynumber.

 

Ende des Inhaltsbereichs