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

Doubt in Select Query and Select-options

Former Member
0 Likes
1,906

Hi,

I want to extract some fields from FAGLFLEXA table, Inputs are company code, fiscal year, account no., and posting date.Now my requirement is when i give the date (for ex:- 06/04/2008), it has to select the fields from 01/01/2008 to 06/04/2008.

I have given the date field as PARAMETER it was not selecting the fields less than that date. So now i have given the date field as SELECT-OPTIONS with NO INTERVALS, NO-EXTENSION. Now it was selecting all the fields from 01/01/2008 to 06/04/2008.

But in debugging when i see this date, it was in S_BUDAT-LOW. can i change it into S_BUDAT-HIGH.

Now i want to know whether i am correct or there is any other alternative for this.

Regards,

Ramana

6 REPLIES 6
Read only

Former Member
0 Likes
939

u can have like...

SELECT-OPTIONS: s_date type sydatum.

now in selection screen, u will be having 01.01.2008 to 01.07.2008...and u want to fetch the data between this...

then u can use in select quesry as

SELECT * from table into itab

where date IN S_DATE.

Read only

Former Member
0 Likes
939

what i understand from your requirement is that user will enter the end date, and u should generate the start data as 01/01/entered_year.

so do this

parameters enddate type sy-datum.

data start_date type d.

start-of-selection

concatenate enddate(4) '0101' into start_date.

now make a select and use the start_date and enddate in the query.

pls reward points if helpful

Read only

Former Member
0 Likes
939

>

> Hi,

>

> I want to extract some fields from FAGLFLEXA table, Inputs are company code, fiscal year, account no., and posting date.Now my requirement is when i give the date (for ex:- 06/04/2008), it has to select the fields from 01/01/2008 to 06/04/2008.

>

> I have given the date field as PARAMETER it was not selecting the fields less than that date. So now i have given the date field as SELECT-OPTIONS with NO INTERVALS, NO-EXTENSION. Now it was selecting all the fields from 01/01/2008 to 06/04/2008.

>

> But in debugging when i see this date, it was in S_BUDAT-LOW. can i change it into S_BUDAT-HIGH.

>

> Now i want to know whether i am correct or there is any other alternative for this.

>

>

> Regards,

> Ramana

You can explore the possibility mentioned below


REPORT test.

SELECT-OPTIONS:
  s_date FOR sy-datum NO INTERVALS NO-EXTENSION.

RANGES:
 r_date FOR sy-datum.

START-OF-SELECTION.
  r_date-sign = 'I'.
  r_date-option = 'BT'.
  r_date-low = sy-datum.
  r_date-low+4(4) = '0101'.
  r_date-high = s_date-low.
  APPEND r_date.

SELECT .......
   FROM FAGLFLEXA
  INTO..
WHERE date IN r_date.

Read only

Former Member
0 Likes
939

hi ram

i have done the same previouly and solved as bellow.

select-options : s_budat for .......

ranges r_budat for faglflext-budat

data : year(4) type c, month(2) type c,date(2) type c,

*if date ne 01 converting date to '01' and put it in ranges

*to calculate opening balance

read table s_budat .

if s_budat-low+6(2) <> '01'

year = s_budat-low.

month = s_budat-low+4(2).

date = s_budat-low+6(2).

concatenate year month '01' into r_budat-low

r_budat-high = s_budat-low or s_budat-high (based on your requirement)

r_budat-sign = 'I'.

r_budat-option = 'BT'.

append r_budat

endif.

now select data from flaglflext based on r_budat

Edited by: tummala swapna on Jul 9, 2008 4:56 PM

Read only

Former Member
0 Likes
939

I didnt got

"But in debugging when i see this date, it was in S_BUDAT-LOW. can i change it into S_BUDAT-HIGH."

Why u want to change it.

S_BUDAT is an internal table with higer range walue S_BUDAT-HIGH and lower range value S_BUDAT-LOW = 01/01/2008.

Even u can assign value whatever u want

S_BUDAT-HIGH = S_BUDAT-LOW

but really dont know y u need to do so

Thanks & Regards

vinsee

Read only

Former Member
0 Likes
939

hi,

I think we can not do that because by using 'no interval ' and 'no extension' u r converting 'select-options' to a parameter has default one value that is 'low'.

explicitly u can do like this >> s_budat-high = s_budat-low

you can write ur query like this

select * from < ur table> into < target field or table>

where date between ' 01-06-2008' and <select-option-high or low>