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

Subroutine

Former Member
0 Likes
716

Hi ,

I am writing a small program for subroutine.

This is the program.

FORM ADDNUM.

DATA:

NUM1 TYPE I VALUE 10,

NUM2 TYPE I VALUE 20.

RESULT TYPE I.

RESULT = NUM1+NUM2.

WRITE:/RESULT.

END FORM.

error is Statement "RESULT" is not defined. Check your spelling . . . . . . . .

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
694

DATA:

NUM1 TYPE I VALUE 10,

NUM2 TYPE I VALUE 20. "-------> don't give fullstop give comma ok,

RESULT TYPE I.

RESULT = NUM1+NUM2.

WRITE:/RESULT.

END FORM.

rewards points if help ful ,

thank you

6 REPLIES 6
Read only

Former Member
0 Likes
695

DATA:

NUM1 TYPE I VALUE 10,

NUM2 TYPE I VALUE 20. "-------> don't give fullstop give comma ok,

RESULT TYPE I.

RESULT = NUM1+NUM2.

WRITE:/RESULT.

END FORM.

rewards points if help ful ,

thank you

Read only

Former Member
0 Likes
694

give comma ',' after NUM2 TYPE I VALUE 20 instead of full stop '.'

Read only

S0025444845
Active Participant
0 Likes
694

Hi,

give comma after NUM2 TYPE I VALUE 20 instead of fullstop.

like this.

FORM ADDNUM.

DATA:

NUM1 TYPE I VALUE 10,

NUM2 TYPE I VALUE 20,

RESULT TYPE I.

RESULT = NUM1+NUM2.

WRITE:/RESULT.

END FORM.

regards,

sudha

Read only

Former Member
0 Likes
694

Hi do like this.

PERFORM ADDNUM.

FORM ADDNUM.

DATA: NUM1 TYPE I VALUE 10,

NUM2 TYPE I VALUE 20,

RESULT TYPE I.

RESULT = NUM1 + NUM2.

WRITE: / RESULT.

ENDFORM.

Read only

Former Member
0 Likes
694

hi,

while declaring more than one data objects using DATA statements you must separate data objects with ',' separator. or you declara data objects individually using DATA statements.

<b>follow this synatx</b>

FORM ADDNUM.

DATA:

NUM1 TYPE I VALUE 10,

NUM2 TYPE I VALUE 20,

RESULT TYPE I.

RESULT = NUM1+NUM2.

WRITE:/RESULT.

END FORM.

<b>or</b>

FORM ADDNUM.

DATA:

NUM1 TYPE I VALUE 10,

NUM2 TYPE I VALUE 20.

<b>DATA:RESULT TYPE I.</b>

RESULT = NUM1+NUM2.

WRITE:/RESULT.

END FORM.

regards,

Ashok Reddy

Read only

Former Member
0 Likes
694

FORM ADDNUM.

DATA:

NUM1 TYPE I VALUE 10,

NUM2 TYPE I VALUE 20.----


><b>Here is the error</b>

RESULT TYPE I.

RESULT = NUM1+NUM2.

WRITE:/RESULT.

END FORM.

Put ","(comma) insted of "."(fullstop)

Reason Behind the error--


first of all u declare DATA:-means u create a block to declare data,and ":" this colon operator is known as chain operator it means u can declare more than one data in that block by specifing or separting each other by"," comma operator . But U close the block at NUM2 TYPE I VALUE 20.so control does not getting RESULT.

So put comma instead of fullstop and execute as the procedure.