We are hiring and constantly growing! Have a look through our vacancies to find the right role for you!
WRITE dobj TO itab$[+off$]$[(len)$] INDEX idx
$[format_options$].
This variant, of the statement WRITE TO, which is forbidden in classes, has the same effect as the allowed variant, except that the formatted content is written to the line of the internal table itab specified in idx. The internal table must be a standard table without secondary table keys. The same requirements apply to the line type as to the variable destination.
idx expects a data object of the data type i. It must be a data type. When the statement is executed, this data object must contain the index of the line to be overwritten. If the value of idx is less than or equal to 0, an uncatchable exception is raised. If the value of idx is greater than the number of table lines, no line is overwritten and sy-subrc is set to 4.
After the table name itab,
offset and length specifications off and len can be made that refer to the specified table line.
System Fields
sy-subrc | Meaning |
0 | The data object specified in source_name and the line specified in idx were found and the statement was executed. |
4 | The data object specified in source_name or the line specified in idx were not found and the statement was not executed. |
This form of the statement WRITE TO is now only possible outside of classes and is replaced by accessing table lines using field symbols or data references. The following lines show the implementation with a field symbol:
FIELD-SYMBOLS line> LIKE LINE OF itab.
ASSIGN itab[ idx ] TO line>.
WRITE dobj TO line>$[+off$]$[(len)$]$[
format_options$].
Formatted write of the current date into the first line of the internal table itab. The first statement WRITE TO uses the obsolete form; the second statement WRITE TO represents the recommended variant.
Non-Catchable Exceptions
Leave us your contact details and we will call you back. Fields marked with * are mandatory.
We offer holistic SAP solutions from a single source to shape digital change and develop new business areas.
Switzerland
Schaffhausen
Germany
Mannheim, Düsseldorf, Munich
USA
Haverhill
Greece
Thessaloniki