Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

EXPLAIN THIS CODE...

Former Member
0 Likes
726

DATA: result TYPE i,

n1 TYPE i VALUE 5,

n2 TYPE i VALUE 6.

DEFINE operation.

result = &1 &2 &3.

output &1 &2 &3 result.

END-OF-DEFINITION.

DEFINE output.

write: / 'The result of &1 &2 &3 is', &4.

END-OF-DEFINITION.

operation 4 + 3.

operation 2 ** 7.

operation n2 - n1.

1 ACCEPTED SOLUTION
Read only

0 Likes
702

hi,

you have created two Macros operation and output.

and then when you execute the below code their respective macros will get executed

operation 4 + 3.

operation 2 ** 7.

operation n2 - n1.

for example : operation 4 + 3. will execute operator macro in which it Contains the output macro and the result will be displayed.

regards,.

santosh.

5 REPLIES 5
Read only

Former Member
0 Likes
702

Hi,

DATA: result TYPE i,

n1 TYPE i VALUE 5,

n2 TYPE i VALUE 6.

  • <b>This is macro definition.</b>

DEFINE operation.

result = &1 &2 &3. <b>"&1 &2 &3 are place holders</b>

output &1 &2 &3 result. " <b>Calling the macro output</b>

END-OF-DEFINITION.

  • <b>This is another macro (output) definition</b>

DEFINE output.

write: / 'The result of &1 &2 &3 is', &4. " <b>4 place holders passed to this macro</b>

END-OF-DEFINITION.

<b>*Clling the macro operation 3 times with three different *operation( addition, power, subtraction )</b>operation 4 + 3.

operation 2 ** 7.

operation n2 - n1.

Regards,

Read only

0 Likes
702

HI

Read only

Former Member
0 Likes
702

Hi srinivas..

that is a macro for which u r passing values

<b>for the first call Operation 4 + 3.</b>

Operation MAcro..

&1 = 4

&2 = +

&3 = 3.

output Macro..

&4 is result....

<b>for the second call Operation 2 ** 3.</b>

&1 = 2

&2 = **

&3 = 3.

output Macro..

&4 is result..

Read only

Former Member
0 Likes
702

Hi,

u hav declared 3 variables n1 n2 result. and there are 2 macros defined in the code operation and output.

operation 4 + 3.

the above statement inserts the values in the place holders and after calculating then it places the values in macros result.

regards,

kiran kumar k

Read only

0 Likes
703

hi,

you have created two Macros operation and output.

and then when you execute the below code their respective macros will get executed

operation 4 + 3.

operation 2 ** 7.

operation n2 - n1.

for example : operation 4 + 3. will execute operator macro in which it Contains the output macro and the result will be displayed.

regards,.

santosh.