You are on page 1of 4

Break Point : To stop the program at desired location at runtime.

The break points


are set only when the progrm status is
active. F5 function key is used to execute the program line by line mode.

PARAMETERS :
It is used to accept input values at runtime of the program. For each parameter
declared, an input field appears on the corresponding selection screen.

PARAMETERS <p>[(length)] [TYPE <type>]

*To assign a default value to a parameter, you use the following syntax:

PARAMETERS <p> ...... DEFAULT <f> ......

**Example

PARAMETERS: par1 TYPE i,


par2 TYPE i.

DATA: result TYPE p DECIMALS 3.

result = par1 + par2.

WRITE:/ result.

*********************
Control Statements
*********************
*Relational Operators :
*
*EQ =
*GT >
*LT <
*NE <>
*LE <=
*GE >=
*
*Logical Operators :
*
*AND
*OR
*NOT

****IF condition

*PARAMETERS: pa_num1 TYPE i,


* pa_num2 TYPE i.
*
*IF pa_num1 > pa_num2.
* WRITE 'Num1 is greater than Num2'.
*ELSEIF pa_num1 < pa_num2.
* WRITE 'Num1 is less than Num2'.
*ELSE.
* WRITE 'Num1 is equal to Num2'.
*ENDIF.

****CASE statement
* CASE and ENDCASE are used to avoid multiple IF statements

*PARAMETERS pa_num type i.


*
*CASE pa_num.
*
*WHEN 1.
* WRITE 'Value of pa_num is 1'.
*WHEN 2.
* WRITE 'Value of pa_num is 2'.
*WHEN 3.
* WRITE 'Value of pa_num is 3'.
*WHEN OTHERS.
* WRITE 'Value of pa_num is other than 1, 2 and 3'.
*ENDCASE.

*****SYSTEM Variables DATABASE table name is SYST.

*WRITE: SY-DATUM, "Application Server Date


* / SY-UZEIT, "Application Server Time
* / SY-REPID, "R/3 System, Current Language
* / SY-UNAME. "user name

*SY-INDEX
*--------
*The system field SY-INDEX contains the number of loop passes,
*including the current loop pass.

****** DO.....ENDDO

*PARAMETERS pa_num type i.


*
*Data x type i.

*x = pa_num.

*DO pa_num TIMES.


*
* WRITE:/ sy-index.
*
*ENDDO.

DO.
IF sy-index > 5.
EXIT.
* STOP.
ELSE.
WRITE:/ sy-index.
ENDIF.
ENDDO.

WRITE:/ 'Out side of the loop DO.....ENDDO'.

* EXIT :
* Terminates the loop and continues the rest of the program till the
* end.
* STOP :
* Terminates the loop and moves the control outof the program.

*****While...ENDWHILE
PARAMETERS pa_num type i.
*WHILE pa_num > 0.
*
*write : / sy-index.
*pa_num = pa_num - 1.
*ENDWHILE.

*****RADIO GROUP

* To define the input field of a parameter as a radio button, you use the following
syntax:

PARAMETERS <p> ...... RADIOBUTTON GROUP <radi>......

*parameters: rb1 radiobutton group gp1,


* rb2 radiobutton group gp1,
* rb3 radiobutton group gp2,
* rb4 radiobutton group gp2.
*
*if rb1 = 'X' or rb2 = 'X'.
*write: / 'gp1 clicked'.
*else.
*write: / 'gp1 not clicked'.
*endif.
*
*if rb3 = 'X' or rb4 = 'X'.
*write: / 'gp2 clicked'.
*else.
*write: / 'gp2 not clicked'.
*endif.

******CheckBox

*To define the input field of a parameter as a checkbox, you use the following
syntax:

PARAMETERS <p> ...... AS CHECKBOX ......

*parameters: cb1 as checkbox,


* cb2 as checkbox.
*
*
*if cb1 = 'X'.
*write: / 'cb1 clicked'.
*else.
*write: / 'cb1 not clicked'.
*endif.
*
*if cb2 = 'X'.
*write: / 'cb2 clicked'.
*else.
*write: / 'cb2 not clicked'.
*endif.
*
*if cb1 = 'X' and cb2 = 'X'.
*write: / 'cb1 and cb2 clicked'.
*else.
*write: / 'cb1 cb2 not clicked'.
*endif.

--> Assignment write a program using checkbox like SUM,SUB,MUL and DIV.

You might also like