2007 Nov 22 7:13 AM
Hi All,
Pls provide me the logic for the below requirement.
The requirement is that in the selection screen if i give the input as 6months in paramenter option field,the employee data for the last six months sud be fetched in the report.And if i give 2 months ..the last 2months employee data sud be fetched by the report.
Pls help me how to proceed further.
Thanks,
Chakradhar.
Hi All,
Pls provide me the logic for the below requirement.
The requirement is that in the selection screen if i give the input as 6months in paramenter option field,the employee data for the last six months sud be fetched in the report.And if i give 2 months ..the last 2months employee data sud be fetched by the report.
Pls help me how to proceed further.
Thanks,
Chakradhar.
2007 Nov 22 7:17 AM
Hi,
calculate last 2 months date or six months date using SY-DATUM.
and in where condition of select query give greater than that calculate and
less than of todays date
Regards,
Prashant
2007 Nov 22 7:17 AM
do the following steps.
parameters p_date type sy-datum.
at selection-screen on value request p_date.
select into coresspondig field of table itab where date =p_date.
pass internal table that funcation module.
Call F4 popup
CALL FUNCTION 'F4IF_START_VALUE_REQUEST'
EXPORTING
shlp = l_shlp
disponly = display_only
IMPORTING
rc = l_subrc
TABLES
return_values = l_return_tab
EXCEPTIONS
OTHERS = 0.
IF sy-subrc = 0 AND l_subrc = 0.
Value selected
READ TABLE l_return_tab INDEX 1 INTO l_return_wa.
item_selected = l_return_wa-fieldval.
ELSE.
Popup canceled / no value selected
RAISE popup_canceled
2007 Nov 22 7:18 AM
Hi,
Directly specify it in the where condition of the select query.
select empdata from table into itab where date = p_date.
Reward if helpful..
Regards,
Nagaraj
2007 Nov 22 7:19 AM
hi
Hi,
Use the below function module
RP_CALC_DATE_IN_INTERVAL
you can give '-'(minus) for previous date or '+'(plus) for future date
for the SIGNUM field
example
DATA V_DATE TYPE SY-DATUM.
CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL'
EXPORTING
DATE = SY-DATUM
DAYS = 0
MONTHS = '06'
SIGNUM = '-'
YEARS = 0
IMPORTING
CALC_DATE = V_DATE.
write:/ v_date
try with the above code.
reward points if that is useful.
regards
karthik
2007 Nov 22 7:25 AM
Hi you can do like this,
parameters: months(3) type n.
data: from_date type sy-datum.
CALL FUNCTION 'CCM_GO_BACK_MONTHS'
EXPORTING
currdate = sy-datum
backmonths = months
IMPORTING
NEWDATE = from_date.
write:/ from_date, sy-datum,
/ months.
now select query with these two dates.
2007 Nov 22 7:28 AM
Use logic like this..
data:
begin of t_pernr occurs 0,
pernr type pa0001-pernr,
end of t_pernr.
parameters:
p_period type i.
data:
w_date type pa0001-begda,
w_temp type i.
start-of-selection.
if p_period lt 1
or p_period gt 12.
message 'Period must be between 1 and 12' type 'I'.
exit.
endif.
w_date = sy-datum.
w_date+6(2) = '01'.
if w_date+4(2) gt p_period.
w_date4(2) = w_date4(2) - p_period.
else.
w_temp = w_date+4(2) - p_period.
w_temp = 12 + w_temp.
w_date0(4) = w_date0(4) - 1.
w_date+4(2) = w_temp.
endif.
select pernr
from pa0001
into table t_pernr
where begda ge w_date.
if sy-subrc eq 0.
endif.
| User | Count |
|---|---|
| 6 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |