08-06-2009 10:20 AM
there are 2 fields in the table
Beginging and End date
for every employee there r two or more rows.
In my selection screen i m selecting month and year.i want to fetch only that row for a employee which comes in date range.
for example
selection screen
month 05
year 2009
beg end
04/2008 09/2008
10/2008 09/2009
so it shud select the second row.
thanks.
Edited by: aks on Aug 6, 2009 5:25 AM
08-06-2009 10:41 AM
Hi,
Well one way of doing it is concatenate the month and year and pass it to the select statement.
data: dat(6) type c.
concatenate year month into date.
select *
from Dbtable
into itab
where begda <= date and
endda >= date.
Regards,
Vik
08-06-2009 10:29 AM
Hi,
you can put logic in the following way...
SELECT SINGLE exmpt FROM t5u13
INTO t5u13-exmpt
WHERE stell = p0001-stell AND
begda <= p_prcdte AND
endda >= p_prcdte.
Thanks
Ashu
08-06-2009 10:33 AM
Hi
Use offsets.
READ TABLE itab WITH TABLE KEY beg4(4) <= year end4(4) >= year.
If sy-subrc eq 0.
display record.
endif.
Hope this resolves your query.
Viquar Iqbal
08-13-2009 12:14 PM
READ TABLE itab WITH TABLE KEY beg4(4) <= year end4(4) >= year.
reln. operator <= not working pls help...
08-13-2009 12:25 PM
Hi,
The relational operator <= wont work for read statement. This is the easy way to do it
data: date(6) type c.
concatenate p_year p_month into date.
select *
from Dbtable
into itab
where begda <= date and
endda >= date.
The relational operator can be used with IF condition. Not read statements.
Regards,
Vik
08-06-2009 10:38 AM
08-06-2009 10:41 AM
Hi,
Well one way of doing it is concatenate the month and year and pass it to the select statement.
data: dat(6) type c.
concatenate year month into date.
select *
from Dbtable
into itab
where begda <= date and
endda >= date.
Regards,
Vik
08-06-2009 10:45 AM
Hi Friend ,
**************************if it is a date***********************
1. Using that month and year get the first date and last date of the month .
2. Create range field for date .
3. Populate the begi date in low value and ending date in high value.
4. In you select query
select <fields>
from <table>
into <itab>
where beg <= rang_date-low and
end >= rang_date-high.
********************************if it is a period ********************************************************
1. Concatenate the month and year .
2. select query
select <fields>
from <table>
into <itab>
where beg <= Period and
end >= period .
thanks,
08-13-2009 12:25 PM
08-13-2009 12:30 PM
Then use the if condition instead of read
loop at itab.
if itab-beg+4(4) <= year itab-end+4(4) >= year.
display record.
endif.
endloop.
Regards,
Vik