Documente Academic
Documente Profesional
Documente Cultură
One of the key feature in SAP R/3 ecc 6.0 onwards is that the BADI can be assecced without implementation.
Steps:
Step 2.) Create BADI by giving BADI name and short description
step 3.) Save your BADI definition and Enhancement Spot. Click on Interface
step 5.) Double click on the Interface and create a method like GET_FLIGHT_DATA and activate the interface.
step 6.) In the main screen of SE18 where we had created BADI, define a Fall Back Class and give a z_class name and press enter ..
The class will automatically inherit the methods of the interface defined. ( ie Z_BADI_INTERFACE ).
Step 7.) Double click on the method and write the code.
Step 8.) Save and Activate the Enhancement Spot and the BADI.
Step 9.) In the Application use ABAP statements GET BADI, CALL BADI to Access Badi Objects . Following is the code to access the BADI
*&---------------------------------------------------------------------*
*& Report YH1328_BADI_FLIGHT_TEST
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT yh1328_badi_flight_test.
*&---------------------------------------------------------------------
*& Parameters declaration
*&---------------------------------------------------------------------
PARAMETERS:
p_carrid TYPE scarr-carrid, " Airline code
p_connid TYPE sflight-connid, " Connection number
p_fldate TYPE sflight-fldate. " Flight date
*&---------------------------------------------------------------------
*& Internal table declaration
*&---------------------------------------------------------------------
DATA:
lt_flight TYPE STANDARD TABLE OF sflight.
*&---------------------------------------------------------------------
*& Field string declaration
*&---------------------------------------------------------------------
DATA:
fs_flight LIKE LINE OF lt_flight.
*&---------------------------------------------------------------------
*& Create instance for BADI
*&---------------------------------------------------------------------
DATA:
w_flight TYPE REF TO z_badi_test.
*&---------------------------------------------------------------------
*& START-OF-SELECTION EVENT
*&---------------------------------------------------------------------
START-OF-SELECTION.
GET BADI w_flight. " Access badi objects
*& Call BADI
CALL BADI w_flight->get_flight_data
EXPORTING
carrid = p_carrid
connid = p_connid
fldate = p_fldate
RECEIVING
t_flight = lt_flight.
LOOP AT lt_flight INTO fs_flight.
WRITE:
/ fs_flight-carrid,
fs_flight-connid,
fs_flight-fldate,
fs_flight-price,
fs_flight-seatsmax,
fs_flight-seatsocc.
ENDLOOP. " LOOP AT lt_flight INTO fs_flight