Step By Step Procedure to Enhance Standard BI/BW Extractor Using BADI

...Previous

method IF_EX_RSU5_SAPI_BADI~DATA_TRANSFORM.
  DATA:
        lt_data   TYPE TABLE OF MC06M_0ITM,
        v_zfbdt   TYPE DZFBDT,
        v_zbd1t   TYPE DZBD1T,
        v_due_dt  TYPE faedt_fpos.
  FIELD-SYMBOLS:
        <ls_data> TYPE MC06M_0ITM.
***check the correct data source. If not exit.
  CHECK i_datasource = '2LIS_06_INV'.
  lt_data[] = c_t_data[].
  loop at lt_data assigning <ls_data>.
    clear:v_zfbdt, v_zbd1t,v_due_dt.
    SELECT single zfbdt zbd1t  FROM bsak
          INTO (v_zfbdt, v_zbd1t)
          WHERE bukrs = c_bukrs AND
                lifnr = <ls_data>-lifnr AND
                gjahr = <ls_data>-gjahr AND
                belnr = <ls_data>-belnr AND
                gsber = <ls_data>-gsber.
    if sy-subrc = 0.
**********************************************
      " Extract the due date                     *
**********************************************
      CALL FUNCTION 'NET_DUE_DATE_GET'
        EXPORTING
          i_zfbdt = v_zfbdt
          i_zbd1t = v_zbd1t
          i_zbd2t = 0
          i_zbd3t = 0
          i_shkzg = 'H'
          i_rebzg = <ls_data>-belnr
          i_koart = <ls_data>-koart
        IMPORTING
          e_faedt = v_due_dt.
      MOVE v_due_dt TO <ls_data>-zzdue_date.
    else.
      delete lt_data.
    endif.
  endloop.
  clear: c_t_data[].
  c_t_data[] = lt_data[].
endmethod.
  endloop.
  clear: c_t_data[].
****Modified data passed back to the Extraction table.
  c_t_data[] = lt_data[].
endmethod.

NOTE:

Now you see in the above code, i have not used modify statement because when I loop the internal table, the field symbol points directly to the memory of internal table.

So during loop if i assign any value to the field symbol then it directly changes the internal table value, so there won’t be any need to use modify statement. That is the advantage of using field symbol. Use whenever possible.
 

Implementation of created BADI

1. Go to BADI Definition “RSU5_SAPI_BADI” using T-code SE18 and create implementation “ZBW_0PROF_ATTR” or you can use T-code SE19 and create the implementation.  

 

 

2. Go to the Interface tab and enter the created class “ZCL_MM_BW_2LIS_06_INV” in the Implementing class name field and activate.  

 

Testing through RSA3

Go to RSA3 and execute the DataSource “2LIS_06_INV” and check the extracted data to see the data to the enhanced field is filled.  

Data output  

Note if the data is not extracted correctly or any issue, you can debug and correct your code accordingly.

Please send us your feedback/suggestions at webmaster@SAPTechnical.COM 

HomeContribute About Us Privacy Terms Of Use • Disclaimer • SafeCompanies: Advertise on SAPTechnical.COM | Post JobContact Us  

Graphic Design by Round the Bend Wizards

footer image footer image