Hi,
Presently I am working in travel module and developing a RFC function module , the code is below mention ,the out put of this is that it will give the list of visa capacity for the present month & next 2 months ahead.
Based on the date which Is passed as parameter, if the parameter is initial,
Then the date will be sy-datum.
Till January to October I am getting desirable output.
But the real problem start with month of Nov and Dec.
Nov plus 2 months will be Jan 2006.
Dec plus 2 months will be Feb 2006.
Here in this two cases the year is getting changed.
Please provide me sutibale logic or code for the months of Nov & Dec.
******************
DATA:DATE1 LIKE SY-DATUM,
LINES LIKE SY-TABIX.
DATA: MON LIKE ZHTWPVERT_FCAST-CMONTH,
YER LIKE ZHTWPVERT_FCAST-CYEAR,
FMON LIKE ZHTWPVERT_FCAST-CMONTH,
FYER LIKE ZHTWPVERT_FCAST-CYEAR.
IF P_DATE IS INITIAL.
P_DATE = SY-DATUM.
ENDIF.
SELECT CYEAR
CMONTH
WP_CAP FROM ZHTWPVERT_FCAST INTO CORRESPONDING
FIELDS OF TABLE IT_WPFCAST WHERE SVERT EQ SVERT
AND CNTRY EQ CNTRY
AND TVISA EQ TVISA.
CALL FUNCTION 'MONTH_PLUS_DETERMINE'
EXPORTING
MONTHS = '2'
OLDDATE = P_DATE
IMPORTING
NEWDATE = DATE1.
MON = P_DATE+4(2).
YER = P_DATE+0(4).
FMON = DATE1+4(2).
FYER = DATE1+0(4).
LOOP AT IT_WPFCAST.
IF IT_WPFCAST-CYEAR EQ YER AND IT_WPFCAST-CYEAR EQ FYER.
IF IT_WPFCAST-CMONTH LT MON OR IT_WPFCAST-CMONTH GT FMON.
DELETE IT_WPFCAST.
ENDIF.
ELSE.
DELETE IT_WPFCAST.
ENDIF.
ENDLOOP.
DESCRIBE TABLE IT_WPFCAST LINES LINES.
IF LINES GT 0.
RETMSG = 'SUCCESS'.
ELSE.
RETMSG = 'FAILURE'.
ENDIF.
ENDFUNCTION.
*****************
Thanks in Advance for any of your help.
Irfan Hussain