Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

nested loops avoid parallel cursor

Former Member
0 Likes
774

Moved to correct forum by moderator

Hi Experts,

In my program lot of nesteed loop used, i want to avoid that, so that way i am using parallel cursor.

But My program there is loops using structue plz help me.

Exp loop zstruc

loop zstruc1

endloop.

endloop.

Edited by: Matt on Nov 27, 2008 2:09 PM

4 REPLIES 4
Read only

Former Member
0 Likes
670

hi,

you can use open cursor to fetch such large number of records and it will reduce the time and its very performnace effective.

a sample code is :

****************************************************

Selection using open cursor

*****************************************************

DATA: LWA_OP_SAL_ORD1 TYPE GT_COMTAB.

IF SY-SUBRC = 0.

OPEN CURSOR C1 FOR

SELECT VBAP~MATNR

FROM VBAP INNER JOIN VBAK

ON VBAPVBELN EQ VBAKVBELN

FOR ALL ENTRIES IN GIT_VBUK

WHERE VBAP~VBELN = GIT_VBUK-VBELN AND

VBAK~VBTYP = 'C'.

DO.

CLEAR LWA_OP_SAL_ORD1.

FETCH NEXT CURSOR C1 INTO CORRESPONDING FIELDS OF LWA_OP_SAL_ORD1.

IF SY-SUBRC = 0.

APPEND LWA_OP_SAL_ORD1 TO LI_OP_SAL_OR

enddo.

i think this will help.

Read only

Former Member
0 Likes
670

Please note if my understanding is correct

if you can avoid nested loops by using READ TABLE statement

it would be better

Regards

Ramchander Rao.K

Read only

former_member404244
Active Contributor
0 Likes
670

This message was moderated.

Read only

Former Member
0 Likes
670

good