‎2009 Feb 11 9:30 PM
Hi all,
I am working on a report... where I need to generate a reprt that will show all the tcodes along with the program name (if any) and also the roles assigned to it and to get this I have written the following code... but I am getting an error...which says :
field it_agr_pgmna is unknown when I am moving my recods to the internal table
SELECT * FROM tstc
INTO TABLE t_tstc
WHERE tcode IN S_tcode.
SELECT * FROM agr_tcodes
INTO TABLE t_agr_tcodes
WHERE tcode IN S_tcode.
LOOP AT t_agr_tcodes INTO s_agr_tcodes.
READ TABLE t_tstc
TRANSPORTING NO FIELDS
WITH KEY tcode = s_agr_tcodes-tcode.
IF sy-subrc eq 0.
MOVE: s_agr_tcodes-tcode TO it_agr_tcodes-tcode,
s_agr_tcodes-agr_name to it_agr_tcodes-agr_name,
t_tstc-pgmna to it_agr_pgmna.
Append it_agr_tcodes.
endif.
endloop.can you please tell me what I am doing wrong
Thanks,
Rajeev
Rajeev - please use code tags!
Edited by: Rob Burbank on Feb 11, 2009 5:02 PM
‎2009 Feb 11 10:00 PM
Hi Rajeev,
I exactly do not know how you have defined your internal table , but from what i see,
when you are appending the last field value into the internal table
it should be
t_tstc-pgmna to it_agr_tcodes-pgmna.
rather than
t_tstc-pgmna to it_agr_pgmna
Just compare and correct the code. It is not able to find a field "it_agr_pgmna".
it should rather be "it_agr_tcodes-pgmna"
Check your definition and correct accordingly.
Thanks,
Akshay
‎2009 Feb 11 9:38 PM
I think this is the field of the table only -
t_tstc-pgmna to it_agr_tcodes-pgmna.
‎2009 Feb 11 9:40 PM
Hi,
You can use move statement only to move values into fields.
In case of internal table with same structures use
it_agr_pgmna = t_tstc-pgmna.
in case of different structures use MOVE-CORRESPONDING
BR.
‎2009 Feb 11 9:41 PM
Hello,
I think you did not declare the internal tables, thats why the complier cant find it.
Bye
Gabriel P
‎2009 Feb 11 9:53 PM
Thanks you all for your quick responses ...the error is resolved... sorry those were some really stupid typo mistakes.... well now when I debbugged my code.. I found that the program name is not pulling up in when I am trying to move t_tstc-pgmna to it_agr_tcodes-pgmna...although the program name is there in tstc but somehow it's n ot pulling up when I am doing the move statement...
Plasea advise
‎2009 Feb 11 9:59 PM
Also... when I ran my program for a particular tcode... it showed me only one "Role" assigned to it but when I checked this tcode in the table agr_tcodes it showed me 2 roles assigned to it... can you please tell me why it's not pulling the other record.
Thanks,
Rajeev.....Gupta
‎2009 Feb 11 9:42 PM
Well, the problem seems to be this undescore: it_agr_pgmna -> it_agr-pgmna.
Regards.
‎2009 Feb 11 10:00 PM
Hi Rajeev,
I exactly do not know how you have defined your internal table , but from what i see,
when you are appending the last field value into the internal table
it should be
t_tstc-pgmna to it_agr_tcodes-pgmna.
rather than
t_tstc-pgmna to it_agr_pgmna
Just compare and correct the code. It is not able to find a field "it_agr_pgmna".
it should rather be "it_agr_tcodes-pgmna"
Check your definition and correct accordingly.
Thanks,
Akshay
‎2009 Feb 11 10:02 PM
Thanks for the reply Akshay.... have taken care of that!!! can you please have a look t the other two issued that I mentioned above..... thanks a lot
Rajeev
‎2009 Feb 11 10:12 PM
Hi rajeev,
try this.
t_agr_tcodes_temp = t_agr_tcodes.
delete adjecent entries comparing tcodes.
then,
loop at t_agr_tcodes_temp,
loop at t_agr_tcodes.
.....
......
Read entries into your final table.
end loop.
endloop.
Thanks,
Akshay
‎2009 Feb 11 10:17 PM
After you create your post, select all of your code (highlight it), then press the "Click to display as code" button just above the entry screen. That's the button witht the "<" and ">".
Rob
‎2009 Feb 11 10:07 PM
Hi Rob,
Can you please tell me how can we do that... I mean how can we use the code tag.
Thanks,
Rajeev