Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Need help regarding processing large data with multiple approach.cursor

Hi Experts,

We need you help regarding  one of the approach for more performance effective as it involves multiple data.

We have the following requirement,

We need to retrieve large amount of data form  four consecutive table and then processing needs to be done by looping to the initial table and

number of processing of data will be around 4/5 milllion.

Now we are taking the approach to open cursor for retrieving data from the tables, as i am new in using this so bit confused whoch approach will be more performance effective,

First approach is  we will open the cursor and retrieve data from rest of the three table also and append those and the close the cursor, and the loop processing will be done without cursor, basically if the tables are A, B Aand C then will do the following ..

OPEN CURSOR WITH HOLD s_cursor FOR
SELECT

----

----
FROM A

WHERE conditions

DO.
FETCH NEXT CURSOR s_cursor appending TABLE lt_A PACKAGE SIZE 60000.
IF sy-subrc <> 0.
EXIT.
ENDIF.

SELECT 

----

----
FROM B

for all entries in A ----- ? I guess we  can use  for all entries..
WHERE conditions

DO.
FETCH NEXT CURSOR s_cursor appending TABLE lt_B PACKAGE SIZE 60000.
IF sy-subrc <> 0.
EXIT.
ENDIF.

and then similar retrieval for 3rd table and then

ENDDO.

close cursor.

and then will process through lt_A and perform actions and all those.

second approach is  we will open the cursor and retrieve data from rest of the three table by package size but here our processing for main table and all those will be done within the cursor,means we will do the processing as package size 60000 and same way the whole will be done..please

find them below..

OPEN CURSOR WITH HOLD s_cursor FOR
SELECT

----

----
FROM A

WHERE conditions

DO.
FETCH NEXT CURSOR s_cursor into TABLE lt_A PACKAGE SIZE 60000.
IF sy-subrc <> 0.
EXIT.
ENDIF.

SELECT 

----

----
FROM B for all entries in A ----- ? I guess we  can use  for all entries..
WHERE conditions

DO.
FETCH NEXT CURSOR s_cursor into  TABLE lt_B PACKAGE SIZE 60000.
IF sy-subrc <> 0.
EXIT.
ENDIF.

and then similar retrieval for 3rd table and then.

and then will process through lt_A and perform actions and all those foe each bulk of 60000 entries..

loop at lt_a into..

functions...

ENDLOOP.

ENDDO.

close cursor.

Please help us regarding the approaches, which should be followed ?  it will really help a lot. I think we should follow second but as i am new to this so  need your advice. Also, package size 60000 is ok  or it should be reduced ?

Thanks a lot in advance.

Not what you were looking for? View more on this topic or Ask a question