‎2008 May 23 10:24 AM
Hi all,
Suppose there are two parameters in selection screen
1.(for ex) Name1(Vendor Name)
2.(for ex)Company code
Name1 i have to made obligatory, but if we enter company code,
it wil fetch record considering both otherwise only consider name1.
With example.
BesT Regards,
Aastha
‎2008 May 23 10:28 AM
Hi,
Declare the parameter name1
parameters: name1(30) obligatory,
companycode(4).
Write two select queries with an if...else condition.
if compaycode is not initial.
select query 1.
else.
select query 2.
endif.
Regards,
Aravinda Sarma M.
‎2008 May 23 10:29 AM
Hi Gupta,
If u set mandatory for a field u must enter value.Otherwise it will not accept.
Regards,
Narasimha
‎2008 May 23 10:35 AM
Hi Narasimha,
I m not asking that,i want if we enter in non obligatory field,
then it will fetch considering both company code and name1,otherwise fetch alone on the basis of name1.
Give me syntax.
Aastha
‎2008 May 23 10:42 AM
hi,
it depends on your sql , ya it will retireve data if u mention it s condition.
priya
‎2008 May 23 10:43 AM
Hi Aastha,
Declare second parameter as
SELECT-OPTIONS: s_name for abc-name NO INTERVALS NO-EXTENSION.
And in the select query
select *
from xyz
where ppp = p_ppp
and name in s_name.
‎2008 May 23 10:30 AM
hi,
parameters : p_name like <data object> obligatory,
p_comcode like <dataobject>.
start-of-selection.
if p_comcode is initial.
select ........ where name = p_name.
elseif.
select ...... where name = p_name and comopanycode = p_comcode.
endif.
reward if helpful
prasanth
‎2008 May 23 10:30 AM
parameters: name1,
company.
convert company to range table r_company.
select * from ...
where name1 = name1
and company in r_company.
‎2008 May 23 10:37 AM
Hi,
Try this it will work.
data: name1(10),
code(4).
paarmeters: p_name for name,
p_code for code. "for eg
at selection-screen.
if p_code is initial and p_name is initial.
"****display error message****.
elseif p_code is not initial and p_name is initial.
*****proceed******
elseif. p_code is initial and p_name is NOT initial.
*****proceed******
endif.
Please reward points if u find it helpful
‎2008 May 23 10:39 AM
hi code for this is:
parameters: name1(40) tpe c obligatory.
parameters : code type bukrs.
if code is not intial.
select name1 from ____ into itab where name1 = ___-name1 and code = _____-bukrs.
else.
select name1 from ____ into itab where name1 = ___-name1.
endif.
please reward if helpful
‎2008 May 23 10:48 AM
Hi,
Now u check that condition.
IF s_comcode is initial.
select ........ where name = s_name1.
( Select based on NAME1 )
elseif.
select ...... where name1 = s_name1 and
comopanycode = s_comcode.
( Select based on both)
endif.