‎2008 Jun 19 5:30 PM
Hello,
I am getting following error when I run ABAP code.
Tables: ZROLE_OWNER, ZROLEMAP, AGR_1251, AGR_USERS.
DATA: BEGIN OF I_ROLE occurs 0,
ROLE LIKE ZROLE_OWNER-ROLE,
END OF I_ROLE.
DATA: BEGIN OF I_RATT occurs 0,
ROLENAME LIKE AGR_1251-AGR_NAME,
OBJECT LIKE AGR_1251-OBJECT,
FIELD LIKE AGR_1251-FIELD,
LOW LIKE AGR_1251-LOW,
HIGH LIKE AGR_1251-HIGH,
END OF I_RATT.
DATA: WA_RATT LIKE I_RATT occurs 0.
SELECT ROLE from ZROLE_OWNER into table I_ROLE
where SFLAG = ''.
LOOP AT I_ROLE.
*This will append all the values for above condition in WA-RATT.
SELECT AGR_NAME OBJECT FIELD LOW HIGH FROM AGR_1251
INTO TABLE WA_RATT
WHERE AGR_NAME = I_ROLE-ROLE.
APPEND WA_RATT TO I_RATT.
ENDLOOP.
I am getting error that WA_RATT cannot be converted to line type I_RATT.
‎2008 Jun 19 5:48 PM
why not select for all entries in I_role into table I_Ratt ?
wa_ratt - work area or table?
You can append a workarea to a table or lines of a table to a table
‎2008 Jun 19 5:38 PM
Hi,
You have declared it wrong:
DATA: WA_RATT LIKE I_RATT occurs 0.
define it as : DATA: WA_RATT LIKE line of I_RATT.
Regards,
Subramanian
‎2008 Jun 19 5:39 PM
Hi,
try this:
append lines of wa_ratt to to i_ratt. --> if u want to append set of lines that was resultant of the select statment.
if u want only one line...then use "select single "
But why select in the loop??u can instead use FOR ALL ENTRIES!
regards,
madhu
‎2008 Jun 19 5:40 PM
hi,
Tables: ZROLE_OWNER, ZROLEMAP, AGR_1251, AGR_USERS.
DATA: BEGIN OF I_ROLE occurs 0,
ROLE LIKE ZROLE_OWNER-ROLE,
END OF I_ROLE.
DATA: BEGIN OF I_RATT occurs 0,
ROLENAME LIKE AGR_1251-AGR_NAME,
OBJECT LIKE AGR_1251-OBJECT,
FIELD LIKE AGR_1251-FIELD,
LOW LIKE AGR_1251-LOW,
HIGH LIKE AGR_1251-HIGH,
END OF I_RATT.
DATA: WA_RATT LIKE line of I_RATT .
SELECT ROLE from ZROLE_OWNER into table I_ROLE
where SFLAG = ''.
LOOP AT I_ROLE.
*This will append all the values for above condition in WA-RATT.
SELECT AGR_NAME OBJECT FIELD LOW HIGH FROM AGR_1251
INTO WA_RATT
up to 1 rows
WHERE AGR_NAME = I_ROLE-ROLE.
endselect.
APPEND WA_RATT TO I_RATT.
ENDLOOP.
Thanks,
Rajinikanth.
‎2008 Jun 19 5:44 PM
You could have a better performance if your used ranges instead of looping at i_role. Also a join or a for all entries can work
‎2008 Jun 19 5:48 PM
why not select for all entries in I_role into table I_Ratt ?
wa_ratt - work area or table?
You can append a workarea to a table or lines of a table to a table