cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Generic Extractor using Function Module

Former Member
0 Likes
738

Hi,

we created 10 custom tables in ECC for FI/CO process. I need to create a generic extractor using function module. I found many posts to create a function module for single table.

Can I use one function module to extract data from more than one table? All the tables have relationships. or do I need to create 10 different function modules?

Please advise.

Thanks&Regards,

Hans.

View Entire Topic
Former Member
0 Likes

Hi Hans,

You can build a single extract structure with all the required fields from those 10 different tables. In the function module you can fill in this extract structure by using select statements from 10 different tables.

The other option would be to create a view on those 10 tables with all the possible relationships and create a generic extraction from view.

Regards, Uday

Assign points for helpful answers and get one point for yourself.

Former Member
0 Likes

Thanks for your prompt reply.

I can create a structure using SE11 tcode in ECC where tables exist.

I believe that structure behaves like extract structure. Am I correct?

I gave you points already for the reply.

I may get back to you if I have any problems while creating function module.

Hans.

Former Member
0 Likes

Yes you can create a structure in SE11

1. select data type, type in name of your structure

2. Choose Create button..

3. In the pop up box select the structures.

and you need to specify this structure while creating a generic extractor using function module.

Former Member
0 Likes

I am verymuch clear on what I have to do. Thanks.

Former Member
0 Likes

Uday,

Can you please forward me any sample template of function module to extract the data from multiple tables. My email address is hanuma@eoktechnologies.com

It is very urgent. Can anybody send me the document please?

Thanks,

Hans

Former Member
0 Likes

Hi GHR,

RSAX_BIW_GET_DATA_SIMPLE will be a good one for you to look into and have an idea.

Regards.

Former Member
0 Likes

Hi Dash,

I have seen RSAX_BIW_GET_DATA_SIMPLE and blogs on that but it pulls data from only SFLIGHT table. I need to pull data from multiple tables.

Cursors are used in that function module. For example, Could you please advise how to write the code for SFIGHT, SBOOK and if one more table is there.

Thanks.

Former Member
0 Likes

Hi GHR,

Create an internal table in your code with structure similar to your datasource.

Fill in the different fields from different tables and keep appending your records.

Once your build is complete you can copy the contents of the internal table to E_T_DATA.

Regards.

Former Member
0 Likes
  • 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 'ZDMS_TYP_CON'.

WHEN OTHERS.

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

  • this is a typical log call. Please write every error message like

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.

*Use table DRAW and read everything for document type(DOKAR) = ‘DIS’

select dokar doknr dokvr doktl

into table it_draw

from DRAW

where dokar = 'CON'.

sort it_draw by doknr.

clear it_zdmsstruct.

clear g_first.

if s_counter_datapakid = 0.

g_first = 'X'.

loop at it_draw INTO wa_draw.

clear wa_zdmsstruct.

wa_zdmsstruct-ZSAPKEY = wa_draw-doknr.

wa_zdmsstruct-ZSAPDOCNO = wa_draw-DOKVR.

CONCATENATE wa_draw-dokar wa_draw-doknr wa_draw-dokvr

wa_draw-doktl INTO wa_zdmsstruct-Z_SAP_DOKNR.

select single dktxt_uc into wa_zdmsstruct-Z_CONSENT_NO

from drat

where dokar = 'CON'

and doknr = wa_draW-doknr

and dokvr = wa_draW-dokvr.

clear it_drad.

clear l_cuobj.

select single cuobj from INOB

into l_cuobj

where objek = wa_zdmsstruct-Z_SAP_DOKNR

and klart = '017'

and obtab = 'DRAW'.

if sy-subrc = 0.

select objek atinn atzhl atwrt atflv

into table it_ausp

from AUSP

where objek = l_cuobj.

sort it_ausp by atzhl ASCENDING.

select mandt dokar doknr dokvr doktl dokob obzae objky into

table it_drad

from DRAD

where dokar = 'CON'

and dokvr = wa_draw-DOKVR

and doktl = wa_draw-doktl

and doknr = wa_draw-doknr

and dokob = 'IFLOT'.

if sy-subrc <> 0.

clear wa_zdmsstruct-Z_FUNCT_LOC_1.

append wa_zdmsstruct to E_T_DATA.

else.

loop at it_drad INTO wa_drad.

clear wa_zdmsstruct-Z_FUNCT_LOC_1.

wa_zdmsstruct-Z_FUNCT_LOC_1 = wa_drad-objky.

append wa_zdmsstruct to E_T_DATA.

endloop.

endif.

endif.

endloop.

endif.

s_counter_datapakid = s_counter_datapakid + 1.

IF g_first EQ 'X'.

CLEAR g_first.

ELSE.

RAISE no_more_data.

ENDIF.

ENDIF. "Initialization mode or data extraction ?

SORT E_T_DATA ASCENDING BY Z_CONSENT_NO.

ENDFUNCTION.

Former Member
0 Likes

Hi Uday,

once we have uploaded data with init of delat, can we reinit how? What is Reinitlization, at what circumstances we will go for Reinit? Plz explain with Scenario's?