In ABAP, How to select all the data into my internal table using loops?


There are different ways that you can use to check the performance of your program. As per my understanding, you can join all tables like this:

SELECT t11~orgeh t11~msty t11~mshort t12~position t13~job t14~job_grade t14~scheme
   INTO gt_my_combined_table
   FROM zgerpt_rnk_min as t11
   JOIN hrp1001 as t12
   ON t11~orgeh = t12~objid
   JOIN hrp1001 as t13
   ON t12~position = t13~objid
   JOIN hrp9003
   ON t13~job = t14~objid
WHERE t12~otype = 'O' AND
   T12~sclas = 'S' AND
   T12~begda LE p_keydt AND
   T12~endda GE p_keydt AND
   T12~plvar ='01' AND
   T12~istat = '1' AND
   T12~objid IN (pnpobjid) AND
   T13~otype = 'S' AND
   T13~sclas = 'C' AND
   T13~begda LE p_keydt AND
   T13~endda GE p_keydt AND
   T14~begda LE p_keydt AND
   T14~endda GE p_keydt.

The main problem with this statement is that it would be tough to determine which key or index to use hence making it bit inefficient.

To check runtime of a program, you can use T-Code: SAT which determines most efficient statements in the program and also provide ideas for performance improvement.

You can also use T-Code ST05 to measure the performance of your program. This Transaction is used to run Performance trace in SAP system.

Updated on 10-Dec-2019 08:35:38