‎2008 Apr 29 8:35 PM
Hi Guys,
I have to create a report where I have to use SELECT-OPTIONS for vendor number. If user does not enter the vendor number (vendor-low and vendor-high are blanks) then I have to select records for all vendors. If user enters a range or individual vendor numbers and I have to select only the entered vendor numbers. How I can do this?
Thanks,
‎2008 Apr 29 8:39 PM
select-option: venno for lfa1-lifnr.
select fieldA field B fieldC into ITAB from table LFA1 where
lifnr IN venno.Use this with your variables and parameters. It would do your requirement.
Hope it helps
thanks
‎2008 Apr 29 8:40 PM
just use select-options : s_lifnr for lfa1-lifnr.
and in your selection query, use
where
lifnr in S_lifnr.
the system will automatically take care of the rest. ..that means, the system will pick only those vendors, if something is specified in s_lifnr, else, it will pick for all vendors..
SAP is intelligent, right ??
‎2008 Apr 29 8:46 PM
Hi,
Select options works in this way.
When you have a select options with no data and use this in a select statement, all possibilities in this select options are selected.
ex:select options so_bukrs is initial
and you have this select:
so_bukrs for t001-bukrs.
select * from t001
into table t_t001
where bukrs in so_burks.
t_t001 will have all records of table t001
Is this not happening?
Is this Select-options related to vendor? Or in your select statement are you using IN?
ex: so_lifnr for lfa1-lifnr.
select * from t001
into table t_t001
where bukrs IN so_burks.
Fernando
‎2008 Apr 29 8:48 PM
hi check this..
tables:lfm1 .
data: begin of itab occurs 0,
lifnr like lfm1-lifnr,
EKORG like lfm1-EKORG,
end of itab.
select-options:s_EKORG for lfm1-EKORG .
select lifnr
ekorg
from lfm1
into table itab
where ekorg in s_ekorg.
loop at itab.
write:/ itab-lifnr,
itab-ekorg.
endloop.
hi here if you give the select options blank..then it will fecth all the data ...and if you give the values in the s_ekorg-low and in the high it will bring the data in between..
regards,
venkat
‎2008 Apr 29 9:31 PM
Hi,
IF vendor IS NOT INITIAL.
LOOP AT tvendor.
IF vendor-sign EQ 'I'.
Make range over here.
ENDIF.
ENDLOOP.
ENDIF.
and use this range int ur select query
select * from table into internaltable where vendor in range_vendor.
Let me know if you have any question.
Regards
Kinjal