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: 

select option using 2 different fields

Former Member
0 Kudos

hi guyz,

i want to use select option for payroll period & start date is T549Q-BEGDA and end date is T549Q-ENDDA.

Can i use selection screen in this case???????

If yes.....

how?

thanx in advance

regards

ankit

7 REPLIES 7

former_member221770
Contributor
0 Kudos

Ankit,

Yes you can use a Select Option, but you will also need to be a bit creative.

Try something like this:


parameters:     p_permo like t549q-permo obligatory,
                p_pabrj like t549q-pabrj obligarory.
select-options: s_pabrp for t549q-pabrp.

ranges: r_datum for sy-datum.

data: begin of tbl_pabrp occurs 0,
        pabrp  like t549q-pabrp,
        begda  like t549q-begda,
        endda  like t549q-endda,
      end of tbl_pabrp.

select pabrp begda endda
       into table tbl_pabrp
       from t549q
       where permo eq p_permo and
             pabrj eq p_pabrj and
             pabrp in s_pabrp.

check sy-subrc eq 0.
* Now TBL_PABRP will have the range of Start and End Dates
* We want to put these Start / End Dates into the Range 
* R_DATUM

loop at tbl_pabrp.
  clear r_datum.
  r_datum-sign   = 'I'.
  r_datum-option = 'BT'.
  r_datum-low    = tbl_pabrp-begda.
  r_datum-high   = tbl_pabrp-endda.
  append r_datum.
endloop.

* Now R_DATUM will be a range that contains the Start and 
* End Dates of a range of Payroll Periods
* You can now use R_DATUM in the WHERE clause of your 
* SELECT statements

Hope this helps.

Cheers,

Pat.

PS. Kindly assign Reward Points to the posts you find helpful.

0 Kudos

hi pat,

thanx for the reply but the user wants to enter the dates in the mm/dd/yyyy format in the input fields which he cant do if we do it this way

user wants to see the screen similar to what we can provide him with select-options

can we do that?????????

regards

ankit

0 Kudos

Ankit,

Oh I see....sorry about the misunderstanding....

Do they require to have a range of Start Dates and a Range of End Dates?

Pat.

0 Kudos

no sir

they just want to enter start date & end date.

we can do it using 2 parameters but just wanted to know if select-options can be used...............

regards

ankit

0 Kudos

Ankit,

Well in that case I would recommend simply using the 2 parameters. You can theoretically use a select option, but it will require the user to ALWAYS enter in a Low and High date.

eg.


select-options s_datum for sy-datum.

read table s_datum index 1.

select *
       from t549q
       where begda = s_datum-low  and
             endda = s_datum-high.

However, if the user does not enter in both low and high values, or enter in multiple values you will start having problems.

I think you are much better off using te 2 parameters:


parameters: p_low  like sy-datum,
            p_high like sy-datum.

select *
       from t549q
       where begda = p_low   and
             endda = p_high.

Hope this answers your questions.

Cheers,

Pat.

0 Kudos

Select option you will still have to use the high and low values as you will compare with two different database fields . You can use Select option with NO-EXTENSION so that user can enter only two vales ( from & To ). But you just cannot use this select option directly in where clasue <FIELD> IN <SOPTION>.

Why not use SELECTION-SCREEN BEGIN OF LINE / END OF LINE to put two parameters on same line which will look like a select option.

Cheers.

0 Kudos

yea

i am also planning to do the same

anyway thanx man

regards

ankit