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

Internal Table problem

Former Member
0 Likes
623

Hi Folks!!!

I am having a small problem but can't find out why its happening. All I am trying to do is to get data in my internal table from table LFM1. I test the same code with MARA and it worked. Can anybody tell me why data is not coming in Internal from LFM1.

Here is my peice of code.

*******************************************************************************************************************

REPORT ZAD_POXKTEST .

data: begin of ilfm1 occurs 0.

include structure lfm1.

data: end of ilfm1.

select * from lfm1

into corresponding fields of table ilfm1

where ekorg = '3000'

and ernam = 'Adeel'.

if sy-subrc ne 0.

write:/ 'Error!!!'.

endif.

data: begin of imara occurs 0.

include structure mara.

data: end of imara.

select * from mara

into corresponding fields of table imara

where ernam = 'RUDISILL'.

if sy-subrc ne 0.

write:/ 'Error!!!'.

endif.

***********************************************************************************************************

Thanks alot in Advnce.

5 REPLIES 5
Read only

Former Member
0 Likes
605

As a quick guess,

ERNAM likely should be in UPPER case or you need to use a LIKE option.

where ERNAM LIKE 'ADEEL%'.

Read only

former_member226999
Contributor
0 Likes
605

check your case for ernam = 'Adeel'.

Try with ernam = 'ADEEL'.

Read only

Former Member
0 Likes
605

Try this:

REPORT ZAD_POXKTEST .

START-OF-SELECTION.

data: it_lfm1 type standard table of lfm1 initial size 0.

data: it_mara type standard table of mara initial size 0.

select * from lfm1 into table it_lfm1

where ekorg = '3000'

and ernam = 'ADEEL'.

if sy-subrc ne 0.

write:/ 'Error!!!'.

endif.

select * from mara into table it_mara

where ernam = 'RUDISILL'.

if sy-subrc ne 0.

write:/ 'Error!!!'.

endif.

END-OF-SELECTION.

Hope this helps.

Warren

Edited by: Warren Clements on May 15, 2008 5:08 PM

Read only

Former Member
0 Likes
605

Hi,

Did you check the data in Database.

Try to find out...whther the data related to your query is there or not?

If data is there, then try to give the name in CAPS.

Regards

Sandeep Reddy

Read only

Former Member
0 Likes
605

I have proposed another way of declaring your internal tables below. And also avoid using 'into corresponding fields of'. This requires more performance effort and is absolutely not necessary in your example.

Code: Select all

  • internal tables

data:

it_lfm1 type standard table of lfm1.

  • work areas

data:

wa_lfm1 type lfm1.

  • selection

select * from lfm1 into table it_lfm1

where .....

if sy-subrc eq 0.

loop at table it_lfm1 into wa_lfm1.

...

endloop.

else.

write: / 'Error lfm1'.

endif.

Reward if helpfull...

Cheers,

Venkoji Babu