05-27-2008 5:05 AM
Hi all,
My 2nd select query is not working.
Plz tell where i m wrong.
if itab_lfa1[] is not initial.
if p_bukrs is initial.
select lifnr bukrs
from lfb1
into corresponding fields of table i_lfb1
for all entries in itab_lfa1
where lifnr = itab_lfa1-lifnr.
else.
select lifnr bukrs
from lfb1
into corresponding fields of table i_lfb1
for all entries in itab_lfa1
where lifnr = i_lfa1-lifnr
and bukrs eq p_bukrs.
endif.
endif.
Showing the error msg in 2nd select this:
The WHERE condition does not refer to the FOR ALL ENTRIES table.
But when we remove for all entries in itab_lfa1,
then it show no error, but doesn,t able to pick all records.
Best Regards,
Aastha.
05-27-2008 5:07 AM
hi try this,
select lifnr bukrs
from lfb1
into corresponding fields of table i_lfb1
for all entries in itab_lfa1
where lifnr = i_lfa1-lifnr
and bukrs in p_bukrs.
regards
siva
05-27-2008 5:07 AM
hi try this,
select lifnr bukrs
from lfb1
into corresponding fields of table i_lfb1
for all entries in itab_lfa1
where lifnr = i_lfa1-lifnr
and bukrs in p_bukrs.
regards
siva
05-27-2008 5:19 AM
Hello Siva,
Now it is showing an error
The IN operator with "P_BUKRS" is followed neither by an internal table nor by a value list.
Best Regards,
Aastha
05-27-2008 5:21 AM
hi,
do this way ...
if not itab_lfa1[] is initial.
select lifnr bukrs
from lfb1
into corresponding fields of table i_lfb1
for all entries in itab_lfa1
where lifnr = itab_lfa1-lifnr
and bukrs = p_bukrs. " Assuming p_bukrs is declared as parameter
endif.
05-27-2008 5:23 AM
Hi,
The error is because you have decalred p_bukrs as parameter. Convert this to range tables and then use in your select query.
05-27-2008 5:35 AM
Hello Santosh,
It's not working.
Plz tell me, some other way
best Regards,
Aastha
05-27-2008 5:40 AM
hi,
Check out in this way ..
call function 'CONVERSION_EXIT_ALPHA_INPUT'
exporting
input = p_bukrs
importing
output = p_bukrs.
loop at itab_lfa1.
call function 'CONVERSION_EXIT_ALPHA_INPUT'
exporting
input = itab_lfa1-lifnr
importing
output = itab_lfa1-lifnr.
modify itab_lfa1 index sy-tabix.
endloop.
if not itab_lfa1[] is initial.
select lifnr bukrs
from lfb1
into corresponding fields of table i_lfb1
for all entries in itab_lfa1
where lifnr = itab_lfa1-lifnr
and bukrs = p_bukrs. " Assuming p_bukrs is declared as parameter
endif.
05-27-2008 5:12 AM
Hi,
If P_bukrs is a parameter, the convert this to select-options and use IN operator in your select statement.
Shruthi
05-27-2008 5:38 AM
Hi,
i think you should write your second query like this....
**********************
select lifnr bukrs
from lfb1
into corresponding fields of table i_lfb1
for all entries in itab_lfa1
where lifnr = itab_lfa1-lifnr
and bukrs eq p_bukrs.
To use the for all entries you have to use it in where condition as well...
You are using i_lfa1-lifnr in where clause by giving for all entries on itab_lfa1 table, so it wont work like that...
You have to use atleast one filed of itab_lfa1 table in the where clause...
check the code in bold characters.
Reward if helpful.
Regards,
Syed