Application Development 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: 

Parameters Issue

Former Member
0 Kudos

I have 3 parameters in my ABAP Program:

Parameters: p_date like ZSTATS_CUML2-zdate ,

p_user like ZSTATS_CUML2-account,

p_tcode like ZSTATS_CUML2-tcode.

and I put entries in table tab_1 from ZSTATS_CUML2 table as follows:

select * from ZSTATS_CUML2 where Not tcode = ''and tcode = p_tcode and

zdate = p_date and account = p_user.

tab_1-tcode = ZSTATS_CUML2-tcode.

tab_1-logindate = ZSTATS_CUML2-zdate.

tab_1-username = ZSTATS_CUML2-account.

tab_1-responsetime = ZSTATS_CUML2-respti.

append tab_1 to tab_1.

endselect.

I want that if user gives no input in parameters, then all entries come in tab_1 or if user gives input in 2 parameters then the selection criteria should apply only in 2 parameters.what happens now ,if i give no value in any paramater , the output table contains nothing , it's empty.

Kindly help.

Suneela.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi There,

the easiest way to do this would be to replace the parameters with select options and modify the select statement appropriatley. See the following code:

TABLES: ZSTATS_CUML2.

select-options: so_date for ZSTATS_CUML2-zdate NO INTERVALS no-extension ,

so_user for ZSTATS_CUML2-account NO INTERVALS no-extension ,

so_tcode for ZSTATS_CUML2-tcode NO INTERVALS no-extension .

  • and I put entries in table tab_1 from ZSTATS_CUML2 table as follows:

select *

from ZSTATS_CUML2

where Not tcode = ' ' and

tcode in so_tcode and

zdate in so_date and

account in so_user.

tab_1-tcode = ZSTATS_CUML2-tcode.

tab_1-logindate = ZSTATS_CUML2-zdate.

tab_1-username = ZSTATS_CUML2-account.

tab_1-responsetime = ZSTATS_CUML2-respti.

append tab_1 to tab_1.

endselect.

Therefore if the select option is left blank the 'tcode in so_tcode' statement will return everything!

Reward points if found helpful....

Cheers,

Chandra Sekhar.

2 REPLIES 2

Former Member
0 Kudos

Hi,

you can use the IN-operator together with the select-options:

Here ist your coding, changed by using select-options and the in operetors:

Whitout the NO-EXTENSION and NO INTERVALS keywords, the select-options have more options then the PARAMETERS.

...

TABLES zstats_cuml2.

SELECT-OPTIONS:

s_date FOR zstats_cuml2-zdate NO-EXTENSION NO INTERVALS,

s_user FOR zstats_cuml2-account NO-EXTENSION NO INTERVALS,

s_tcode FOR zstats_cuml2-tcode NO-EXTENSION NO INTERVALS.

SELECT * FROM zstats_cuml2 WHERE NOT tcode = ''

AND tcode IN s_tcode

AND zdate IN s_date

AND account IN s_user.

tab_1-tcode = zstats_cuml2-tcode.

tab_1-logindate = zstats_cuml2-zdate.

tab_1-username = zstats_cuml2-account.

tab_1-responsetime = zstats_cuml2-respti.

APPEND tab_1 TO tab_1.

ENDSELECT.

...

Many greetings,

Stefan

Former Member
0 Kudos

Hi There,

the easiest way to do this would be to replace the parameters with select options and modify the select statement appropriatley. See the following code:

TABLES: ZSTATS_CUML2.

select-options: so_date for ZSTATS_CUML2-zdate NO INTERVALS no-extension ,

so_user for ZSTATS_CUML2-account NO INTERVALS no-extension ,

so_tcode for ZSTATS_CUML2-tcode NO INTERVALS no-extension .

  • and I put entries in table tab_1 from ZSTATS_CUML2 table as follows:

select *

from ZSTATS_CUML2

where Not tcode = ' ' and

tcode in so_tcode and

zdate in so_date and

account in so_user.

tab_1-tcode = ZSTATS_CUML2-tcode.

tab_1-logindate = ZSTATS_CUML2-zdate.

tab_1-username = ZSTATS_CUML2-account.

tab_1-responsetime = ZSTATS_CUML2-respti.

append tab_1 to tab_1.

endselect.

Therefore if the select option is left blank the 'tcode in so_tcode' statement will return everything!

Reward points if found helpful....

Cheers,

Chandra Sekhar.