cancel
Showing results for 
Search instead for 
Did you mean: 

Could not load data in cube using a generic extractor from a FM

former_member355937
Participant
0 Kudos

Hello Experts,

I created a generic extractor referencing from a function module by customizing the FM RSAX_BIW_GET_DATA_SIMPLE.

When I tested it using the extractor checker (RSA3), it is working fine.

But when I use it as a datasource to load the data result into a cube, for some reasons it is not working.

The extraction took very long time that had exceeded the timeout setting of the infopackage.

It didn't even posted to the PSA table.

The data contains only 9,561 records.

But when I tried limiting the data result of the FM to 10 rows, it worked.

Really need your advice on this.

Thanks in advance!

Jeffrey

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member355937
Participant
0 Kudos

Hello Experts,

For your reference, below is the code that I did. I used another FM to populate the table E_T_DATA.

Until now, I couldn't figure out why the extractor runs forever when running it in an infopackage loading into a cube. But it is working when I am running it through RSA3.

I really need your help on this.

Thanks and Regards,

Jeffrey


FUNCTION ZBW_FM_CUM_PSI_EXTRACTOR.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"     VALUE(I_REQUNR) TYPE  SRSC_S_IF_SIMPLE-REQUNR
*"     VALUE(I_DSOURCE) TYPE  SRSC_S_IF_SIMPLE-DSOURCE OPTIONAL
*"     VALUE(I_MAXSIZE) TYPE  SRSC_S_IF_SIMPLE-MAXSIZE OPTIONAL
*"     VALUE(I_INITFLAG) TYPE  SRSC_S_IF_SIMPLE-INITFLAG OPTIONAL
*"     VALUE(I_READ_ONLY) TYPE  SRSC_S_IF_SIMPLE-READONLY OPTIONAL
*"     VALUE(I_REMOTE_CALL) TYPE  SBIWA_FLAG DEFAULT SBIWA_C_FLAG_OFF
*"  TABLES
*"      I_T_SELECT TYPE  SRSC_S_IF_SIMPLE-T_SELECT OPTIONAL
*"      I_T_FIELDS TYPE  SRSC_S_IF_SIMPLE-T_FIELDS OPTIONAL
*"      E_T_DATA STRUCTURE  ZSTRUC_CUMPSI OPTIONAL
*"  EXCEPTIONS
*"      NO_MORE_DATA
*"      ERROR_PASSED_TO_MESS_HANDLER
*"----------------------------------------------------------------------

* Auxiliary Selection criteria structure
  statics: Begin of lt_data occurs 0.
    include structure zstruc_cumpsi.
  statics: End of lt_data.

  data: l_s_select type srsc_s_select.

* maximum number of lines for db table
  statics: s_s_if type srsc_s_if_simple,

* counter
          s_counter_datapakid like sy-tabix,
* Record/Package
          s_rec_perpack type i,
          s_rec_remaining type i,
          s_rec_pointer type i,
          s_recFrom type i,
          s_recTo type i,
          s_maxsize type i,
          s_maxrec type i.

  Data: lv_Comp  type /BIC/OIZCH_COMP,
        lv_Recid type /BIC/OIZCH_RECID,
        lv_Vtype type /BI0/OIVTYPE,
        lv_Month type /BI0/OICALMONTH,
        lv_Year  type /BI0/OICALYEAR,
        lv_maxrec type i,
        lv_recnum type i.


* Initialization mode (first call by SAPI) or data transfer mode
* (following calls) ?
  if i_initflag = sbiwa_c_flag_on.

************************************************************************
* Initialization: check input parameters
*                 buffer input parameters
*                 prepare data selection
************************************************************************

* Check DataSource validity
    case i_dsource.
      when 'ZDS_CPSI'.
      when others.
        if 1 = 2. message e009(r3). endif.
* this is a typical log call. please write every error message like this
        log_write 'E'                  "message type
                  'R3'                 "message class
                  '009'                "message number
                  i_dsource   "message variable 1
                  ' '.                 "message variable 2
        raise error_passed_to_mess_handler.
    endcase.

    append lines of i_t_select to s_s_if-t_select.

* fill parameter buffer for data extraction calls
    s_s_if-requnr    = i_requnr.
    s_s_if-dsource = i_dsource.
    s_s_if-maxsize   = i_maxsize.
    s_maxsize = i_maxsize - 1.

* fill field list table for an optimized select statement
* (in case that there is no 1:1 relation between infosource fields
* and database table fields this may be far from beeing trivial)
    append lines of i_t_fields to s_s_if-t_fields.
else.
  if s_counter_datapakid = 0.
      loop at s_s_if-t_select into l_s_select.
        Case l_s_select-fieldnm.
          When 'ZCH_COMP'.
            lv_Comp = L_S_SELECT-low.
          When 'ZCH_RECID'.
            lv_Recid = L_S_SELECT-low.
          When '0VTYPE'.
            lv_Vtype = L_S_SELECT-low.
          When '0CALMONTH'.
            lv_Month = L_S_SELECT-low.
          When '0CALYEAR'.
            lv_Year = L_S_SELECT-low.
        EndCase.
      endloop.

      Case lv_Recid.
        When c_MSale.
            call function 'ZFM_GET_MONTHLY_SALE_CPSI'
              exporting
               zch_comp       = lv_comp
               zch_recid      = lv_recid
               0vtype         = lv_vtype
               0calmonth      = lv_month
               0calyear       = lv_year
              tables
               e_t_data       = lt_data.
            If lt_data[] is not initial.
              describe table lt_data  lines s_maxrec.
            Endif.
      EndCase.
      s_recFrom = 1.
      s_recTo = i_maxsize.
  Else.

  endif.

  If s_maxrec le 0.
    refresh lt_data.
    raise no_more_data.
  Endif.

  If s_maxrec le i_maxsize.
    s_recTo = s_recFrom + s_maxrec.
  Endif.

  Loop at lt_data from s_recFrom to s_recTo.
    e_t_data = lt_data.
    append e_t_data.
  Endloop.

  s_recFrom = s_recTo + 1.
  s_recTo = s_recTo + i_maxsize.
  s_maxrec = s_maxrec - i_maxsize.

  s_counter_datapakid = s_counter_datapakid + 1.
 endif.

ENDFUNCTION.

Former Member
0 Kudos

Jeffery,

The code you have writeen is stuck because the there is no limit on data package size in case of Funtcion module and the probably the code is stuck at some select statement and works well if you test it with small number of records per calland therefore the select statement may not be creating issues.

But when extracting the data into BW you will getting all the records in one call therfore the amount of records getting extracting will also go huge and without proper use of indexes on the table it may be taking a very long time to read the values.

Just try to debug it in RSA3 and give the no of extraction per calls and records per call to 20000 and then run it in Debug mode and then see on which line its stuck...it will give you a better idea.

Thanks

Ajeet

former_member355937
Participant
0 Kudos

Hi Ajeet,

Thanks for your response. I already handled the extraction per calls in the FM. For example if the total record of the data I am extracting is 9000, it will be divided to the number of calls I have specified in my infopackage.

In the extractor checker, it works fine even if have extracted the whole data.

I just couldn't figure out why it is not working when I am loading it to the cube.

Thanks and Best regards,

Jeffrey