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

Syntax Required

Former Member
0 Likes
970

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

10 REPLIES 10
Read only

Former Member
0 Likes
952

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.

Read only

Former Member
0 Likes
952

Hi Gupta,

If u set mandatory for a field u must enter value.Otherwise it will not accept.

Regards,

Narasimha

Read only

0 Likes
952

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

Read only

0 Likes
952

hi,

it depends on your sql , ya it will retireve data if u mention it s condition.

priya

Read only

0 Likes
952

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.

Read only

prasanth_kasturi
Active Contributor
0 Likes
952

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

Read only

Former Member
0 Likes
952

parameters: name1,

company.

convert company to range table r_company.

select * from ...

where name1 = name1

and company in r_company.

Read only

Former Member
0 Likes
952

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

Read only

Former Member
0 Likes
952

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

Read only

Former Member
0 Likes
952

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.