Skip to Content
author's profile photo Former Member
Former Member

Help me to understand the code

function z_get_data.

  • DataSource for table ZBOOK

tables: zbook.

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

if i_initflag = sbiwa_c_flag_on.

  • Check DataSource validity

case i_dsource.

when 'ZZBOOK'.

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.


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 fieldsand 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 ?

if s_counter_datapakid = 0.

*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 * from zbook.


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


s_counter_datapakid = s_counter_datapakid + 1.


"Initialization mode or data extraction ?


Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Oct 13, 2006 at 08:27 PM

    This is code for generic function module.. and it retrieves all records from table ZBOOK and is filling the records in the data package upto the max number of records the datapacakge can hold.



    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 13, 2006 at 08:27 PM

    What do you not understand in it?

    It is an FM based on BW extractor FM template, and it provides data from ZBOOK table to the extractor.

    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.