Академический Документы
Профессиональный Документы
Культура Документы
sy-index = Loop Index. set by DO and WHILE loops. contains the number of the loop passes including the current pass.
been evaluated and are no longer required in the further course of the program.
4. COLLECT :
COLLECT wa INTO itab. itab must have a flat line type, and all of the fields that are not part of the table key must have a numeric type (f, i, p). You specify the line wathat you want to add as a work area that is compatible with the line type of itab. When the line is inserted, the system checks whether there is already a table entry that matches the key. If there is no corresponding entry already in the table, the COLLECT statement has the same effect as inserting the new line. If an entry with the same key already exists, the COLLECT statement does not append a new line, but adds the contents of the numeric fields in the work area to the contents of the numeric fields in the existing entry.
5. Subroutine Types:
Call by Value A copy is made of the actual parameter. This copy is assigned to the formal parameter. If in the subroutine a value is assigned to the corresponding formal parameter, this value will actually be assigned to a copy of the formal parameter and not its original. You use this pass type, to make the value of a global variable available to the subroutine (in the form of a variable copy) without making it possible to change the respective global variable (protecting the original). Please note, however, that creating copies, especially for large internal tables, can be time-consuming. Call by value and result With this transfer type, the same applies as for .call by value.. However, at the regular end of the subroutine, the value that was changed to this point is written back to the original. If the program is prematurely terminated through a STOP statement or a user message of type E, the writing back of the values is suppressed. You use this pass type to transfer the value of a global variable to the subroutine and to have the fully processed final value of the copy written back to the original. But note that the creation of copies and the writing back of values can be time-consuming, especially for large internal tables.
Call by reference The actual parameter is assigned directly to the formal parameter. This means that value assignments to the formal parameter are executed directly on the actual parameter. You use this pass type if you want to run the subroutine processing directly on the specified actual parameter. It is popular for avoiding the time-consuming creation of copies for large internal tables.
report zrich_0002 . data: it001 type table of t001 with header line. select * into table it001 from t001. export it001 = it001 to memory id 'ZRICH_TEST'. clear it001. refresh it001. import it001 = it001 from memory id 'ZRICH_TEST'. loop at it001. write:/ it001-bukrs, it001-butxt. endloop.