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

Parameters

Former Member
0 Likes
1,268

Hi,

I have 4 parameters in the selection screen.All of which are not abligatory.

Here I have to include these parameters in the select statement depending on the data in the parameters.

If the parameters have no data the I have to write the select with out the parameters in the select statement.

If I consider the <b>IF ENDIF</b> or the <b>CASE ENDCASE</b> options, I would have to write <b>16</b> conditions which would effect the program efficiency very badly.

Is there any other way in which this problem can be resolved??

Please Help.

Thanks,

Supriya Manik

9 REPLIES 9
Read only

Former Member
0 Likes
1,154

Hi,,

Use select-options...with addition no-intervals.

this will force select-option to behave as a parameter on the screen..

when the user enters any thing it acts like a parameter else like a select-option.

select-options: s_vbeln for vbak-vbeln no-intervals.

santhosh

Read only

Former Member
0 Likes
1,154

Hi,

Select options with no-interval would be the best thing for your case.

Regards,

Nidhya

Read only

Former Member
0 Likes
1,154

Actually the four parameters data which I am refering to come from the Wepage,where we capture the data and get it to the RFC.Hence they have to be treated as parameters.

Read only

0 Likes
1,154

declare ranges

and populate them when u have a value from web page and leave them blank when u have no value.

santhosh

Read only

0 Likes
1,154

while passing to RFC u can pass them as <b>s_field1-low</b> , will that not work as a parameter??

Read only

0 Likes
1,154

hi,

Even though its a parameter u internally build the select option table ..

for ex :

if the parameter u r passing is 1000 for company code.

then

u can use like this

types : begin of ty_company_code

comp_code_sign type SIGN,

comp_code_opt type option

comp_code_low type bukrs,

comp_code_high type bukrs,

end of ty_company_code.

data : it_company_code type table of ty_company_code,

wa_company_code type ty_company_code.

wa_company_code-comp_code_sign = 'I'.

wa_company_code-comp_code_option = 'EQ'.

wa_company_code-comp_code-low = '1000'.

append wa_company_code to it_company_code.

like this u can build the select option internal table for four paramaters

and use it in query like

select * from <tbname> where bukrs in it_company_code.

thanking you

JK

Read only

Former Member
0 Likes
1,154

I feel the solution given by Kaushal should hold true but in case you dont want to change it to select-option than you can use the below logic.

ranges : r_param1 for param1.

refresh r_param1.

if param1 is not blank

move param1 to r_param1-low.

move 'EQ' to r_param1-sign.

move 'I' to r_param1-option.

append r_param1.

endif.

Similary code for the other parameters (please check the values for sign and option)

your select statement

SELECT * FROM TABLE WHERE

FIELD1 in R_PARAM1 and

field2 in r_param2 etc

Regards

Anurag

Read only

Former Member
0 Likes
1,154

also use the <b>no extension</b> addition along with <b>no intervals</b>, which makes select-options look very much like parameter declaration.

Read only

Former Member
0 Likes
1,154

hi supriya,

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.

<b>SELECT-OPTIONS : SO_SELECT FOR MARA-MATNR <u>NO INTERVALS</u>.</b>

SELECTION-SCREEN END OF BLOCK b1 .

use select-options with no intervals...

now in ur select query

<b>SELECT ....

FROM <TABLE>

INTO <INTERNAL TABLE>

WHERE <FIELD> IN <SO_SELECT></b>

so u dont hv to use numerous if...endif conditions nor case...endcase....even tough the select option is empty...and obligatory....

hence , select option with no intervals acts as a parameter.

I hope ur problem is solved...

reward points if useful...

regards,

Ginni...