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

Select statement error

Former Member
0 Likes
1,065

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,037

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

11 REPLIES 11
Read only

amit_khare
Active Contributor
0 Likes
1,037

I think this is the field of the table only -

t_tstc-pgmna to it_agr_tcodes-pgmna.

Read only

Former Member
0 Likes
1,037

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.

Read only

Former Member
0 Likes
1,037

Hello,

I think you did not declare the internal tables, thats why the complier cant find it.

Bye

Gabriel P

Read only

0 Likes
1,037

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

Read only

0 Likes
1,037

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

Read only

Former Member
0 Likes
1,037

Well, the problem seems to be this undescore: it_agr_pgmna -> it_agr-pgmna.

Regards.

Read only

Former Member
0 Likes
1,038

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

Read only

0 Likes
1,037

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

Read only

0 Likes
1,037

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

Read only

0 Likes
1,037

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

Read only

Former Member
0 Likes
1,037

Hi Rob,

Can you please tell me how can we do that... I mean how can we use the code tag.

Thanks,

Rajeev