Ничек миңа менә мондый җәдвәлемнән:
| Сату | Кем | КМ | Литр |
|---|---|---|---|
| 001 | Тукай | 50 | 5 |
| 001 | Тукай | 50 | 10 |
| 001 | Тукай | 21 | 20 |
| 002 | Каюм | 15 | 10 |
| 002 | Каюм | 63 | 10 |
| 002 | Каюм | 41 | 20 |
| 002 | Каюм | 12 | 5 |
мондый нәтиҗә чыгарырга:
| Сату | Кем | КМ | Литр |
|---|---|---|---|
| 001 | Тукай | 121 | 35 |
| 002 | Каюм | 131 | 45 |
sort mt_e1edk04 ascending by mwskz msatz. loop at mt_e1edk04 assigning field-symbol(<fs_e1edk04>). at new mwskz. clear: lv_mwsbtsum, lv_txjcdsum. endat. lv_mwsbtsum = lv_mwsbtsum + <fs_e1edk04>-mwsbt. lv_txjcdsum = lv_txjcdsum + <fs_e1edk04>-txjcd. at end of mwskz. ls_e1edk_out-mwskz = <fs_e1edk04>-mwskz. move <fs_e1edk04>-msatz to ls_e1edk_out-msatz. move lv_mwsbtsum to ls_e1edk_out-mwsbt. move lv_txjcdsum to ls_e1edk_out-txjcd. append ls_e1edk_out to lt_e1edk04. endat. endloop.

– 3 (өч) җәдвал төрләре арасында (standard, sorted hәм hashed) нинди аермалары бар?
җавап: Standard tables: the row numbering (index) is maintained internally. Both index and key accesses are possible. You should choose this table type when you mainly use the index to access the internal table.
Sorted tables: the data records are automatically sorted in ascending order of the key fields. Here too, the index is maintained internally. Both index and key accesses are possible. You should choose this table type if you mainly access the internal table with the key or would like the table to be automatically sorted by key.
Hashed tables: the data records are managed for fast key access using the hashing procedure. A unique key is required. With hashed tables only key accesses are possible. You should choose this table type if the internal table is very large and you want to access it by key only.
DATA: lt_student1 TYPE STANDARD TABLE OF ty_students. DATA stab TYPE SORTED TABLE OF skb1 WITH UNIQUE KEY bukrs saknr. DATA htab TYPE HASHED TABLE OF skb1 WITH UNIQUE KEY bukrs saknr.
You fill sorted tables using the INSERT statement. Entries are inserted according to the sort sequence defined through the table key. Any illegal entries are recognized as soon as you try to add them to the table. The response time for key access is logarithmically proportional to the number of table entries, since the system always uses a binary search. Sorted tables are particularly useful for partially sequential processing in a LOOP if you specify the beginning of the table key in the WHERE condition.
You cannot access a hashed table using its index. The response time for key access remains constant, regardless of the number of table entries. Like database tables, hashed tables always have a unique key. Hashed tables are useful if you want to construct and use an internal table which resembles a database table or for processing large amounts of data. Accesses must use generic key operations (SORT, LOOP, etc.).