Skip to Content

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,

Screenshot1.png

* 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 :

Screenshot2.png

Happy Coding,

Vamsi Konaki

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply