Tuesday, January 6, 2009

Programming basics

Write Statement:

Write ‘SAP’.

Write ‘Bangalore

Write ‘India

Output: SAPBangaloreIndia

/ or Skip is used to go to next line for printing

WRITE / ‘Bangalore’.

Semicolon is chain operator.

One is saved from the hassle of writing same command again and again by using chain operator.

Write : ‘SAP’,

/ ‘Bangalore’,


Write ‘SAP Labs’ color 7.

Makes the background will be colored.

Write ‘SAP Labs’ color 7 inverse on.

Only the letters will be colored.


  1. Modifiable

- Character:

C Character

N Numeric

D Date

T Time

X Hexadecimal

S String

- Numeric:

I Integer

F Float

P Packed decimal

  1. Non Modifiabale

- Constants

- Literals

For character, numeric and packed, it is mandatory to define the size, for others it is optional.

Declaring Variables:

Data Var(size) type t [decimals d][value 11]


Data name (10) type c.

Data roll(3) type n.

Data doj type D value ‘20081007’.

Data per(3) type P decimals 2.

Parameter Var(size) type t

[decimals d]


[lower case]


Parameters P_name(10) type C obligatory lower case.

Write: / P_name.

Syntax :

Write : / P(n) ‘ ‘ color n Inverse on.

Where P is the offset position and n is no. of characters.

Write: / 7(3) ‘SAP’.

In data we have value and in parameters we have default as an optional addition to provide initial default values.

Creating a Program:

SE38 – Enter a program name – Create (F5) – Enter Title

Type is executable type.

Single line comments should start with * in the first column.

In ABAP editor, after Report Statement – write the code.

Save Check and Activate after writing the code.

F8 to execute.

By default standard page header contains:

Program name, page number and under line.

In order to suppress default page header:

After report name: write following


To comment from middle of line use “.

Write: v_name centered,

/ v_turn centered,

/ sy-datum left-justified,


To underline sy-uline

Sy-vline- for vertical line.

Standard selection screen number is 1000.

No comments: