Hello,
I have written an extractor based on a function module. In the RSA3 everything seams to work fine. But when I call it from the BW i get no data. The source systems returns an IDOC with status 8 (check your source system for data).
For the extractor it is mandatory to pass a selection date. If this date is not transmitted an error is raised. This I can see correctly in the job log. If I pass the selection date, the extraktor works - this I can see from sm50. But it seams that there is a problem with passing the result table to the BW.
Here is my code for the extraktor:
function zbw_test.
*"----------------------------------------------------------------------
*"*"Lokale Schnittstelle:
*" 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 ZHC_TEST_STRUCT OPTIONAL
*" EXCEPTIONS
*" NO_MORE_DATA
*" ERROR_PASSED_TO_MESS_HANDLER
*"----------------------------------------------------------------------
statics: ausw_tab type standard table of t_ausw_tab with header line,
l_first type boolean.
field-symbols: <fs_ausw_tab> type t_ausw_tab.
* Auxiliary Selection criteria structure
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,
data: selection type srsc_s_select.
* Initialization mode (first call by SAPI) or data transfer mode
* (following calls) ?
if i_initflag = sbiwa_c_flag_on.
l_first = true.
************************************************************************
* Initialization: check input parameters
* buffer input parameters
* prepare data selection
************************************************************************
* Check DataSource validity
case i_dsource.
when 'ZHC_TEST.
when others.
message id 'R3' type 'E' number ' 009' with i_dsource.
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.
* 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.
* initialize co
clear: ra_kokrs.
ra_kokrs-sign = 'I'.
ra_kokrs-option = 'EQ'.
ra_kokrs-low = '1000'.
append ra_kokrs.
clear: ra_bukrs.
ra_bukrs-sign = 'I'.
ra_bukrs-option = 'EQ'.
ra_bukrs-low = '1000'.
append ra_bukrs.
loop at i_t_select into selection where fieldnm = 'COBK_BUDAT'.
if selection-low is not initial.
ausbegdt = selection-low.
endif.
if selection-high is not initial.
ausenddt = selection-high.
endif.
endloop.
if selection-low is INITIAL or selection-high is initial.
message id 'ZDWH' type 'E' number ' 000' with 'Bitte geben Sie Selektionskriterien an!'.
raise error_passed_to_mess_handler.
endif.
else. "Initialization mode or data extraction ?
** First data package -> OPEN CURSOR
* Nur einmal ausführen
if l_first = true.
clear: ra_werks,ra_werks[].
ra_werks-sign = 'I'.
ra_werks-option = 'EQ'.
ra_werks-low = 'EIN'.
append ra_werks.
perform select_data changing rc.
ausw_tab[] = it_ausw_tab[].
l_first = false.
endif.
sort ausw_tab by lfdnr.
delete adjacent duplicates from ausw_tab comparing lfdnr.
loop at ausw_tab assigning <fs_ausw_tab> from 1 to s_s_if-maxsize.
append <fs_ausw_tab> to e_t_data.
endloop.
delete ausw_tab to s_s_if-maxsize.
* if e_t_data[] is initial.
* raise no_more_data.
* endif.
describe table e_t_data.
if sy-tfill = 0.
raise no_more_data.
endif.
s_counter_datapakid = s_counter_datapakid + 1.
endif. "Initialization mode or data extraction ?
The extractor does not use a curser. In the first run it selects all records into a static table and passes the rows according to the maxsize to the result table. Is there maybe a problem with raising the "no_more_data"?
Thanks!