Fetch ECC table data into BW using RFC function Module

In ECC some mapping tables are available.

Copy those table data into BW.

Implementation Logic in BW

This can be achieved in 2 ways:

  1. 1. create table based extractor in ECC and load data into BW.
  2. 2. Copy table data dirctly from ECC to BW using RFC function Module ‘RFC_GET_TABLE_ENTRIES’.

I tried to explain second approch here.

Logic

   CALL FUNCTION ‘RFC_GET_TABLE_ENTRIES’ DESTINATION  destination   ****** destination is RFC destination/ system from which data to be fetched

EXPORTING
*       BYPASS_BUFFER           = ‘ ‘
*       FROM_KEY                        = ‘ ‘
*       GEN_KEY                           = ‘ ‘
*       MAX_ENTRIES                  = 0
table_name                         = table_name 
****** Name of table of which we want to fetch the data
*       TO_KEY                               = ‘ ‘
*     IMPORTING
*       NUMBER_OF_ENTRIES   =
TABLES
entries                                    = lt_tab1
EXCEPTIONS
internal_error                           = 1
table_empty                             = 2
table_not_found                      = 3
OTHERS                                  = 4
.
IF sy-subrc <> 0.
CASE sy-subrc.

      WHEN 1.
MESSAGE e001.
RAISE internal_error.
WHEN 2.
MESSAGE e002.
RAISE table_empty.
WHEN 3.
MESSAGE e003.
RAISE table_not_found.
WHEN OTHERS.
MESSAGE e004.
RAISE others.
ENDCASE.
ENDIF.
**** data returned in FM is in string format, we need to create table structure dynamically and then use that data

* create field structure

CALL FUNCTION ‘LVC_FIELDCATALOG_MERGE’
EXPORTING
*     I_BUFFER_ACTIVE                =
i_structure_name                    = table_name
*     I_CLIENT_NEVER_DISPLAY = ‘X’
*     I_BYPASSING_BUFFER        =
*     i_internal_tabname                 =
CHANGING
ct_fieldcat                                = lt_fcat
EXCEPTIONS
inconsistent_interface = 1
program_error             = 2
OTHERS                     = 3.
IF sy-subrc <> 0.
CASE sy-subrc.
WHEN 1.
MESSAGE e005.
WHEN 2.
MESSAGE e006.
WHEN OTHERS.
MESSAGE e007.
ENDCASE.
ENDIF.

* Generate Dynamic table for field catalog
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = lt_fcat
IMPORTING
ep_table        = lt_dyn_table.

ASSIGN lt_dyn_table->* TO .
CREATE DATA ls_dyn_struct LIKE LINE OF .
ASSIGN ls_dyn_struct->* TO .

LOOP AT lt_tab1 INTO wa_tab1.
= wa_tab1.
APPEND TO .
ENDLOOP.

MODIFY table_name FROM TABLE .
IF sy-subrc = 0.
l_success = 1.
ENDIF.

Advantages of this approach:

  1. 1. We can store data in transparent table (se11 z table).
  2. 2. IF data volume is fixed and small it takes less time than normal extraction process

Disadvantages of this approach:

  1. 1. If data volume is high and increasing over period of time, internal table memory errors may occur.

New NetWeaver Information at SAP.com

Very Helpfull

 

 

User Rating: Be the first one !