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

Read table doubt....

Former Member
0 Likes
720

Hello,

I have a internal table which stores following values.

T-Code----OBJECT


FIELD----VALUE

AC01--


M_SRV_LS
ACTVT
-----01

AC01--


M_SRV_LV
ACTVT
-----02

Now I have fetched all the data from AGR_1251 table into internal table T_ROLES which stores auhorization data for roles.

I want to read these internal table T_ROLES and check sy-subrc, such that

Object = S_TCODE,

Object = M_SRV_LS and M_SRV_LV, Field = ACTVT and VALUE = 01 and 02.

Now every time the internal table will have different Objects, Field and values but the T-Code will be same for all those values.

Regards,

Rajesh.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
693

hi do like this..

select

AGR_NAME

OBJECT

AUTH

FIELD

LOW

HIGH

from AGR_1251

into table it_roles

where object in s_object .

loop at it_roles where OBJECT in ( S_TCODE , M_SRV_LV )

and field = ACTVT

and low = 1

and high = 2 .

write:/ ............

endloop .

6 REPLIES 6
Read only

Former Member
0 Likes
694

hi do like this..

select

AGR_NAME

OBJECT

AUTH

FIELD

LOW

HIGH

from AGR_1251

into table it_roles

where object in s_object .

loop at it_roles where OBJECT in ( S_TCODE , M_SRV_LV )

and field = ACTVT

and low = 1

and high = 2 .

write:/ ............

endloop .

Read only

0 Likes
693

Actually I want to read the internal table

READ table IT_ROLES with KEY ROLENAME = XXX OBJECT = (I need all the objects which are there in another internal table) Field = (All the field which are there in another internal table) Value (All the values which are there in another internal table)

Read only

0 Likes
693

try like this.

READ table IT_ROLES with KEY ROLENAME = XXX .

if sy-subrc = 0.

READ table IT_ROLES with KEY OBJECT = (I need all the objects which are there in another internal table).

.....................

hope this will help u.

Read only

0 Likes
693

hi read is used to get the single line of data but here we may get many no of records ..so it is better to use the loop than read statement

Read only

0 Likes
693

I have defined IT_MINI as internal table

DATA: BEGIN OF I_KEYROLE occurs 0,

KEYROLE LIKE ZROLEMAP-KEYROLE,

TCODE LIKE ZROLEMAP-TCODE,

OBJECT LIKE ZROLEMAP-OBJECT,

FIELD LIKE ZROLEMAP-FIELD,

VALUE LIKE ZROLEMAP-VALUE,

END OF I_KEYROLE.

DATA: IT_MINI LIKE I_KEYROLE OCCURS 0 with header line.

Now IT_MINI is populated with data.

When I try to read data as following, system says there is no component like IT_MINI[1]. Even if I try to read data

READ table I_RATT with KEY ROLENAME = I_ROLE-ROLE OBJECT = 'S_TCODE'

LOW = IT_MINI[1]-TCODE.

Read only

0 Likes
693

Hi,

READ table I_RATT with KEY ROLENAME = I_ROLE-ROLE 
                                           OBJECT = 'S_TCODE' 
                                           LOW = IT_MINI-TCODE.

this is the way u use it. it will give the matching record for the goven condition,.

IT_MINI is the internal table in which u want to pass the field TCODE to Low to read the value from I_RATT.

regards,

madhu