‎2008 Sep 01 2:00 PM
How to get the start and end date of asset value in the selection screen based on the posting period.The other i/p field i have is fiscal year and company code.
‎2008 Sep 01 2:04 PM
‎2008 Sep 01 2:06 PM
Hi Hema,
Try this code :
*"Table declarations...................................................
tables :
p0001. " HR Master Record
*"Selection screen elements............................................
selection-screen begin of block blck with frame title text-006.
select-options :
s_pernr for p0001-pernr no-extension.
" Personnel Number
parameters :
p_forprd like sy-datum. " For Period
select-options :
s_inprd for sy-datum no-extension. " In Period
selection-screen end of block blck.
data :
w_date like sy-datum. " Date
at selection-screen output.
perform process_before_output.
form process_before_output .
loop at screen.
if screen-name cs 'S_INPRD'.
screen-input = 0.
clear s_inprd[].
modify screen.
endif. " IF SCREEN-NAME CS 'S_INPRD'
endloop. " LOOP AT SCREEN
if p_forprd is not initial.
call function '/BEV4/PLPS__ADD_MONTH_TO_DATE'
exporting
months = '3'
olddate = p_forprd
importing
newdate = w_date.
loop at screen.
if screen-name eq 'S_INPRD-LOW'.
s_inprd-low = w_date.
elseif screen-name eq 'S_INPRD-HIGH'.
call function 'LAST_DAY_OF_MONTHS'
exporting
day_in = w_date
importing
last_day_of_month = w_date
exceptions
day_in_no_date = 1
others = 2.
if sy-subrc ne 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif. " IF SY-SUBRC NE 0
s_inprd-high = w_date.
append s_inprd.
endif. " IF SCREEN-NAME EQ 'S_INPRD-LOW'
modify screen.
endloop. " LOOP AT SCREEN
endif. " IF P_FORPRD IS NOT INITIAL
endform. " FORM PROCESS_BEFORE_OUTPUTThe above code explains ....
Enter a pernr(say 16) and for period(01.03.2008) and on pressing 'ENTER' the In period is filled with 3 months from the For period(It will be 01.06.2008 to 30.06.2008). I think this will suffice your requirement.
Regards,
Swapna.
‎2008 Sep 01 2:16 PM
try to use Fm:
ASSET_VALUATION_DATE_GET
ASSET_VALUATION_DATE_GET_30
AMSP_ASSET_VALUE_DATE_CHECK