Programming

Formatting Options in SAPscript: Without the Leading Sign

In SAPscript about symbol that contain numeric value, you can show value symbol without sign by this option.

Syntax

&VAR(S)&

Example


&VAR&  =     999.99-
&VAR(S)& = 999.99

Formatting Options in SAPscript: Symbol Length

In SAPscript you can define a part of symbol value by this option.

Syntax

&VAR(n)&

Example


&VAR&  =     ABCDEFGHIJK
&VAR(2)& = AB
&VAR+2(3)& = CDE

Formatting Options in SAPscript: Offset

In SAPscript if you want to present the value of data by offset n characters to the right (n left characters symbols will not be displayed), you can apply offset format to it.

Syntax

&VAR+n&

Example


&VAR&    =     ABCDEFGHIJK
&VAR+2& = CDEFGHIJK

What does it mean when SELECT statement return SY-SUBRC in ABAP/4 ?

When you execute statement in the program by SELECT cluase, system will return action to SY-SUBRC. SY-SUBRC means:

0 - Successfully. At least one record found.
4 - No record found
8 - Ambiguous WHERE clause. you shoud be apply SELECT SINGLE.

Convert Date <-> Timestamp in ABAP/4

Date to Timestamp

Example

*&---------------------------------------------------------------------*
*&    Form convert_date_to_timestamp
*&---------------------------------------------------------------------*
form convert_date_to_timestamp using par_date
                                   par_time
                                   par_time_zone
                             changing par_timestamp.
clear par_timestamp.
CONVERT DATE par_date TIME par_time INTO
        TIME STAMP par_timestamp TIME ZONE par_time_zone.
endform.                  " convert_date_to_timestamp

Timestamp to Date

System Symbols in SAPscript


Symbol            Description
&DATE& Current Date
&DAY& Current Day Number
&MONTH& Current Month Number
&YEAR& Current Year Number
&NAME_OF_DAY& Current Day Name
&NAME_OF_MONTH& Current Month Name
&TIME& Current Time
&HOURS& Hours Component of Current Time
&MINUTES& Minutes Component of Current Time
&SECONDS& Seconds Component of Current Time
&PAGES& Current Page Number
&NEXTPAGE& Page Number of the Next Page
&DEVICE& Selected Device Type
&SPACE& Space
&ULINE& Underline
&VLINE& Vertical Line