‎2008 May 15 3:17 PM
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.
‎2008 May 15 3:20 PM
As a quick guess,
ERNAM likely should be in UPPER case or you need to use a LIKE option.
where ERNAM LIKE 'ADEEL%'.
‎2008 May 15 3:33 PM
‎2008 May 15 4:00 PM
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
‎2008 May 15 4:01 PM
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
‎2008 May 15 4:42 PM
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