Modifying a group of lines of an internal table:如果內表中需要對多行進行數據修改,請采用整體修改的方式
Use the variations of the modify command to speed up this kind of processing.
Not recommended
Loop at int_fligh.
If int_fligh-flag is initial.
Int_fligh-flag = ‘X’.
Endif.
Modify int_fligh.
Endloop.
Recommended
Int_fligh-flag = ‘X’.
Modify int_fligh transporting flag where flag is initial.
個人體會:注意這個transporting
When a programmer uses the read command, the table is sequentially searched. This slows down the processing. Instead of this, use the binary search addition. The binary search algorithm helps faster search of a value in an internal table. It is advisable to sort the internal table before doing a binary search. Binary search repeatedly divides the search interval in half. If the value to be searched is less than the item in the middle of the interval, the search is narrowed to the lower half, otherwise the search is narrowed to the upper half.
Not Recommended
Read table int_fligh with key airln = ‘LF’.
Recommended
Read table int_fligh with key airln = ‘LF’ binary search.
個人體會:記得先排序
Appending 2 internal tables:鏈接兩個內表
Instead of using the normal loop-endloop approach for this kind of programming, use the variation of the append command. Care should be taken that the definition of both the internal tables should be identical.
Not Recommended
Loop at int_fligh1.
Append int_fligh1 to int_fligh2.
Endloop.
Recommended
Append lines of int_fligh1 to int_fligh2.
個人體會:比較少用,記住用戶即可
Use of buffered tables is recommended to improve the performance considerably. The buffer is bypassed while using the following statements
Use the Bypass buffer addition to the select clause in order to explicitly bypass the buffer while selecting the data.
Use of FOR ALL Entries:where條件采用內表的方式才說明
Outer join can be created using this addition to the where clause in a select statement. It speeds up the performance tremendously, but the cons of using this variation are listed below
Not Recommended
Loop at int_cntry.
Select single * from zfligh into int_fligh
where cntry = int_cntry-cntry.
Append int_fligh.
Endloop.
Recommended
Select * from zfligh appending table int_fligh
For all entries in int_cntry
Where cntry = int_cntry-cntry.
個人體會:要注意內表為空的情況
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/554557/viewspace-470536/ ,如需转载,请注明出处,否则将追究法律责任。