Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member
0 Kudos
391

ENTER THE T-CODE --> SE38  ,

ENTER THE PROGRAM NAME AS YOUR WISH ,

*&---------------------------------------------------------------------*

*& Report  Z_ASSIGNMENT_DAY21

*&

*&---------------------------------------------------------------------*

*&

*&

*&---------------------------------------------------------------------*

REPORT Z_ASSIGNMENT_DAY21.

* Three parameters are created for the standard selection screen.

PARAMETERS: NUMBER1 TYPE p LENGTH 8 DECIMALS 3,

            NUMBER2 LIKE NUMBER1,

            NUMBER3 LIKE NUMBER1.

PARAMETERS DISPLAYS THE FIELDS LIKE THIS,

* Declaration of variables types Integer.

DATA: add_int TYPE p,

      sub_int TYPE p,

      mul_int TYPE p,

      div_int TYPE p,

      rem_int TYPE p.

add_int = trunc( number1 ) + trunc( number2 ) + trunc( number3 ) .

sub_int = trunc( number1 ) + trunc( number2 ) - trunc( number3 ) .

mul_int = trunc( number1 ) * trunc( number2 ) * trunc( number3 ) .

div_int = trunc( number1 ) + trunc( number2 ) / trunc( number3 ) .

rem_int = trunc( number1 ) + trunc( number2 ) MOD trunc( number3 ) .

uline at /(75).

WRITE:/ '|',3 'ADDITION' CENTERED,15 '|','SUBTRACTION' CENTERED,32 '|','MULTIPLICATION' CENTERED,50 '|','DIVISION' CENTERED,62 '|','REMAINDER' CENTERED,75 '|'.

uline at /(75).

WRITE:/ '|',3 add_int CENTERED,15 '|', sub_int CENTERED,32 '|', mul_int CENTERED,50 '|', div_int CENTERED,62 '|', rem_int CENTERED,75 '|'.

uline at /(75).

* Declaration of variables type Packed numbers.

DATA: add_dec TYPE p LENGTH 8 DECIMALS 3,

      sub_dec LIKE add_dec,

      mul_dec LIKE add_dec,

      div_dec LIKE add_dec,

      rem_dec LIKE add_dec.

add_dec = frac( number1 ) + frac( number2 ) + frac( number3 ) .

sub_dec = frac( number1 ) + frac( number2 ) - frac( number3 ) .

mul_dec = frac( number1 ) * frac( number2 ) * frac( number3 ) .

div_dec = frac( number1 ) + frac( number2 ) / frac( number3 ) .

rem_dec = frac( number1 ) + frac( number2 ) MOD frac( number3 ) .

uline at /(75).

WRITE:/ '|',3 'ADDITION' CENTERED,15 '|','SUBTRACTION' CENTERED,32 '|','MULTIPLICATION' CENTERED,50 '|','DIVISION' CENTERED,62 '|','REMAINDER' CENTERED,75 '|'.

uline at /(75).

WRITE:/ '|',3 add_dec CENTERED,15 '|', sub_dec CENTERED,32 '|', mul_dec CENTERED,50 '|', div_dec CENTERED,62 '|', rem_dec CENTERED,75 '|'.

uline at /(75).

OUTPUT :

Happy Coding,

Vamsi Konaki

Labels in this area