cancel
Showing results for 
Search instead for 
Did you mean: 

Function Module not extracting records when InfoPackaged is executed

Former Member
0 Kudos

Hi,

I'm using a Function module for extracting data. The DataSource is working fine in RSA3 with a selection criteria. But when i schedule the infopackage with the same selections in the data selection tab, Its not getting me any records into BW. In the Details Tab i get the message "Error occurred in the data selection" . I guess there is a problem with the data selection. Pasted below is the code i'm using for extraction. Can anyone please let me know if there is any issue with the code.

Also how do we pass on the value of I_MAXSIZE into the function module, the remaining parameters get the values from BW. And can anyone please explain me the concept of the "s_counter_datapakid" and when it should be incremented and where it should be located in the code?

Thanks,

AM

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.

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

WHEN OTHERS.

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

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

  • Data transfer: First Call OPEN CURSOR + FETCH

  • Following Calls FETCH only

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

  • First data package -> OPEN CURSOR

IF s_counter_datapakid = 0.

g_first = 'X'.

  • 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 = 'BWLVS'.

IF l_s_select-low <> '101' AND

l_s_select-low <> '109'.

RAISE invalid_movement_type.

ELSE.

MOVE-CORRESPONDING l_s_select TO r_im_bwlvs.

APPEND r_im_bwlvs.

ENDIF.

ENDLOOP.

LOOP AT s_s_if-t_select INTO l_s_select WHERE fieldnm = 'BEGDA'.

MOVE-CORRESPONDING l_s_select TO r_im_begda.

r_im_begda-low0(4) = l_s_select-low6(4).

r_im_begda-low4(2) = l_s_select-low0(2).

r_im_begda-low6(2) = l_s_select-low3(2).

APPEND r_im_begda.

ENDLOOP.

LOOP AT s_s_if-t_select INTO l_s_select WHERE fieldnm = 'ENDDA'.

MOVE-CORRESPONDING l_s_select TO r_im_endda.

r_im_endda-low0(4) = l_s_select-low6(4).

r_im_endda-low4(2) = l_s_select-low0(2).

r_im_endda-low6(2) = l_s_select-low3(2).

APPEND r_im_endda.

ENDLOOP.

*Select from table ltak into internal table i_ltak the following fields.

*Condition: where bwlvs = import bwlvs & endat is >= import begda and

  • <= import endda.

READ TABLE r_im_begda INDEX 1.

IF sy-subrc NE 0.

RAISE blank_date_invalid.

ELSE.

IF r_im_begda-low IS INITIAL.

RAISE blank_date_invalid.

ENDIF.

ENDIF.

READ TABLE r_im_endda INDEX 1.

IF sy-subrc NE 0.

RAISE blank_date_invalid.

ELSE.

IF r_im_endda-low IS INITIAL.

RAISE blank_date_invalid.

ENDIF.

ENDIF.

IF NOT r_im_endda-low IS INITIAL

AND r_im_begda-low > r_im_endda-low.

RAISE invalid_date.

ENDIF.

r_endat-sign = 'I'.

r_endat-option = 'BT'.

r_endat-low = r_im_begda-low.

r_endat-high = r_im_endda-low.

APPEND r_endat.

*-- Get data from the tables

PERFORM get_data.

*-- Populate the extract structure with data

PERFORM write_data.

*-- Fill Export able with the extracted data

e_t_data[] = i_zbipicprd2[].

ENDIF. "First data package ?

IF g_first EQ 'X'.

CLEAR g_first.

ELSE.

*-- This is important to prevent endless loop.

RAISE no_more_data.

ENDIF.

s_counter_datapakid = s_counter_datapakid + 1.

ENDIF. "Initialization mode or data extraction ?

ENDFUNCTION.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi All,

Please let me know your inputs on the above posting and is there any procedure to debug the extraction process once we execute the InfoPackage, so that we can see the parameters passed on to R/3

Thanks.

AM

Former Member
0 Kudos

Hi,

the s_counter_datapakid does the same as your g_first. It just identifies the packages so that you dont need to use your g_first.

You cant include data in your first datapackage!

You should have a look in the demo FM RSAX_BIW_GET_DATA_SIMPLE and use it as a template.

Also your :

IF l_s_select-low '101' AND

l_s_select-low '109'.

looks a little bit strange.

Hope this helps.

Former Member
0 Kudos

Hi,

Thanks for your reply.

In your reply you mentioned "You cant include data in your first datapackage!". Can you please explain this, do i need to do some changes in the code. I used the standard Function Module while creating this FM.

Thanks,

AM

Former Member
0 Kudos

Hi,

within the first package (id=0) there will be no data transmitted. Thats why in the demo extractor there is the statement:

IF s_counter_datapakid = 0.

From the second datapak (id>=1) data will be fetched and delivered.

Former Member
0 Kudos

Hi,

Thanks again for your reply. Can you please let me know what are the changes i have to do in my existing code, i mean can you please modify the code i pasted i'm not an ABAPer. This would really help me.

Thanks,

AM

former_member185132
Active Contributor
0 Kudos

You can fetch data even when datapakid=0, data will be transmitted to RSA3/BW.

Data is not transmitted only when i_initflag = sbiwa_c_flag_on (i.e 'X'). As long as the initflag is NOT equal to 'X' data will go to the calling program. Even if you are extracting data when i_initflag = 'X' it will still not throw any error; it will simply not send that data to RSA3/BW.

In your case there is an error. I guess we will need to see the long text of the error. Can you post some more details about the error?

Former Member
0 Kudos

The load is running successfully but its not fetching any records into BW.

In the Status tab, Step by Step Analysis the following three steps are red:

Does selectable data exist in the source system? (Red)

Data selection successfully started ? (Red)

Data selection successfully finished ? (Red)

and the below is the Analysis

Diagnosis

The data request was a full update.

o In this case, the corresponding table in the source system does not

contain any data.

o System Response

Info IDoc received with status 8.

Procedure

Check the data basis in the source system.

But i have data in R/3 and i'm able to extract it using RSA3

former_member185132
Active Contributor
0 Kudos

Can you check the job log in R3?

Former Member
0 Kudos

Hi,

Thank You all for your help. I figured out the issue, its due to error in code.

Thanks,

AM