To keep the table ordered and use binary search or used a table of type SORTED "CLEAR f WITH val" whenever you want to initialize a field with a value differentįrom the field's type-specific initial value. The strlen( ) function to restrict the DO loop to the relevant part of the field, The SPLIT statement instead of programming a string split yourself. In any case, avoid using SHIFT inside a WHILE-loop! SY-FDPOS PLACES, with CONDENSE if possible, with CN and ASSIGN CLA+SY-FDPOS(LEN) SHIFT.LEFT DELETING LEADING.Other constructions (with CN and SHIFT.BY You want to delete the leading spaces in a string, use the ABAP/4 statement The CONCATENATE statement instead of programming a string concatenation of your STRING_MOVE_RIGHT -> WRITE.TO.RIGHT-JUSTIFIED > SPLIT, STRING_LENGTH -> strlen(), STRING_CENTER -> WRITE.TO.CENTERED, Replaced by ABAP/4 statements or functions: STRING_CONCATENATE. If ABAP/4 statements are executed per character on long strings, CPU consumptionįunction modules for string manipulation have become obsolete and should be The special operators CO, CA, CS, instead of programming the operations yourself. Of using nested Select loops or FOR ALL ENTRIES it is often possible to use Possible, use column updates instead of single-row updates to update your database Frequent communication between the application program andĭatabase system produces considerable overhead. Possible, use array operations instead of single-row operations to modify yourĭatabase tables. Network load is considerably less.Īll frequently used, read-only tables, try to use SAP buffering. Internal table handling takesĪ select list or a view instead of Select *, if you are only interested in You process your data only once, use a Select-Endselect-loop instead of collectingĭata in an internal table with Select Into Table. You want to find the maximum, minimum, sum and average value or the count ofĪ database column, use a select list with aggregate functions instead of computing Read data from several logically connected tables use a join instead of nested Is always faster to use the Into Table version of a Select statement than to Requires one communication with the database system, whereas Select-Endselect Use the Select Single statement instead of a Select-Endselect-loop. There exists at least one row of a database table or view with a certain condition, Note that complex WhereĬlauses are poison for the statement optimizer in any database system. Logical Ands in the Select statement's Where clause. Index if you specify (a generic part of) the index fields concatenated with The database system can then use an index (if possible)Īnd the network load is considerably less.Īll frequently used Select statements, try to use an index. Specify your conditions in the Where-clause instead of checking them yourself Here is a non-JavaScript version of the image slideshow: Since your web browser does not support JavaScript, If you just want to delete a particular row then you need to use the DELETE statement.Ĭonsider a case when your internal table has duplicate entries, in this situation you can SORT the internal table and delete the duplicate entries as follows Will clear the contents of the ITAB as shown above for REFRESH and CLEAR in addidtion to that it also frees the memory allocation from SAP memory. Will clear the header line as well as the contents of ITAB and the ITAB values will remain as shown below. Note: CLEAR ITAB will clear only the contents of the header line. If the ITAB has 4 fileds and 4 Records as followsĪnd the header line contents are as follows You can use DELETE statement to delete a particular record from the internal table. For better performance of ABAP programs you should free the memory if the internal table is not going to be used again in the program. Will deallocate the memory for the internal table. This is used when the internal table is without the header line. If the table has a header line the contents of the header line will still remain. The above statement will also clear the contents of the internal table completely. The above statement will clear the contents of the internal table but the header line contents will not be cleared. CLEAR ITAB will just clear the header line of the internal table. Many a times you want to just clear the header line of the internal table but want to keep the contents as they are. If you want to clear the header line of the Internal Table ITAB use the statement given below We will see how to Initialize an internal table.īasically we will see what the following statements do to an internal table.Ĭonsider an Internal table with name ITAB. Internal tables are an important part of any ABAP development.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |