Skip to Content
Aug 01, 2012 at 06:50 AM

How to avoid loop inside loop.


Hi All,

I am BW Consultant and i have written Functio Module extraction using the ABAP Code. Please find the below ABAP Code.

I am using Z table Z175 and BSEG table and moving the data to final internal table.

In Z175, Billing document field is there. It contains more than 1 data for a single billing document and

BSEG table will also have more than 1 data for a single billing document.

Using the Condition Z175-VBELN = BSEG-BELNR i am pulling the data for other fields such as GL Account, Group Account and other details.

I have written the code as loop inside the Loop. Because of this, it is affecting the performance.

Can you please help me on modifying the attached code.


Moderator Message: ℹ️ Search the internet with search terms viz., Parallel cursor for LOOPs, Nested loop optimisation using SORTED TABLEs. Personally i use the latter.

Message was edited by: Suhas Saha

Attachments (2.7 kB)