2014 Jan 07 12:57 AM
Hello Friends,
Happy New Year 2014 to everyone..
Today i was executing one of the custom program which is used FM DATE_CONVERT_TO_FACTORYDATE to determine the factory calender date based on the date given in the exporting parameter.
Unfortunately for date value was blank for few cases and FM is raising exception DATE_INVALID. But the system is not returning any system message ID, message type and Message number which in term the message statement
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
is raising ABAP dump.
Short text
Message type " " is unknown.
Error analysis
Only message types A, E, I, W, S, and X are allowed.
Please let me know if anyone case across this kind of issue.
Regards,
Saravanan Madhappan
2014 Jan 07 7:27 AM
HI ,Saravana,
According to my view the date field i.e which is passed to the function module in some cases it is empty
if u r passing this empty value to the function module it will automatically go to dump
so now before going to pass the date to the function module u just check it is em[ty or not
if lv_date is not initial.
call the function module DATE_CONVERT_TO_FACTORYDATE
endif .
this is already explained by Shrikant padwale .
Regards ,
pramodh.
2014 Jan 07 4:34 AM
Hi,
Dump is coming because in the statement
"MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.'
system variables are null. ie for ex- sy-msgty is empty. So while you execute the statement you will get dump. Try to change the above statement and give your own message statements. The exception is coming may be because the exporting parameter
date,
factory_calendar_id is not correct.
date must be in this format '20140107'
and to obtain the factory_calendar_id goto transaction SCAL and select your calender id from there.
Regards,
Alenlee MJ
2014 Jan 10 9:00 PM
Thanks Alenlee for your reply..
I'm using RM as factory calender ID which is configured in the system.
On the date format, we have few scenario where we used to get 0 as date. This date 0 is working till last year (2013). But this is failing from 01./01/2014.
The funny part is if we upload last year file with 0 it's working and new file with 0 value for date field is not working..
Thanks again for your reply and let me know if you came across any of this things.
Regards,
Saravanan Madhappan
2014 Jan 07 4:57 AM
hi friend ,
your Problem is as below id i'm not wrong
"Unfortunately for date value was blank for few cases and FM is raising exception DATE_INVALID"
i will suggest you just keep " IF " condition before function module like below
IF DATE NE ' '.
ELSE
message E001 with correct date field .
ENDIF.
Thank You,
Shrikant padwale
2014 Jan 10 9:18 PM
Yes Shrikant, Your correct.. i may need to put the condition to check the values before calling the FM.
But the same FM is working with value 0 for some other scenario and raising the Exception date_invalid.
Thanks for your reply.. i will put the condition to check the date value.
Regards,
Saravanan Madhappan
2014 Jan 07 5:02 AM
Hi Saravanan,
The exception is being raised because blank dates is invalid input to FM and you are getting short dump on using message statement because the FM is not returning any message. So your message type sy-msgty is empty and leading to dump.
Regards,
Sheetal.
2014 Jan 07 5:09 AM
Hi Sarvan,
This is the general problem of handling exception messages in the custom program!
Don't handle the system messages in your custom program, Many times it will not recognize the system message id's. so the dump can happens!
Does,t matter of your input is right or wrong, should be handled the exceptions explicitly not the standard message calls
Comment this code!
SAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
Handle the exceptions explicitly!
rg, kiran
2014 Jan 07 6:11 AM
Hi saravana,
Try to comment the message id lines.
Try to validate the FM with correct values. check wheather the data types of value passed is same with the Fm structure type.
Regards,
sivaganesh
2014 Jan 07 7:27 AM
HI ,Saravana,
According to my view the date field i.e which is passed to the function module in some cases it is empty
if u r passing this empty value to the function module it will automatically go to dump
so now before going to pass the date to the function module u just check it is em[ty or not
if lv_date is not initial.
call the function module DATE_CONVERT_TO_FACTORYDATE
endif .
this is already explained by Shrikant padwale .
Regards ,
pramodh.
2014 Jan 07 8:10 AM
Hi -
Please check below code- (Only the exception Part) and implement for exception handling.
TYEPS : BEGIN OF ty_error,
message(100) TYPE c,
END OF ty_error.
DAta : wa_error TYPE ty_error
i_error TYPE STANDARD TABLE OF ty_error
CALL FUNCTION 'DATE_CONVERT_TO_FACTORYDATE'
EXPORTING
CORRECT_OPTION = '+'
date =
factory_calendar_id =
IMPORTING
DATE =
FACTORYDATE =
WORKINGDAY_INDICATOR =
EXCEPTIONS
CALENDAR_BUFFER_NOT_LOADABLE = 1
CORRECT_OPTION_INVALID = 2
DATE_AFTER_RANGE = 3
DATE_BEFORE_RANGE = 4
DATE_INVALID = 5
FACTORY_CALENDAR_NOT_FOUND = 6
OTHERS = 7
.
IF sy-subrc <> 0.
Implement suitable error handling here
CASE sy-subrc.
WHEN 1.
wa_error-message = CALENDAR BUFFER NOT LOADABLE
APPEND wa_error TO i_error.
CLEAR: wa_error.
WHEN 2.
wa_error-message = CORRECT OPTION INVALID
APPEND wa_error TO i_error.
CLEAR: wa_error.
* Continue for the other errors
WHEN 5.
wa_error-message = DATE INVALID
APPEND wa_error TO i_error.
CLEAR: wa_error.
WHEN OTHERS.
wa_error-message =
'Unknown errors. Please contact System Administrator. ' APPEND wa_error TO i_error.
CLEAR: wa_error.
ENDCASE.
ENDIF.
Let us know in case any further info.