Hi,
I have created a z extractor on the table BUT050 and made it delta enabled using the created and changed data and time fields. The extractor is pulling all the delta records everyday except for Saturday. The records that we created on Saturday from 1 am to 11:59 pm are not extracted. Can anyone please help me with this asap as this is causing a very serious issue. Please find the ABAP code below.
Thanks
FUNCTION Z_BI_CC_BUT050.
*"----------------------------------------------------------------------
*"*"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 ZBI_BUT050 OPTIONAL
*" EXCEPTIONS
*" NO_MORE_DATA
*" ERROR_PASSED_TO_MESS_HANDLER
*"----------------------------------------------------------------------
* 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,
* cursor
s_cursor TYPE cursor.
* Select ranges
RANGES: l_r_RELNR FOR ZBI_BUT050-RELNR,
l_r_PARTNER1 FOR ZBI_BUT050-PARTNER1,
l_r_PARTNER2 FOR ZBI_BUT050-PARTNER2,
l_r_DATE_TO FOR ZBI_BUT050-DATE_TO,
l_r_ZZTMSTMP FOR ZBI_BUT050-ZZTMSTMP.
DATA : startdate LIKE sy-datum,
starttime LIKE sy-uzeit,
enddate LIKE sy-datum,
endtime LIKE sy-uzeit,
tstamp LIKE tzonref-tstamps,
timezone type TZONREF-TZONE.
RANGES: l_r_CRDAT FOR ZBI_BUT050-CRDAT,
l_r_CRTIM FOR ZBI_BUT050-CRTIM.
* 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 'ZCC_MA_BUT050'.
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.
* 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. "Initialization mode or data extraction ?
************************************************************************
* Data transfer: First Call OPEN CURSOR + FETCH
* Following Calls FETCH only
************************************************************************
* First data package -> OPEN CURSOR
IF s_counter_datapakid = 0.
* Fill range tables BW will only pass down simple selection criteria
* of the type SIGN = 'I' and OPTION = 'EQ' or OPTION = 'BT'.
LOOP AT s_s_if-t_select INTO l_s_select WHERE fieldnm = 'RELNR'.
MOVE-CORRESPONDING l_s_select TO l_r_RELNR.
APPEND l_r_RELNR.
ENDLOOP.
LOOP AT s_s_if-t_select INTO l_s_select WHERE fieldnm = 'PARTNER1'.
MOVE-CORRESPONDING l_s_select TO l_r_PARTNER1.
APPEND l_r_PARTNER1.
ENDLOOP.
LOOP AT s_s_if-t_select INTO l_s_select WHERE fieldnm = 'PARTNER2'.
MOVE-CORRESPONDING l_s_select TO l_r_PARTNER2.
APPEND l_r_PARTNER2.
ENDLOOP.
LOOP AT s_s_if-t_select INTO l_s_select WHERE fieldnm = 'DATE_TO'.
MOVE-CORRESPONDING l_s_select TO l_r_DATE_TO.
APPEND l_r_DATE_TO.
ENDLOOP.
* Timestamp is delivered as a selection criterion.
* Split the timestamp into date and time
LOOP AT s_s_if-t_select INTO l_s_select WHERE fieldnm = 'ZZTMSTMP'.
tstamp = l_s_select-low.
timezone = 'EST'.
CONVERT TIME STAMP tstamp TIME ZONE timezone
INTO DATE startdate TIME starttime.
tstamp = l_s_select-high.
CONVERT TIME STAMP tstamp TIME ZONE timezone
INTO DATE enddate TIME endtime.
l_r_CRDAT-low = startdate.
l_r_CRDAT-sign = l_s_select-sign.
l_r_CRDAT-option = l_s_select-option.
l_r_CRDAT-high = enddate.
APPEND l_r_CRDAT.
l_r_CRTIM-low = starttime.
l_r_CRTIM-sign = l_s_select-sign.
l_r_CRTIM-option = l_s_select-option.
l_r_CRTIM-high = endtime.
APPEND l_r_CRTIM.
ENDLOOP.
* Determine number of database records to be read per FETCH statement
* from input parameter I_MAXSIZE. If there is a one to one relation
* between DataSource table lines and database entries, this is trivial.
* In other cases, it may be impossible and some estimated value has to
* be determined.
OPEN CURSOR WITH HOLD s_cursor FOR
* Use the l_r_erdat and l_r_erfzeit for both creation and change selections
* This way we can pick up both the creations and changes in a given time period.
SELECT * FROM BUT050
WHERE RELNR IN l_r_RELNR
AND PARTNER1 IN l_r_PARTNER1
AND PARTNER2 IN l_r_PARTNER2
AND DATE_TO IN l_r_DATE_TO
AND ( ( CRDAT >= startdate AND ( CRTIM >= starttime OR ( CRDAT <= enddate AND CRTIM <= endtime ) ) )
OR ( CHDAT >= startdate AND ( CHTIM >= starttime OR ( CHDAT <= enddate AND CHTIM <= endtime ) ) ) ).
ENDIF.
"First data package ?
* Fetch records into interface table.
* named E_T_'Name of extract structure'.
FETCH NEXT CURSOR s_cursor
APPENDING CORRESPONDING FIELDS
OF TABLE e_t_data
PACKAGE SIZE s_s_if-maxsize.
IF sy-subrc <> 0.
CLOSE CURSOR s_cursor.
RAISE no_more_data.
ENDIF.
s_counter_datapakid = s_counter_datapakid + 1.
ENDIF. "Initialization mode or data extraction ?
ENDFUNCTION.