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