- Write:
- The WRITE statement outputs the contents of a text, a field or constant in a format appropriate to the data type. ABAP data types will be discussed in detail during the next topic, ABAP Data.
- Successive WRITE statements output data, separated by one space, on the same output line. When an output line is full, output continues on the next line.
- The SKIP statement generates blank lines.
- Text Symbols
- Texts are centrally managed by using the TEXT ELEMENTS function either from the editor’s initial screen, from within the editor Edit -> Text elements, or from the program code (Goto -> Text elements), or by double-clicking on the ‘text’(003) word.
- Text symbol can be addressed by text-### or 'textliteral'(###). If the text symbol ### exists in the text pool for the logon language, this is the same as using text-###. Otherwise, the literal 'textliteral' is used as the content of the text symbol.
- The primary advantage of Text symbols is that they can be managed separately for different languages (Goto -> Translation).
- Offsets and Length
- +off(len)
- off: the start column position for the output value.
- len: the output length for the output value
- Most of the time in ABAP, we may have to read the part of data of a field (say X) and populate to other field (Say Y). In this case we have to use the offset concept to read the value.
- Example:SY-DATUM is the standard SAP field, which holds the current system date. The format of the date in SY-DATUM field will be YYYYMMDD.Where,
- YYYY => Year
- MM => Month
- DD => Day
In most of the cases we may have to read the value of month form the SY-SATUM and pass to some variable. Similarly we may have to read the value of year & day.
*--Use offset concept & populate the Year, Month & Day value to Local valriable
*--Year: Starting form Zeroth Position next 4 characters
l_year = sy-datum+0(4).
*--Month: Starting form fourth Position next 2 characters
l_month = sy-datum+4(2).
*--Day: Starting form sixth Position next 2 characters
l_day = sy-datum+6(2).
- Titles and Colums
- Title and column headings can be maintained either with the Text elements function from the initial editor screen, from within the editor (Edit -> Text elements, Titles and Headers), or from the program code (Goto -> Text elements, Titles and Headers).
- An alternative possibility is to maintain column headings when the list is printed - System --> List --> List Header or shortcut ‘%CH’.
- The list header appears as the first header line in the list. If no list header is maintained, the report title (program name from attributes screen) is used instead.
- Positioning of the text is judged by the ruler marks above each line.
- Texts can be maintained in the various system languages (Goto -> Translation menu option from within the Titles and Headers maintenance screen).
- Don’t forget to save !
No comments:
Post a Comment