Application Development 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: 

Differece between parameters and data

Former Member
0 Kudos

I have the following two simple abap programs, the first one runs just fine, but the second one will generate run time error: assign to non-existent memory area error.

The only differenence is the first one uses parameters, and the second one uses data.

Could anybody explain why this happens?

Thanks in advance.

dliu

REPORT ZTX1202.

data: c.

parameters: p(10) default 'ABCDEFGHIJ'.

do 10 times varying c from p0 next p1.

write: /, 'index:', sy-index.

enddo.

*********************start of the second report********

REPORT ZTX1203.

data: c.

data: p(10) value 'ABCDEFGHIJ'. " will get assign to non-existent memory area error

do 10 times varying c from p0 next p1.

write: /, 'index:', sy-index.

enddo.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hello,

I have executed ur second report in my system and it is working fine and gave the result like this:


index:          1

index:          2

index:          3

index:          4

index:          5

index:          6

index:          7

index:          8

index:          9

index:         10

Regards,

Vasanth

9 REPLIES 9

Former Member
0 Kudos

Change to

data: p(10) type c value 'ABCDEFGHIJ'.

and check ..

I have checked ur 2 prog code as it is and its working fine.

Try the above change for the 2 prog and check

regards,

Vijay

0 Kudos

No luck, still get the same error.

0 Kudos
data: c.
data: p(10) .
 p =  'ABCDEFGHIJ'. 

do 10 times varying c from p+0 next p+1.
write: /, 'index:', sy-index.
enddo.

try this ..

no error from my side ..

former_member194669
Active Contributor
0 Kudos

Hi,

I tried to run your code for me it is not given error.

Which version you working?

aRs

0 Kudos

I am running on IDES 4.7

Former Member
0 Kudos

Hello,

I have executed ur second report in my system and it is working fine and gave the result like this:


index:          1

index:          2

index:          3

index:          4

index:          5

index:          6

index:          7

index:          8

index:          9

index:         10

Regards,

Vasanth

former_member194669
Active Contributor
0 Kudos

May be due to IDES? I am not sure.

Try to run this code in development client.

aRs

0 Kudos

Yeah, it is the problem with my IDES 4.7, I tried on another version, it works fine.

Thanks for all your reponses.

dliu

Former Member
0 Kudos

Hi David,

The basic difference between DATA and PARAMETERS is tht :

First of all both are used to declare variables. But in order to enable the user to enter values thru a selection-screen we use PARAMETERS. But if we want to do any calculations with a particular field we use DATA clause.

So, try the following example:

parameters :

p(10) type c default 'ABCDEFGHIJ'.

data:

w_c type c.

do 10 times varying w_c from p0 next p1.

write: /, 'index:', sy-index.

enddo.

Try this out and reward points to me if u find this helpful.

Regards

Swapna.