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

BW/ABAP- Function module is called infinitely by Datasource Extractor.

Hi All,

A quick ABAP question related to Function Modules and BW data source extractors.

I’ve written a function module to select data from a database and simply output the data as a table. I then created a text Datasource using transaction rso2 and set it to Extraction by Function Module.

When I test this using transaction rsa6, I can manipulate the number of calls to my function module using the Display Extra Calls field.

However, when I test this using transaction rsa1, my function module seems to be called infinite times. So, the number of records being retrieved is increasing exponentially and finally ends with a dump.

My question: Do I need to include something in my code such that the Function Module by itself will only be called once?

Or is there some configuration for the Datasource that will limit my function module call to once only.

Tried so far

• Introducing a static variable in the function module that exits as soon as the value is greater than 1.

o Is there another way out?

Regards,

Preethi.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Posted on Oct 01, 2009 at 09:18 AM

    You need to raise the EXEPTION NO_MORE_DATA afte the last record is populated in the output table. Otherwise the program goes into an infinite loop.

    * From now on records get fetched from the database or gets read from the internal table
        FETCH NEXT CURSOR v_cursor
                   APPENDING CORRESPONDING FIELDS
                   OF TABLE <internal table>
                   PACKAGE SIZE i_s_if-maxsize.
    
        IF sy-subrc <> 0.
          CLOSE CURSOR v_cursor.
          RAISE no_more_data.
        ENDIF.
    * Populate the Output Data Structure into table E_T_DATA and you need to raise the EXEPTION NO_MORE_DATA and close the cursor to avoid any memory leaks
    

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 01, 2009 at 09:18 AM

    You need to raise the EXEPTION NO_MORE_DATA afte the last record is populated in the output table. Otherwise the program goes into an infinite loop.

    * From now on records get fetched from the database or gets read from the internal table
        FETCH NEXT CURSOR v_cursor
                   APPENDING CORRESPONDING FIELDS
                   OF TABLE <internal table>
                   PACKAGE SIZE i_s_if-maxsize.
    
        IF sy-subrc <> 0.
          CLOSE CURSOR v_cursor.
          RAISE no_more_data.
        ENDIF.
    * Populate the Output Data Structure into table E_T_DATA and you need to raise the EXEPTION NO_MORE_DATA and close the cursor to avoid any memory leaks
    

    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.