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

you may only read from table..Error

Former Member
0 Likes
1,593

HI Experts ,

I've the following issue.

I've created a FM in which it_char is import parameter

data : it_char type ztest

where ztest is table type .

now the issue is that when I run code inspector I get an error has bellow when I do this,

SORT it_char by atnam.

READ TABLE it_char INTO lv_chara WITH KEY atnam = lwa_allocvaluesnum-charact .

ERROR is

you may only read from table "it_char".

now how can I remove this error ???

Regards,

Suhas

1 ACCEPTED SOLUTION
Read only

matt
Active Contributor
0 Likes
1,308

it_char is an import parameter. So you can't change it's value. If you sort a table, you're changing it. If you want to change it, make it a changing parameter.

it_char is an import parameter. So you can't change it's value. If you sort a table, you're changing it. If you want to change it, make it a changing parameter.

9 REPLIES 9
Read only

matt
Active Contributor
0 Likes
1,309

it_char is an import parameter. So you can't change it's value. If you sort a table, you're changing it. If you want to change it, make it a changing parameter.

Read only

Former Member
0 Likes
1,308

Hi Suhas,

I think its coming because you have put it in importing parameters which is used for variables or structures only. Try putting the table it_Char in changing parameters or better in Tables parameters.

It should work.

BR.

Read only

matt
Active Contributor
0 Likes
1,308

No it isn't. You can quite happily pass tables in the importing, exporting or changing parameters. In fact, if you try to use TABLES, you'll get a warning about them being obsolete.

The problem is with the SORT. I just created a test, and it's syntax error in 7.01.

Read only

0 Likes
1,308

Hi Matthew,

Thanks for letting me know.

BR,

Ankit.

Read only

former_member219762
Contributor
0 Likes
1,308

Hi,

   Define table type ztest in fm and assign Import value to that and do any operation on that.

Regards,

Sreenivas.

Read only

venkateswaran_k
Active Contributor
0 Likes
1,308

Hi

I remember, when we use READ table WITH KEY option, then the it_table should be defined with Key..

So, I would suggest

1. Pass the internal table as table parameter,

2. Inside the function,  crete another it_table with key option

3. assign the pased table parameter it table to this above defined it_table.

4. then use the REad statement on the newly defined it_table

Regards,

Venkat

Read only

0 Likes
1,308

It is the SORT causing the problem - not the READ.

Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,308

I agree with 

Read only

Former Member
0 Likes
1,308

Hi,

Please pass the required parameter as "Changing" parameter tab.Hope it will solve your problem.Thanks!

Regards,

Ravi Shankar L