* Starting a line with star means, * that it will be handled * as a comment * this line is for the formalities * it must be included in all * reports report firstreport. * lets write one line write 'Something is written here'.
Writing five lines
* This line does what it says do 5 times. * / means new line write / 'Line number:'. * sy-index is the actual index write sy-index. * Do things 5 times until now enddo.
Line number: 1 Line number: 2 Line number: 3 Line number: 4 Line number: 5
* Lets define a text variable data var_text(10). * And a numeric variable data var_number type i. var_text = ‘Apple’. * Extend this variable concatenate var_text ‘falls’ ‘down’ into var_text. write var_text. var_number = 95. add 20 to var_number. write var_number.
Lazy programmers
* Some say programmers are lazy * I don't necessary agree, * but they certainly made life * simpler for themselves. write / 'Instead of writing'. write / 'a write command'. write / 'for each field,'. write:/ 'you can use', / 'one colon(:)', / 'and instead of commands', / 'as many commas(,)', / 'as you want'.
Instead of writing a write command for each field, you can use one colon(:) and instead of commands as many commas(,) as you want
select single * from t005t where spras = 'EN' and land1 = 'HU'. * Write, what we got from the table Write: t005t-land1, t005t-landx, t005t-nation.
Internal table
* Lets create an internal table data: begin of i_tab occurs 0, text(10), num type I, end of i_tab. i_tab-text = ‘Cats’. i_tab-num = 5. append i_tab. i_tab-text = ‘Dogs’. i_tab-num = 2. append i_tab. loop at i_tab. write:/ i_tab-text, i_tab-num. endloop.
Cats 5 Dogs 2