cancel
Showing results for 
Search instead for 
Did you mean: 

Delta in Function Module Generic Datasource

Former Member
0 Kudos
62

Hi Friends,

Below is my FM code written in 'zrsax_biw_get_data_simple',

it's working fine for fullupdate but after init load, in deltaupdate still it shows same record as in fullupload. How make it works for delta.

Kindly go through it and suggest how to do it....

FUNCTION zrsax_biw_get_data_simple.

*"----


""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_ON

*" 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 ZSD_WAR_CLM_DET_BIW OPTIONAL

*" EXCEPTIONS

*" NO_MORE_DATA

*" ERROR_PASSED_TO_MESS_HANDLER

*"----


  • Example: DataSource for table SFLIGHT

TABLES: zsd_war_clm_det_biw.

DATA : tab_records TYPE i,

flag_go TYPE boolean.

  • 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.

*CLEAR : e_t_data[].

DATA : e_t_data_display TYPE TABLE OF zsd_war_clm_det_biw.

IMPORT flag_go FROM MEMORY ID flag_go.

IF flag_go EQ space.

IF i_initflag = sbiwa_c_flag_on.

************************************************************************

  • Initialization: check input parameters

  • buffer input parameters

  • prepare data selection

************************************************************************

  • Check DataSource validity

CASE i_dsource.

WHEN 'ZZ'.

CALL FUNCTION 'ZRFC_WAR_COPY'

EXPORTING

start_date = '20010101'

end_date = '20070101'

TABLES

e_t_data = e_t_data_display.

e_t_data[] = e_t_data_display[].

DESCRIBE TABLE e_t_data_display LINES tab_records.

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.

APPEND LINES OF i_t_fields TO s_s_if-t_fields.

ELSE. "Initialization mode or data extraction ?

CALL FUNCTION 'ZRFC_WAR_COPY'

EXPORTING

start_date = '20010101'

end_date = '20070101'

TABLES

e_t_data = e_t_data_display.

e_t_data[] = e_t_data_display[].

DESCRIBE TABLE e_t_data_display LINES tab_records.

ENDIF. "First data package ?

ENDIF.

IF i_maxsize GT tab_records AND s_counter_datapakid > 1.

raise no_more_data.

ELSE.

IF i_maxsize LE tab_records AND s_counter_datapakid > 1.

raise no_more_data.

ENDIF.

ENDIF.

s_counter_datapakid = s_counter_datapakid + 1.

ENDFUNCTION.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

CALL FUNCTION 'ZRFC_WAR_COPY'
EXPORTING
start_date = '20010101'
end_date = '20070101'

In the code dates are fixed it has to be variable . Ideally it should be the date on which delta update is defined. and in the format


Start_Date = delta_Date-low
end_date = delta_date-high

Hope that helps.

Regards

Mr Kapadia

***Assigning points is the way to say thanks in SDN.***

Former Member
0 Kudos

Thanx Mr.Kapadia,

according to ur suggetion i have made changes in the code but now it shows following error

'Field "DELTA_DATE-LOW" is unknown. It is neither in one of the specified tables nor defined by a "DATA" statement.'

kindly help me further

regards,

suyash

Former Member
0 Kudos

Hi,

Check for field on which you have defined delta , it should be of type date, and replace "DELTA_DATE" with the actual field name of the delta .

Hope that helps.

Regards

Mr Kapadia

***Assigning points is the way to say thanks in SDN.***

Former Member
0 Kudos

hi Mr.Kapadiya,

in my structure these fields are char type shall i make it as a date, and shall i put

like this

start_date = zsd_war_clm_det_biw-SALE_DATE

end_date = zsd_war_clm_det_biw-SALE_DATE

SALE_DATE is my delta field which i have given in RSO2. And

zsd_war_clm_det_biw is my structure.

Regards,

Suyash

Former Member
0 Kudos

Hi,

Following is a sample code for delta implementation on date . here "CPUDT" is selected as delta field .

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

      OPEN CURSOR WITH HOLD S_CURSOR FOR
      SELECT (S_S_IF-T_FIELDS) FROM Ztest
                               WHERE       AND  CPUDT   IN L_R_CPUDT.

Hope that helps.

Regards

Mr Kapadia

***Assigning points is the way to say thanks in SDN.***

Former Member
0 Kudos

hi Mr. Kapadiya,

thank u very much for the code,

but i m using function module in function module to fetch the data,

can u tell me how i can get the last delta successful data, then

i can do like below

IF sale_date-low IS INITIAL.

sale_date-low = '20010101'.

sale_date-high = '99990101'

else.

sale_date-low = 'last delta date'

sale_date-high = '99990101'

endif.

means if delta date is exist then i will give the date or i will give hard coded date

will it work????????????

regards

suyash

Former Member
0 Kudos

Hi,

Code should look like this ...

   RANGES: L_R_CPUDT   FOR BKPF-BUDAT.
            data : start_dt like bkpf-budat,
                     end_Dt like bkpf-budat.

     LOOP AT S_S_IF-T_SELECT INTO L_S_SELECT WHERE FIELDNM = 'CPUDT'.
        MOVE-CORRESPONDING L_S_SELECT TO L_R_CPUDT.
        APPEND L_R_CPUDT.
      ENDLOOP.
 
if l_r_cpudt-low is not initial.
start_dt = l_r_cpudt-low.
else
start_dt = '20010101'.
endif.

if l_r_cpudt-high is not initial.
end_dt = l_r_cpudt-high.
else
end_dt = '99991231'.
endif.


CALL FUNCTION 'ZRFC_WAR_COPY'
EXPORTING
start_date = start_dt
end_date =  end_dt
TABLES
e_t_data = e_t_data_display.
e_t_data[] = e_t_data_display[].

Hope that helps.

Regards

Mr Kapadia

***Assigning points is the way to say thanks in SDN.***

Former Member
0 Kudos

thanx mr.kapadiya,

can u explain the range and loop in your code.

now i have made correction for but it gives me dump when i selects 'D' ,

and works fine in 'F'mode in RSA3

Regards,

Suyash

Former Member
0 Kudos

Hi Suyash,

What does the dump says ??

Former Member
0 Kudos

Hi,

Following is the Dump.....

Error analysis

An exception occurred. This exception is dealt with in more detail below

. The exception, which is assigned to the class 'CX_SY_DYN_CALL_ILLEGAL_FUNC',

was neither

caught nor passed along using a RAISING clause, in the procedure

"RSA3_GET_DATA_SIMPLE" "(FUNCTION)"

.

Since the caller of the procedure could not have expected this exception

to occur, the running program was terminated.

The reason for the exception is:

The program "SAPLRSA3" contains a CALL FUNCTION statement. The name

of the function module to be called is " ".

No function module exists with the name " ".

All function modules are stored in the Function Library (SE37).

Possible reasons:

a) Wrong name specified. Particular attention should be paid

to upper/lower case and underscores ("_")

b) Transport error

c) If an enqueue/dequeue module has been used, the lock object

may not have been activated (ABAP Dictionary)

may not have been activated (ABAP Dictionary).

regards,

suyash

Former Member
0 Kudos

Hi Suyash,

Have you transported datasource/function module to Quality or Production environment ??

Check for existence of function module "ZRFC_WAR_COPY".

Also check the extractor checker for datasource , in the system you are trying to extract data.

Hope that helps.

Regards

Mr Kapadia

***Assigning points is the way to say thanks in SDN.***