‎2007 Mar 09 3:29 AM
hi,
i run FM 'CONVERT_DATE_TO_EXTERNAL' to test the exceptions but no matter what i pass in, even an invalid date i still not able to go in exceptions.
i actually would like to see what is these 1 and 2. thx
1) what is 1 and 2? are they sy-subrc? what if sy-subrc is 4?
2) what is this 'OTHERS' under the exceptions in the call function below?
3) why i simply enter an invalid date like '10022031' in yyyymmdd format, sy-subrc still 0?
in abap :
CALL FUNCTION 'CONVERT_DATE_TO_EXTERNAL'
EXPORTING
date_internal = p_date
IMPORTING
date_external = p_outdate
EXCEPTIONS
date_internal_is_invalid = 1
OTHERS = 2.
in FM :
CASE SY-SUBRC.
WHEN 0.
DATE_EXTERNAL = H_DATE_EXTERNAL.
WHEN OTHERS.
MESSAGE E650 RAISING DATE_INTERNAL_IS_INVALID.
Bitte gültiges internes Datum angeben (JJJJMMTT)
ENDCASE.
‎2007 Mar 09 3:35 AM
whenever you use the FM, the exception numbers are actuallty the sy-subrc value.
You require to check the sy-subrc and display message accordingly.
Others is the default exception attach with all FM.
Since there are some uncounted errors may occur like OS failure to name.
Soeverytime u use a FM handle these sy-subrc or exceptions accordingly.
If sy-subrc is 0 means success.
Regards,
Amit
‎2007 Mar 09 3:54 AM
After calling the FM , tr this..
IF SY-SUBRC <> 0.
CALL FUNCTION 'TB_MESSAGE_BUILD_TEXT'
EXPORTING
LANGU = SY-LANGU
MSGID = SY_MSGID
MSGNO = SY_MSGNO
MSGV1 = SY_MSGV1
MSGV2 = SY_MSGV2
MSGV3 = SY_MSGV3
MSGV4 = SY_MSGV4
IMPORTING
TEXT = P_L_ERR_MSG. " declare this variable of length 100
write : P_L_ERR_MSG..
ENDIF.
‎2007 Mar 09 4:10 AM
Hi ,,
Have you checked this .
http://help.sap.com/saphelp_erp2005vp/helpdata/en/d1/801f50454211d189710000e8322d00/frameset.htm
Thanks .
‎2007 Mar 09 11:52 AM
hi,
1) in the FM, only 1 and 2, what if it returns other than 1 and 2? why OTHERS is 2? which means only can cater for 1 and 2 sy-subrc? what if other number then how to take care? or by this way, can restrict system to return only 1 and 2? i know when alright will return 0.
2) why need to call 'tb_message_build_text'?
3) i just do not understand why 'CONVERT_DATE_TO_EXTERNAL' also can return 0 for sy-subrc even i input letter.
please advise again.
thanks