How to use editor-call statement
The editor-call statement displays the contents of an internal table to the user in an editor similar to the ABAP/4 source code editor. It is useful for debugging and as a simple interface for allowing the user to enter and modify data in tabular form.
Syntax for the editor-call Statement
The following is the syntax for the editor-call statement.
editor-call for it [title t] [display mode]
where:
- it is the name of an internal table.
- t is a literal, constant, or variable.
The following points apply:
- it can only contain type c components.
- The maximum length for a row is 72 characters.
- t is the text displayed in the title bar of the editor window.
The display mode addition causes the data to be displayed in the editor in display mode. The user will be able to search and scroll, but will not be able to change the contents.
After viewing or modifying the internal table contents via the editor, the user presses one of these buttons: Save, Back, Exit, or Cancel. Save saves the changes made to the internal table contents and returns to the program. Back, Exit, and Cancel leave the editor and return to the program. If changes have been made, the user is prompted to save or cancel the changes.
After the editor-call statement has executed, sy-subrc is set to the values shown in Table 1
Table 1 Values of SY-SUBRC After the EDITOR-CALL Statement
| sy-subrc | Meaning |
| 0 | A save was performed. The contents of the internal table might or might not be changed. |
| 4 | The user did not perform a save. The contents of the internal table are unchanged. |
Listing 1 shows a sample program that uses the editor-call statement. In this example, the internal table is filled with five lines and displayed in the editor so that the user can modify the data. The contents are then written out, and a message is also written to indicate whether a change was performed.
Listing 1 Use the editor-call Statement to View, Edit, and Debug the Contents of an Internal Table.
1 report ztx1203. 2 data: begin of it occurs 10, 3 t(72), "text 4 end of it, 5 save_it like it occurs 10. "will contain copy of the original 6 7 it-t = 'Name :'. append it. 8 it-t = 'Address :'. append it. 9 it-t = 'Phone :'. append it. 10 it-t = 'Freeform Text '. append it. 11 clear it-t with '-'. append it. 12 13 save_it = it[]. "same as: save_it[] = it[]. 14 editor-call for it title 'Freeform Entry'. 15 if sy-subrc = 4. "user did not perform a save 16 write: / 'Data was not changed'. 17 elseif save_it[] <> it[]. "user performed a save 18 write: / 'Data was changed'. 19 else. 20 write: / 'Data was not changed'. 21 endif. 22 write: / sy-uline(72). 23 loop at it. 24 write: / it-t. 25 endloop.
If no data is entered when the editor is displayed, the code in Listing 12.3 produces this output:
Data was not changed ----------------------------------------------------------------------- Name : Address : Phone : Freeform Text -------------------------------------------------------------------
Popularity: 6% [?]






