Skip to Content
0

how create a generic extractor delta enable mode using validityenddate and validitytodate fields

Jun 01, 2017 at 05:28 AM

96

avatar image

Hi,

I need a requirement for to create a generic extractor for A710 and A704 tables, but the table doesn't have any timestamp and changed date fields.The table having only DATBI(Validity end date of the condition record) and DATAB (Validity start date of the condition record)

Please let me know how to create these extractor delta enable, which logic we can apply through the function module.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Mario Tibollo Jun 01, 2017 at 07:50 AM
0

you could try with DATAB as delta enabled field. assuming that a new record will have the creation date as datab, and not in the past. and existing records can't be changed except for the DATBI date. So any onther change will lead to a new record...

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Thanks mario. I have pass the DATAB field as a calday but it gaves the error msg back.

0
Mario Tibollo Jun 01, 2017 at 12:16 PM
0

which error message? how did you set up the delta for your generic extractor?

Show 3 Share
10 |10000 characters needed characters left characters exceeded

In RSO2 i have set the DATAB field and try to run the delta mode in rsa3 it gaves the error message box.

0

Please find the below code in our function module.

TABLES: A704.

* 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_HIENR FOR A704-HIENR,
L_R_KUNNR FOR A704-KUNNR,
L_R_DATAB FOR A704-DATAB.
* Initialization mode (first call by SAPI) or data transfer mode
* (following calls) ?
IF I_INITFLAG = SBIWA_C_FLAG_ON.
************************************************************************
* Check DataSource validity
CASE I_DSOURCE.
WHEN 'ZBI_MEMBER_HIER_MX'.
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 = 'HIENR'.
MOVE-CORRESPONDING L_S_SELECT TO L_R_HIENR.
APPEND L_R_HIENR.
ENDLOOP.

LOOP AT S_S_IF-T_SELECT INTO L_S_SELECT WHERE FIELDNM = 'KUNNR'.
MOVE-CORRESPONDING L_S_SELECT TO L_R_KUNNR.
APPEND L_R_KUNNR.
ENDLOOP.

LOOP AT S_S_IF-T_SELECT INTO L_S_SELECT WHERE FIELDNM = 'DATAB'.
MOVE-CORRESPONDING L_S_SELECT TO L_R_DATAB.
APPEND L_R_DATAB.
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
SELECT (S_S_IF-T_FIELDS) FROM A704 AS A
WHERE A~HIENR IN L_R_HIENR AND
A~KUNNR IN L_R_KUNNR AND
A~DATAB IN L_R_DATAB AND
A~KSCHL = 'ZMXM'.
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.

0

why do you use a function module? you need to create a generic datasource based on a table. then define the delta with DATAB as delta field.

and please specify 'it gaves the error message box.'? What is the message IN THIS BOX?

0