![]() You can specify it dynamically as the contents of the field fi If a component is not known until runtime, The type of the component before the statement is executed, using MOVE logic. Of a value and the type of the associated key are not compatible, the system converts the value into ![]() The specified key, only the first one is deleted. The variant is a single command that deletes the table line with the key values k1 = v1. kn = vn.ĭeletes generically from an internal table. Once you have deleted the current entry of an internal table in a LOOP, the effect of subsequent changes to the currentĮntry without specifying the INDEX cannot be guaranteed, and the behavior may change in future releases.ĭELETE TABLE itab WITH TABLE KEY k1 = v1. You can only use this variant with index tables (standard or sorted tables). ENDLOOP block, the deletion affects subsequent loop passes.ĭeletes the current entry from an internal table in a LOOP. See Short forms of line operations not allowed.ĭeletes one or more lines from an internal table. SORT IT_TAB BY MATNR.ĭELETE ADJACENT DUPLICATES FROM IT_TAB COMPARING MATNR.TABLE itab WITH TABLE KEY k1 = v1. When deleting, it is judged whether the specified items before and after are the same, so please be sure to sort (SORT) immediately before the command. If you want to delete duplicate rows, use the DELETE statement with the ADJACENT DUPLICATES option. If you want to delete unnecessary lines, specify a condition and use the DELETE command. In the above, I am updating explicitly, but I personally think that it is simpler to use a field symbol if you just want to update. Use the MODIFY instruction to change the value of a row。 LOOP AT IT_TAB INTO WA_TAB. It is also possible to add multiple lines at once using “INSERT LINES OF itab1 INTO TABLE itab2”. If you want to use a sorted table for aggregation, use the COLLECT command. Use APPEND and INSERT commands to add rows. The “update” instruction differs depending on whether a row is added or the value of an existing row is changed. It is possible to use an optional TRANSPORT NO FIELD instead of INTO WA (work area) and perform only data check when SY-SUBRC is 0 (data existed) or other than 0 (data does not exist or error). On the other hand, READ TABLE is a command that can not acquire multiple rows but only one row. Personally, when you look at the program later, it is recommended that you use it so that you can instantly determine whether you want to acquire multiple lines or the logic you want to acquire only one line. If a primary key is specified as a condition, the same result as READ TABLE can be obtained, but there is no particular advantage. LOOP … ENDLOOP is often used when you want to read the entire internal table, or when you want to read under conditions that are not the primary key. READ TABLE IT_TAB INTO WA_TAB WITH KEY MATNR = 'XXXXXXXXX'. LOOP AT IT_TAB INTO WA_TAB WHERE MTART = 'ZXXX'. Use “LOOP … END LOOP” or “READ TABLE” depending on whether “read” reads multiple rows from the internal table or only one row. How to use the internal table Read(LOOP … ENDLOOP、READ TABLE) The usage and differences of these will be discussed separately, and this time I will introduce how to use the internal table. IT_TAB_BINARY TYPE HASH TABLE OF MARA WITH UNIQUE KEY MATNR, "Hash Table IT_TAB_SORT TYPE SORT TABLE OF MARA WITH UNIQUE KEY MATNR, "Sort Table IT_TAB_STD2 TYPE STANDARD TABLE OF MARA, "Standard table IT_TAB_STD1 TYPE TABLE OF MARA, "Standard table(Default) "Work Area Standard table, sorted table, hash table DATA: IT_TAB TYPE TABLE OF MARA, "Internal Table "Work Area Internal table/work area that refers to the database table DATA: IT_TAB TYPE TABLE OF TY_TABLE, "Internal Table Internal table and work area using TYPES statement Types : ![]() The basic method is to use the TYPES command defined in the program as an internal table or work area, or to refer to a database table or structure.Īs options for these definitions, there are various definition methods such as making the internal table a standard table, a sort table, a hash table, an internal table with a header, and defining a work area as a field symbol. Definition of internal table/work areaįirst, let’s introduce how to define internal tables and work areas. It is often used to read an internal table, store it in the work area, edit it in the work area, and reflect the result in the internal table. The internal table is a definition for storing a plurality of data, and the work area is a definition for storing only one row of data. ![]() ![]() There are few things that can be done with the internal table alone, and it will often be processed using the work area. Briefly, it is a database table that can be shared by multiple programs, saved and reused later, and an internal table that can be used by itself (while the program is running). ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |