‎2007 Sep 25 3:39 PM
Hi Friends,
pls. see below code.
CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'
EXPORTING
I_DATE = SY-DATUM
I_PERIV = 'A'
IMPORTING
E_BUPER = MMM
E_GJAHR = YEAR.
IF SY-SUBRC NE 0.
MESSAGE E000 WITH 'Cannot convert date to fiscal period'.
ENDIF.
HERE MMM IS PERIOD AND YEAR IS YEAR AND PERIV IS FISICAL YEAR VARIANT.
MY QUESTION IS :
WHEN CAN I GET THE ABOVE MESSAGE.SY-SUBRC <> 0.
PLS. CAN ANY ONE EXPLAIN.
REGARDS,
‎2007 Sep 25 3:42 PM
HI,
If the Fiscal year is maintained in the system then you can not get the SY-SUBRC <> 0, if the Fiscal year is not maintained then you get the SY-SUBRC <> 0
Regards
Sudheer
‎2007 Sep 25 3:42 PM
I assume you will get the message if you don't have a fiscal period setup for the date.
‎2007 Sep 25 3:43 PM
You cannot. You must include the EXCEPTIONS clause to your calling sentence.
CALL FUNCTION 'xxxx'
EXPORTING
valuelist
IMPORTING
valuelist
CHANGING
valuelist
TABLES
tablelist
EXCEPTIONS
here_are_the_sy-subrc_returnings.Check the comments at the header of your FM:
*" IMPORTING
*" VALUE(I_DATE) LIKE SY-DATUM
*" VALUE(I_MONMIT) LIKE GJVAR-MONMIT DEFAULT 00
*" VALUE(I_PERIV) LIKE T009B-PERIV
*" EXPORTING
*" VALUE(E_BUPER) LIKE T009B-POPER
*" VALUE(E_GJAHR) LIKE T009B-BDATJ
*" EXCEPTIONS
*" INPUT_FALSE
*" T009_NOTFOUND
*" T009B_NOTFOUNDIf you use the proper pattern in your editor, you will get an EXCEPTIONS clause like
EXCEPTIONS
INPUT_FALSE = 1
T009_NOTFOUND = 2
T009B_NOTFOUND = 3
OTHERS = 4.If you have this clause, you will get a proper sy-subrc returning, and not a crash (dump).
Message was edited (to expand answer) by:
Vicenç Lozano
‎2007 Sep 25 3:45 PM
Hi,
Whenever the FM fails then sy-subrc <> 0. There may be the cases where the fiscal year variant you have used to not found. And declaration if you declare MMM as monat and passing to BUPER then also it will go to dump, because MMM should be of type T009B-POPER.
Thanks,
Sriram Ponna.
‎2007 Sep 25 4:16 PM
Hi Sriram,
in f.module if i changed the Fisical year A TO B.
( the Fisical Year B is not found in the system. )
finally it is giving 'FISICAL YEAR VARIANT B IS NOT EXPECTED ' MESSAGE IS
DISPLAYING.
But it is not giving below message :
MESSAGE E000 WITH 'Cannot convert date to fiscal period'.
what is the reason??
reagards,
‎2007 Sep 25 4:20 PM
Please, update your coding adding the EXCEPTIONS clause to your function call. I bet you will get the appropiate exception number under sy-subrc, and then you will be able to output a proper message using an IF or a CASE sentence.
‎2007 Sep 25 4:34 PM
Hi,
I think whenever the importing parameters fails, may be at that time you will get.
Anyhow i will try to figure it out.
Thanks,
Sriram Ponna.
‎2007 Sep 25 3:50 PM
Hi Venu,
There are two condition when this error message can be triggered.
1) If the fiscal year variant (factory calendar) is not maintained
2) If the fiscal year is not maintained for a particular year
Simply if you doesnt find a value for fiscal year variant or fiscal year in the table T009B or T009.
Thanks,
Vinay