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

FM for splitting the records and then processing

Hi all

i have this requirement that there are records to be picked in my background job and to be processed. now the background job has to pick number of records first and process them e.g it has to pick the first 5,000 records, process them and then pick the next 5,000 records and so-on. now this is called a functionality of threading i think... and i have heard that there ia a standard FM in SAP to do this. but i am not coming across it. can anybody help me in this.

please ask questions if doubt any.

helpful answers will be rewarded.

thanks

jai

Add a comment
10|10000 characters needed characters exceeded

Related questions

5 Answers

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

    Jaideep,

    I am not aware of such a FM. You will probably spend more time looking for one versus just writing the logic yourself.

    It seems QUITE simple. I would end your search and "crop some code." It should only take a few minutes to write.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 17, 2006 at 06:07 PM

    It really depends on which program works in your job, is it SAP program or your custom program.

    If it's your custom program you can add new parameter for "up to NNN rows" and then use "up to nnn rows" in your select statement which selects data for processing.

    The program can trigger an event at the end to start the same job again if any data is left for processing.

    If it's SAP native program which does not have any parameters for the number of records - you can write your own "wrapper" program which will determine the numebr of records which are relevant for processing and then defien select-options for SAP-program so it will select necessary amount of data, and this wrapper can actually submit SAP program (or even submit programs in parallel if you need parallel processing).

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 18, 2006 at 10:31 AM

    Hi Jaideep,

    I don't think there is such function module. If you want to fetch the records in batchs that you can do with "select.....package size 5000"

    Regards,

    Dharitree

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 18, 2006 at 12:11 PM

    Dear Jaideep,

    First of all I want to appreciate your logical thinking. In oracle there is one field for any table called "ROWID" through which we can put a where condition like ROWID > 5000 and ROWID <= 10000.

    But the same thing is not found in ABAP dictionary. So, you can try using Native SQL instead of OPEN Sql for this need. Again, I want to tell u onething, this will work according to the Table rows from TOP to button & not according to other where condition.

    So, Another way by using abap dictionary is,

    using

    SELECT ...... where .....

    If sy-dncnt .....

    ENDSELECT.

    But here also there is an issue of performance by accessing all the rows of the table.

    The success of SQL is to put as much as perfect where condition through select-screen inputs. So better go by including more input rather than record numbers.

    Take care & keep in touch.

    reward if you satisfied.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 18, 2006 at 02:44 PM

    Hi,

    Use select query with packet size logic to

    retrieve data.

    use below logic

    OPEN CURSOR WITH HOLD GV_DB_CURSOR FOR

    SELECT * FROM ZCOS

    WHERE BUKRS IN S_BUKRS

    AND BUDAT IN S_BUDAT.

    IF SY-SUBRC EQ 0.

    *Subroutine to fetch data in packets

    DO.

    FETCH NEXT CURSOR GV_DB_CURSOR

    INTO TABLE IT_ZCOX

    PACKAGE SIZE GC_SIZE. "Packet size 25000

    IF SY-SUBRC NE 0.

    CLOSE CURSOR GV_DB_CURSOR.

    EXIT.

    ENDIF.

    LOOP AT IT_ZCOX.

    WRITE IT_ZCOX.

    ENDLOOP.

    FREE IT_ZCOX.

    ENDIF.

    Regards

    amole

    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.