Skip to Content
Author's profile photo Former Member

Fetch ECC table data into BW using RFC function Module

Business Requirement:

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 <l_dyn_table>.
  CREATE DATA ls_dyn_struct LIKE LINE OF <l_dyn_table>.
  ASSIGN ls_dyn_struct->* TO <l_dyn_struct>.

  LOOP AT lt_tab1 INTO wa_tab1.
    <l_dyn_struct> = wa_tab1.
    APPEND <l_dyn_struct> TO <l_dyn_table>.
  ENDLOOP.

  MODIFY table_name FROM TABLE <l_dyn_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.

Assigned Tags

      5 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member

      Thanks Deepti...Nice document..

      Author's profile photo Varsha Mishra
      Varsha Mishra

      Thanks for sharing deepti ..good info

      Author's profile photo Kamal Mehta
      Kamal Mehta

      Thanks.

      Here we are extracting all the records on daily basis from the application tables that means full update into BW .

      Author's profile photo Martin Grob
      Martin Grob

      good document

      thanks for making it..

      Author's profile photo Krishna Chaitanya
      Krishna Chaitanya

      Thanks for sharing.  As i am searching for the same.

      Regards,

      Krishna Chaitanya.