10-15-2020 2:58 PM
I write simple SELECT on MARA table in AMDP and populate an internal table with MARA data. I loop MARA internal table outside the AMDP and write some logic inside the loop. I can loop MARA internal table in AMDP itself using the statement FOR and write the same logic. Which will give better performance?
Looping Internal table in AMDP using FOR
DECLARE lv_index "$ABAP.type( sy-index )";
DECLARE lv_matnr "$ABAP.type( matnr )";
lt_mara = SELECT * FROM mara LIMIT 100;
for lv_index in 1..record_count( :lt_mara ) do
lv_matnr = :lt_mara.matnr[ lv_index ];
-- Write all required logic
END FOR ;
10-15-2020 3:44 PM
10-15-2020 5:29 PM
10-15-2020 5:47 PM
One possibility (SQLScript of course):
DECLARE pos INTEGER DEFAULT 0;
DECLARE i INTEGER;
FOR i IN 1..10 DO
pos = :pos + 1;
END FOR;
10-16-2020 7:09 AM
Sorry. My question was not detailed. I have rewritten my question. Please provide your valuable comments.
10-16-2020 7:51 AM
So, what takes longer between
ABAP > DBI > network > DB execution > network > DBI > ABAP
and
ABAP > DBI > network > DB procedure > DB execution > DB procedure > network > DBI > ABAP
?
I guess the time depends on the volume of network traffic.
But is it significant compared to DB execution time?