This tip comes from ABAP/4: Programming the SAP R/3 System, ISBN # 0-201-67515-3, by Bernd Matzke.
Many test reports contain lists of important table fields, which are usually C-type and N-type key fields. To achieve this in the output statement, you must program all the fields that are to be output. If only C-type and N-type fields are to be output, you can use the procedure shown below to save yourself a lot of work. First you create a structure that contains all the table fields you want to output. You insert a blank field between each of these fields as follows:
DATA: BEGIN OF F_TEST, LNAME LIKE TAB-LASTNAME, SPACE1, FNAME LIKE TAB-FIRSTNAME, SPACE2, BDATE LIKE TAB-BDATE, END OF F_TEST.
In the program, you then use the MOVE-CORRESPONDING statement to assign the contents to this structure in the SELECT loop. The sturcture is then outpu t with this statement:
WRITE / F_TEST
The structure is displayed correctly because the system handles it entirely as a C-field. However, this does mean that transformation, particularly those based on data types such as converting functions controlled by the data element, will not be effective.
Pick up your copy of ABAP/4: Programming the SAP R/3 System to read more great tips like this.