SAP ABAP Smartforms & SAPscript Formatting
SAP ABAP Smartforms & SAPscript Formatting
Smartforms Formatting
Following are the few useful formatting options:
Offset:
N left-most characters of the symbol value will not be displayed.
If symbol has the value 123456789, the following will be displayed:
&symbol& -> 123456789
&symbol+3& -> 456789
&symbol+7& -> 89
&symbol+12& ->
&symbol+0& -> 123456789
Output Length
To define how many character positions should be copied from the value.
If symbol has the value 123456789.
&symbol(3)& -> 123
&symbol(7)& -> 1234567
The SYST-UNAME field contains the logon name of a user called Einstein. The
Dictionary entry for this field contains an output length of 12.
&SYST-UNAME&… -> Einstein…
&SYST-UNAME(9)&… -> Einstein …
&SYST-UNAME(*)&… -> Einstein …
Space Compression
The C option has the effect of replacing each string of space characters with a single space and
shifting the ’words’ to the left as necessary to close up the gaps.
Assuming ‘ Albert Einstein ‘ is the symbol value,
&symbol& -> Albert Einstein
&symbol(C)& -> Albert Einstein
Right-Justified Output
Right-justified formatting can be specified with the R option. This option has to be used in
conjunction with an output length specification. If symbol has the value 1234.
&symbol& -> 1234
&symbol(8R) -> 1234
Fill Characters
Leading spaces in a value can be replaced with a fill character.
The figure for customer sales in the KNA1-UMSAT field is $700. The Dictionary description of the
field specifies an output length 8.
&KNA1-UMSAT& -> 700.00
&KNA1-UMSAT(F*)& -> **700.00
&KNA1-UMSAT(F0)& -> 00700.00
Date Mask
The formatting for date fields can be defined with the SAPscript SET DATE MASK command.
Executing this command causes all subsequent date fields to be output using the specified
formatting.
/: SET DATE MASK = ‘date_mask’
The following templates may be used in the date mask:
DD day (two digits)
DDD name of day (abbreviated)
DDDD name of day (written out in full)
MM month (two digits)
MMM name of month (abbreviated)
MMMM name of month (written out in full)
YY year (two digits)
YYYY year (four digits)
LD day (formatted as for the L option)
LM month (formatted as for the L option)
LY year (formatted as for the L option)
Time Mask
You can use the SAPscript SET TIME MASK command to format time fields in a way that differs
from the standard setting.
Assuming the current time is 10:08:12.
&TIME& -> 10:08:12
/: SET TIME MASK = ‘HH:MM’
&TIME& -> 10:08
/: SET TIME MASK = ‘HH hours MM minutes’
&TIME& -> 10 hours 08 minutes
&TIME(Z)& -> 10 hours 8 minutes