Skip to Content

FM error-Errors occurred during the extraction

Hi,

I have written a FM(Copy of RSAX_BIW_GET_DATA) for Delta Extraction Based on BUDAT , code has no syntax Error But it throws "Errors occurred during the extraction" in extractor checker,

can anyone please help in rectifying error also how will delta work here?

FUNCTION rsax_biw_get_data_product_cost.

*"----------------------------------------------------------------------

*"*"Local Interface:

*" IMPORTING

*" VALUE(I_REQUNR) TYPE SBIWA_S_INTERFACE-REQUNR

*" VALUE(I_ISOURCE) TYPE SBIWA_S_INTERFACE-ISOURCE OPTIONAL

*" VALUE(I_MAXSIZE) TYPE SBIWA_S_INTERFACE-MAXSIZE OPTIONAL

*" VALUE(I_INITFLAG) TYPE SBIWA_S_INTERFACE-INITFLAG OPTIONAL

*" VALUE(I_UPDMODE) TYPE SBIWA_S_INTERFACE-UPDMODE OPTIONAL

*" VALUE(I_DATAPAKID) TYPE SBIWA_S_INTERFACE-DATAPAKID OPTIONAL

*" VALUE(I_PRIVATE_MODE) OPTIONAL

*" VALUE(I_CALLMODE) LIKE ROARCHD200-CALLMODE OPTIONAL

*" VALUE(I_REMOTE_CALL) TYPE SBIWA_FLAG DEFAULT SBIWA_C_FLAG_OFF

*" TABLES

*" I_T_SELECT TYPE SBIWA_T_SELECT OPTIONAL

*" I_T_FIELDS TYPE SBIWA_T_FIELDS OPTIONAL

*" E_T_DATA STRUCTURE ZCOPCFREIGHT OPTIONAL

*" E_T_SOURCE_STRUCTURE_NAME OPTIONAL

*" EXCEPTIONS

*" NO_MORE_DATA

*" ERROR_PASSED_TO_MESS_HANDLER

*"----------------------------------------------------------------------

* The input parameter I_DATAPAKID is not supported yet !

* Example: InfoSource containing TADIR objects

TABLES: tadir.

* Auxiliary Selection criteria structure

DATA: l_s_select TYPE sbiwa_s_select.

* Maximum number of lines for DB table

STATICS: l_maxsize TYPE sbiwa_s_interface-maxsize.

* Select ranges

RANGES: l_r_ebeln FOR ekbe-ebeln,

l_r_ebelp FOR ekbe-ebelp,

l_r_belnr FOR ekbe-belnr,

l_r_buzei FOR ekbe-buzei,

l_r_gjahr FOR ekbe-gjahr,

l_r_bewtp FOR ekbe-bewtp,

l_r_budat FOR ekbe-budat,

l_r_menge FOR ekbe-menge,

l_r_dmbtr FOR ekbe-dmbtr,

l_r_bwart FOR ekbe-bwart,

l_r_ktosl FOR bseg-ktosl,

l_r_shkzg FOR ekbe-shkzg,

l_r_meins for ekpo-meins,

l_r_waers for t001-waers.

* l_r_awkey for bseg-awkey.

DATA : lt_data TYPE STANDARD TABLE OF zcopcfreight,

ls_data LIKE LINE OF lt_data.

TYPES: BEGIN OF lty_ekbe,

ebeln TYPE ebeln,

waers TYPE t001-waers,

belnr TYPE ekbe-belnr,

ebelp TYPE ebelp,

buzei TYPE buzei,

meins TYPE ekpo-meins,

shkzg TYPE shkzg,

budat TYPE budat,

bwart TYPE bwart,

ktosl TYPE ktosl,

END OF lty_ekbe,

BEGIN OF lty_t001,

waers TYPE waers,

END OF lty_t001,

BEGIN OF lty_ekpo,

meins TYPE meins,

END OF lty_ekpo,

BEGIN OF lty_bseg,

belnr type bseg-belnr,

ktosl TYPE ktosl,

END OF lty_bseg.

DATA : lt_ekbe TYPE TABLE OF lty_ekbe,

lt_ekpo TYPE TABLE OF lty_ekpo,

lt_t001 TYPE TABLE OF lty_t001,

lt_bseg TYPE TABLE OF lty_bseg.

DATA: ls_ekbe TYPE lty_ekbe,

ls_ekpo TYPE lty_ekpo,

ls_t001 TYPE lty_t001,

ls_bseg TYPE lty_bseg.

* Parameter I_PRIVATE_MODE:

* Some applications might want to use this function module for other

* purposes as well (e.g. data supply for OLTP reporting tools). If the

* processing logic has to be different in this case, use the optional

* parameter I_PRIVATE_MODE (not supplied by BIW !) to distinguish

* between BIW calls (I_PRIVATE_MODE = SPACE) and other calls

* (I_PRIVATE_MODE = X).

* If the message handling has to be different as well, define Your own

* messaging macro which interprets parameter I_PRIVATE_MODE. When

* called by BIW, it should use the LOG_WRITE macro, otherwise do what

* You want.

* 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

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

* The input parameter I_DATAPAKID is not supported yet !

* Invalid second initialization call -> error exit

IF NOT g_flag_interface_initialized IS INITIAL.

IF 1 = 2. MESSAGE e008(r3). ENDIF.

log_write 'E' "message type

'R3' "message class

'008' "message number

' ' "message variable 1

' '. "message variable 2

RAISE error_passed_to_mess_handler.

ENDIF.

* Check InfoSource validity

CASE i_isource.

WHEN 'X'.

WHEN 'Y'.

WHEN 'Z'.

WHEN OTHERS.

IF 1 = 2. MESSAGE e009(r3). ENDIF.

log_write 'E' "message type

'R3' "message class

'009' "message number

i_isource "message variable 1

' '. "message variable 2

RAISE error_passed_to_mess_handler.

ENDCASE.

* Check for supported update mode

CASE i_updmode.

WHEN 'F'.

WHEN OTHERS.

IF 1 = 2. MESSAGE e011(r3). ENDIF.

log_write 'E' "message type

'R3' "message class

'011' "message number

i_updmode "message variable 1

' '. "message variable 2

RAISE error_passed_to_mess_handler.

ENDCASE.

* Check for obligatory selection criteria

* READ TABLE i_t_select INTO l_s_select WITH KEY fieldnm = 'PGMID'.

* IF sy-subrc <> 0.

* IF 1 = 2. MESSAGE e010(r3). ENDIF.

* log_write 'E' "message type

* 'R3' "message class

* '010' "message number

* 'PGMID' "message variable 1

* ' '. "message variable 2

* RAISE error_passed_to_mess_handler.

* ENDIF.

APPEND LINES OF i_t_select TO g_t_select.

* Fill parameter buffer for data extraction calls

g_s_interface-requnr = i_requnr.

g_s_interface-isource = i_isource.

g_s_interface-maxsize = i_maxsize.

g_s_interface-initflag = i_initflag.

g_s_interface-updmode = i_updmode.

g_s_interface-datapakid = i_datapakid.

g_flag_interface_initialized = sbiwa_c_flag_on.

* 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 g_t_segfields.

* Start tracing of extraction

bice_trace_open g_r_tracer i_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 g_counter_datapakid = 0.

* Fill range tables for fixed InfoSources. In the case of generated

* InfoSources, the usage of a dynamical SELECT statement might be

* more reasonable. BIW will only pass down simple selection criteria

* of the type SIGN = 'I' and OPTION = 'EQ' or OPTION = 'BT'.

LOOP AT g_t_select INTO l_s_select WHERE fieldnm = 'ebeln'.

MOVE-CORRESPONDING l_s_select TO l_r_ebeln.

APPEND l_r_ebeln.

ENDLOOP.

LOOP AT g_t_select INTO l_s_select WHERE fieldnm = 'gjahr'.

MOVE-CORRESPONDING l_s_select TO l_r_gjahr.

APPEND l_r_gjahr.

ENDLOOP.

LOOP AT g_t_select INTO l_s_select WHERE fieldnm = 'belnr'.

MOVE-CORRESPONDING l_s_select TO l_r_belnr.

APPEND l_r_belnr.

ENDLOOP.

* LOOP AT g_t_select INTO l_s_select WHERE fieldnm = 'budat'.

* MOVE-CORRESPONDING l_s_select TO l_r_budat.

* APPEND l_r_object.

* ENDLOOP.

LOOP AT g_t_select INTO l_s_select WHERE fieldnm = 'ebelp'.

MOVE-CORRESPONDING l_s_select TO l_r_ebelp.

APPEND l_r_ebelp.

ENDLOOP.

LOOP AT g_t_select INTO l_s_select WHERE fieldnm = 'buzei'.

MOVE-CORRESPONDING l_s_select TO l_r_buzei.

APPEND l_r_buzei.

ENDLOOP.

LOOP AT g_t_select INTO l_s_select WHERE fieldnm = 'bewtp'.

MOVE-CORRESPONDING l_s_select TO l_r_bewtp.

APPEND l_r_bewtp.

ENDLOOP.

LOOP AT g_t_select INTO l_s_select WHERE fieldnm = 'menge'.

MOVE-CORRESPONDING l_s_select TO l_r_menge.

APPEND l_r_menge.

ENDLOOP.

LOOP AT g_t_select INTO l_s_select WHERE fieldnm = 'dmbtr'.

MOVE-CORRESPONDING l_s_select TO l_r_dmbtr.

APPEND l_r_dmbtr.

ENDLOOP.

LOOP AT g_t_select INTO l_s_select WHERE fieldnm = 'bwart'.

MOVE-CORRESPONDING l_s_select TO l_r_bwart.

APPEND l_r_bwart.

ENDLOOP.

LOOP AT g_t_select INTO l_s_select WHERE fieldnm = 'ktosl'.

MOVE-CORRESPONDING l_s_select TO l_r_gjahr.

APPEND l_r_ktosl.

ENDLOOP.

LOOP AT g_t_select INTO l_s_select WHERE fieldnm = 'shkzg'.

MOVE-CORRESPONDING l_s_select TO l_r_shkzg.

APPEND l_r_shkzg.

ENDLOOP.

LOOP AT g_t_select INTO l_s_select WHERE fieldnm = 'BUDAT'.

MOVE-CORRESPONDING l_s_select TO l_r_budat.

l_r_budat-sign = 'I'.

l_r_budat-option = 'GE'.

CLEAR l_r_budat-high.

APPEND l_r_budat.

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 InfoSource table lines and database entries, this is trivial.

* In other cases, it may be impossible and some estimated value has to

* be determined.

l_maxsize = g_s_interface-maxsize.

OPEN CURSOR WITH HOLD g_cursor FOR

SELECT ebeln

belnr

budat

gjahr

ebelp

bewtp

buzei

menge

FROM ekbe

WHERE

ebeln IN l_r_ebeln AND

gjahr IN l_r_gjahr AND

belnr IN l_r_belnr AND

budat IN l_r_budat AND

ebelp IN l_r_ebelp AND

buzei IN l_r_buzei AND

bewtp IN l_r_bewtp AND

menge IN l_r_menge AND

dmbtr IN l_r_dmbtr AND

bwart IN l_r_bwart .

"#EC CI_GENBUFF

ENDIF. "First data package ?

* Fetch records into interface table. There are two different options:

* - fixed interface table structure for fixed InfoSources have to be

* named E_T_'Name of assigned source structure in table ROIS'.

* - for generating applications like LIS and CO-PA, the generic table

* E_T_DATA has to be used.

* Only one of these interface types should be implemented in one API !

FETCH NEXT CURSOR g_cursor

APPENDING CORRESPONDING FIELDS

OF TABLE lt_data

PACKAGE SIZE l_maxsize.

IF sy-subrc <> 0.

CLOSE CURSOR g_cursor.

bice_trace_close g_r_tracer.

RAISE no_more_data.

ENDIF.

CLEAR ls_data.

REFRESH: lt_ekbe,

lt_bseg,

lt_t001.

IF lt_data[] IS NOT INITIAL.

SELECT

ebeln

gjahr

belnr

budat

ebelp

buzei

bewtp

menge

dmbtr

bwart

shkzg

INTO CORRESPONDING FIELDS OF TABLE lt_ekbe

FROM ekbe

FOR ALL ENTRIES IN lt_data

WHERE ebeln = lt_data-ebeln.

SORT lt_ekbe BY ebeln.

SELECT belnr ktosl

INTO CORRESPONDING FIELDS OF TABLE lt_bseg

FROM bseg

FOR ALL ENTRIES IN lt_data

WHERE belnr = lt_data-belnr.

SORT lt_bseg BY belnr ktosl.

endif.

loop at lt_data into ls_data.

clear e_t_data.

move-corresponding ls_data to e_t_data.

ENDLOOP.

bice_collect_table g_r_tracer e_t_data.

g_counter_datapakid = g_counter_datapakid + 1.

ENDIF. "Initialization mode or data extraction ?

ENDFUNCTION.

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    Posted on Jan 15, 2016 at 07:30 AM

    CASE i_isource.

    WHEN 'X'.

    WHEN 'Y'.

    WHEN 'Z'.


    unless your DataSource is called either 'X', 'Y' or 'Z' not much is going to happen...

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 15, 2016 at 06:59 PM

    In addition to Raf's comment, if you are creating a delta datasource, then below will not work too as update mode your datasource supporting is 'F' = full load.

    CASE i_updmode.

    WHEN 'F'.


    Also you should copy the RSAX_BIW_GET_DATA_SIMPLE function as the one you used is for F1 interface which generic datasource do not support.

    You will not have i_upmode as input parameter at all, so it is of no use.


    Thanks

    Amit

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.