Skip to Content
avatar image
Former Member

Error in ABAP Program

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.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

6 Answers

  • Best Answer
    Aug 21, 2007 at 11:28 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • Aug 21, 2007 at 11:27 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 21, 2007 at 11:28 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 21, 2007 at 11:28 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 21, 2007 at 11:29 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 21, 2007 at 11:33 AM

    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>

    Add comment
    10|10000 characters needed characters exceeded