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

Pb read table abap

Former Member
0 Likes
1,101

Hello,

I have a problem with the use of an internal table in my abap routine (in an update rule).

I create an internal table, after i load it, and when i want to read it i have a problem.

Here is my code :

  • Table Declaration

DATA : BEGIN OF t_ze_range occurs 0,

/BIC/OIZE_RANGE type /BIC/OIZE_RANGE,

/BIC/OIZE_TECHNO type /BIC/OIZE_TECHNO,

/BIC/OIZE_BU2 type /BIC/OIZE_BU2,

/BIC/OIZE_BU1 type /BIC/OIZE_BU1,

END OF t_ze_range.

  • loading

  • i load my table t_ze_range from the table /BIC/PZE_RANGE (info object)

SELECT

/BIC/ZE_RANGE /BIC/ZE_TECHNO /BIC/ZE_BU2 /BIC/ZE_BU1

FROM

/BIC/PZE_RANGE

APPENDING TABLE

t_ze_range

WHERE

OBJVERS = 'A'

GROUP BY

/BIC/ZE_RANGE /BIC/ZE_TECHNO /BIC/ZE_BU2 /BIC/ZE_BU1.

when i execute my update rule in debug mode, i have data in my internal table t_ze_range.

And when i want to access data in my update rule:

READ TABLE t_ze_range WITH KEY /BIC/OIZE_RANGE = 1

i have this errors :

E:In the OO context either an INTO or an ASSIGNING specification or the addition "TRANSPORTING NO FIELDS" must be used. addition "TRANSPORTING NO FIELDS" must be used.

Could you help me to solve it ?

Thanks a lot.

Best regards

Karol Walesch

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,051

ok, if i understand :

if i want to read data, i want to use statement INTO

and if a use TRANSPORTING NO FIELDS i can't read data from my internal table ?

In my case, i want to read only 1 row in my internal table :

if i write :

READ TABLE t_ze_range WITH KEY /BIC/OIZE_RANGE = range TRANSPORTING NO FIELDS.

if sy-subrc = 0.

RESULT = t_ze_range-/BIC/OIZE_TECHNO.

endif.

My result is empty.

If i want to use statement INTO, i don't know what is a workarea ???

Thanks,

Karol Walesch

Hello,

I have a problem with the use of an internal table in my abap routine (in an update rule).

I create an internal table, after i load it, and when i want to read it i have a problem.

Here is my code :

  • Table Declaration

DATA : BEGIN OF t_ze_range occurs 0,

/BIC/OIZE_RANGE type /BIC/OIZE_RANGE,

/BIC/OIZE_TECHNO type /BIC/OIZE_TECHNO,

/BIC/OIZE_BU2 type /BIC/OIZE_BU2,

/BIC/OIZE_BU1 type /BIC/OIZE_BU1,

END OF t_ze_range.

  • loading

  • i load my table t_ze_range from the table /BIC/PZE_RANGE (info object)

SELECT

/BIC/ZE_RANGE /BIC/ZE_TECHNO /BIC/ZE_BU2 /BIC/ZE_BU1

FROM

/BIC/PZE_RANGE

APPENDING TABLE

t_ze_range

WHERE

OBJVERS = 'A'

GROUP BY

/BIC/ZE_RANGE /BIC/ZE_TECHNO /BIC/ZE_BU2 /BIC/ZE_BU1.

when i execute my update rule in debug mode, i have data in my internal table t_ze_range.

And when i want to access data in my update rule:

READ TABLE t_ze_range WITH KEY /BIC/OIZE_RANGE = 1

i have this errors :

E:In the OO context either an INTO or an ASSIGNING specification or the addition "TRANSPORTING NO FIELDS" must be used. addition "TRANSPORTING NO FIELDS" must be used.

Could you help me to solve it ?

Thanks a lot.

Best regards

Karol Walesch

8 REPLIES 8
Read only

Former Member
0 Likes
1,051

Hi,

If you use Transporting no fields, you can check only the existence of the record in the internal table

but if you want to use some data in the internal table(for the record found) later then you need to use INTO <workarea>

Hence based on your requirement, use the above.

READ TABLE t_ze_range WITH KEY /BIC/OIZE_RANGE = 1 [TRANSPORTING NO FIELDS]

OR

READ TABLE t_ze_range INTO [LS_ZE_REANGE] WITH KEY /BIC/OIZE_RANGE = 1

Hope this helps

Regards

Shiva

Read only

rainer_hbenthal
Active Contributor
0 Likes
1,051

You have to add an INTO or Assiging construction oder you have to use the TRANSPORTING NO FIELDS clase in your read stametent.

But thats exactly what the error message told you.

Read only

Former Member
0 Likes
1,051

Hi,

Are you reading the table data for any processing?

In the read statement add TRANSPORTING NO FIELDS.

Read only

Former Member
0 Likes
1,051

if you use read statement then it will have to read a unique record if not , u just wanna check read entries are existing then transporting no fields needs to be provided else read the internal table into some work area is mandatory.

with cheers

s.janagar

Read only

Former Member
0 Likes
1,052

ok, if i understand :

if i want to read data, i want to use statement INTO

and if a use TRANSPORTING NO FIELDS i can't read data from my internal table ?

In my case, i want to read only 1 row in my internal table :

if i write :

READ TABLE t_ze_range WITH KEY /BIC/OIZE_RANGE = range TRANSPORTING NO FIELDS.

if sy-subrc = 0.

RESULT = t_ze_range-/BIC/OIZE_TECHNO.

endif.

My result is empty.

If i want to use statement INTO, i don't know what is a workarea ???

Thanks,

Karol Walesch

Read only

0 Likes
1,051

Hi,

Can u declare the work area as

DATA : BEGIN OF wa_ze_range,

/BIC/OIZE_RANGE type /BIC/OIZE_RANGE,

/BIC/OIZE_TECHNO type /BIC/OIZE_TECHNO,

/BIC/OIZE_BU2 type /BIC/OIZE_BU2,

/BIC/OIZE_BU1 type /BIC/OIZE_BU1,

END OF wa_ze_range.

The work area can hold only one value, i.e what ever the record with key has been satisfied.

u can use above work area as like,

read table t_itab into wa_itab with key where xx = ' '.

Let me know any other info required.'

Read only

Former Member
0 Likes
1,051

hi,

how define a workarea ? and what is it ?

thanks,

Karol

Read only

Former Member
0 Likes
1,051

ok thanks very much.

Karol