I have a problem with performance in transformation, I found LOOP inside the LOOP, which I read can affect performance. I'm trying to change it, but I keep getting errors. Do you have an idea how I can eliminate one loop to improve the performance?
LOOP AT it_dyn INTO wa_dyn WHERE chanm = 'LCCTR'.
INTO TABLE it_edir1
WHERE iobjnm = 'LCCTR' AND
dateto = '99991231'
hienm = wa_dyn-low.
IF sy-subrc = 0.
LOOP AT it_dir1 INTO ls_dir1.
APPEND ls_dir1 TO it_dir.
Firstly, it is best practice not to use select statement inside a loop. You can populate another internal table where CHANM = 'LCCTR'. Best way to do it is copy IT_DYN to IT_DYN_2 and then delete IT_DYN_2 where CHANM <> 'LCCTR' and use for all entries to get the records in the select statement based on entries in IT_DYN_2.
Secondly, if you are just copying records from one internal table to another with same structure, you can use IT_DIR = IT_DIR1.
Using any of the above mentioned points, you can improve the performance drastically. I am in favor of using both if possible.