‎2008 Jun 19 7:52 AM
hi all,
in the selection screen i have fields like BUKRS, COST CENTER, PROFIT CENTER, PERIOD, AND YEAR.
The problem is if i give period as 5 i.e., may and year as 2008
i need fetch the records from 1 st may to 31st may only.
can any one please help me how to write code for this.
thanks in advace
‎2008 Jun 19 7:58 AM
Hi,
you the code below :
ranges : gr_date for bsis-budat.
CALL FUNCTION 'FIRST_DAY_IN_PERIOD_GET'
EXPORTING
i_gjahr = sp_gjahr
* i_monmit = gp_monat
i_periv = 'K4'
i_poper = sp_monat "Period
IMPORTING
e_date = gv_firstday
EXCEPTIONS
input_false = 1
t009_notfound = 2
t009b_notfound = 3
OTHERS = 4
.
CALL FUNCTION 'LAST_DAY_IN_PERIOD_GET'
EXPORTING
i_gjahr = sp_gjahr
* I_MONMIT = gp_monat
i_periv = 'K4'
i_poper = sp_monat "Period
IMPORTING
e_date = gv_lastday
EXCEPTIONS
input_false = 1
t009_notfound = 2
t009b_notfound = 3
OTHERS = 4
.
gr_date-sign = 'I'.
gr_date-option = 'BT'.
gr_date-low = gv_firstday.
gr_date-high = gv_lastday.
append gr_date.
"And use gr_date in the date field of select statement while
"retrieving the data.
"And declare period as T009B-POPER
Thanks,
Sriram Ponna.
Edited by: Sriram Ponna on Jun 19, 2008 12:29 PM
‎2008 Jun 19 8:05 AM
Hi,
When u getch ur data from the table, check if the date lies between that specif 05012008 and 05312008. If it does, fetch the data.
Thanks
Nayan
‎2008 Jun 19 8:06 AM
‎2008 Jun 19 8:21 AM
Hi,
Do like this.
First u will obtain the last day of month usin the function module
CONSTANTS : l_c_i(1) TYPE c VALUE 'I',
l_c_bt(2) TYPE c VALUE 'BT'.
data : l_period-H like sy-datum.
CALL FUNCTION 'LAST_DAY_OF_MONTHS'
EXPORTING
day_in = p_period
IMPORTING
last_day_of_month = l_period-H
concatenate l_period-H+0(6) '01' into l_period-L.
now fill the dates entered in the selection screen as range.
l_r_erdat-sign = l_c_i.
l_r_erdat-option = l_c_bt.
l_r_erdat-low = l_period-L.
l_r_erdat-high =l_period-H.
APPEND l_r_erdat.
CLEAR l_r_erdat.
now u use this l_r_erdat as
select -
-
-
from -
into table -
where period in l_r_erdat.
‎2008 Jun 19 8:23 AM
hi,
data: v_days type days.
CALL FUNCTION 'RTP_US_API_MAX_DAYS_IN_MONTH'
EXPORTING
i_date_month = p_monat
i_date_year = p_gjahr
IMPORTING
E_MAX_DAYS = v_days.
i have done like this it is going to dump.
it is saying p_monat is different field type.