08-21-2007 12:25 PM
hi ,
I am a basis person and very new to ABAP.
Pls let me know the error in the folllowing program
REPORT Z_ROLES.
data : count type i.
data : begin of it_role occurs 0,
agr_name type AGR_NAME,
end of it_role.
data : begin of obj_table occurs 0,
objct type XUOBJECT,
end of obj_table.
select OBJCT from TOBJ into table obj_table
where OCLSS IN ('RS','RSR', 'RSBC').
clear count.
loop at obj_table.
add 1 to count.
endloop.
select AGR_NAME from AGR_1250
into table it_role
for all entries in obj_table
where OBJECT = obj_table.objct
AND
AGR_NAME LIKE 'Z%'.
clear count.
loop at it_role.
add 1 to count.
endloop.
write : count.
08-21-2007 12:28 PM
Hi,
data : count type i.
data : begin of it_role occurs 0,
agr_name type AGR_NAME,
end of it_role.
data : begin of obj_table occurs 0,
objct type XUOBJECT,
end of obj_table.
select OBJCT from TOBJ into table obj_table
where OCLSS IN ('RS','RSR', 'RSBC').
clear count.
loop at obj_table.
add 1 to count.
endloop.
select AGR_NAME from AGR_1250
into table it_role
for all entries in obj_table
where OBJECT = obj_table-objct AND " Check here you have used '.' you should use '-'
AGR_NAME LIKE 'Z%'.
clear count.
loop at it_role.
add 1 to count.
endloop.
write : count.
Regards,
Sesh
08-21-2007 12:27 PM
REPORT Z_ROLES.
DATA : count TYPE i.
DATA : BEGIN OF it_role OCCURS 0,
agr_name TYPE agr_name,
END OF it_role.
DATA : BEGIN OF obj_table OCCURS 0,
objct TYPE xuobject,
END OF obj_table.
SELECT objct FROM tobj INTO TABLE obj_table
WHERE oclss IN ('RS','RSR', 'RSBC').
CLEAR count.
LOOP AT obj_table.
ADD 1 TO count.
ENDLOOP.
SELECT agr_name FROM agr_1250
INTO TABLE it_role
FOR ALL ENTRIES IN obj_table
WHERE object = <b>obj_table-objct</b>
and
agr_name like 'Z%'.
CLEAR count.
LOOP AT it_role.
ADD 1 TO count.
ENDLOOP.
WRITE : count.
********
to refer to a field, we use tablename-fieldname
Message was edited by:
Kris Donald
08-21-2007 12:28 PM
Hi,
I've boldened the mistakes, plz make the changes accordingly,
REPORT Z_ROLES.
data : count type i.
data : begin of it_role occurs 0,
agr_name type AGR_NAME,
end of it_role.
data : begin of obj_table occurs 0,
objct type XUOBJECT,
end of obj_table.
select OBJCT from TOBJ into table obj_table
where OCLSS IN ('RS','RSR', 'RSBC').
clear count.
loop at obj_table.
add 1 to count.
endloop.
select AGR_NAME from AGR_1250
into table it_role
for all entries in obj_table
where OBJECT = <b>obj_table-objct</b>
AND
AGR_NAME LIKE 'Z%'.
clear count.
loop at it_role.
add 1 to count.
endloop.
write : count.
<b>Reward points if this helps,</b>
Kiran
08-21-2007 12:28 PM
Hi,
data : count type i.
data : begin of it_role occurs 0,
agr_name type AGR_NAME,
end of it_role.
data : begin of obj_table occurs 0,
objct type XUOBJECT,
end of obj_table.
select OBJCT from TOBJ into table obj_table
where OCLSS IN ('RS','RSR', 'RSBC').
clear count.
loop at obj_table.
add 1 to count.
endloop.
select AGR_NAME from AGR_1250
into table it_role
for all entries in obj_table
where OBJECT = obj_table-objct AND " Check here you have used '.' you should use '-'
AGR_NAME LIKE 'Z%'.
clear count.
loop at it_role.
add 1 to count.
endloop.
write : count.
Regards,
Sesh
08-21-2007 12:28 PM
Hi There,
The syntax error is cause by have a '.' to separate your table name and field name rather than a '-'
i.e. its should be like this: obj_table-objct
08-21-2007 12:29 PM
Hi
select AGR_NAME from AGR_1250
into table it_role
for all entries in obj_table
where OBJECT = obj_table-objct
AND
AGR_NAME LIKE 'Z%'.
replace "." with "-".
Regards
Ravish
08-21-2007 12:33 PM
Hi balaji
check the field name
select OBJCTfrom TOBJ into table obj_table
where OCLSS IN ('RS','RSR', 'RSBC').
clear count.
loop at obj_table.
add 1 to count.
endloop.
select AGR_NAME from AGR_1250
into table it_role
for all entries in obj_table
where OBJECT =<b> obj_table-objct</b>
AND
AGR_NAME LIKE 'Z%'.
clear count.
loop at it_role.
add 1 to count.
endloop.
write : count.
<b>
Regards,
Azhar</b>