Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to capture invalid data types

Former Member
0 Likes
983

Hi,

I have a custom RFC function module and it has currency, quantity data types fields with other fields. If I pass a invalid value to these data types, (from SE37) a core dump occurs. The core dump occurs in such a way that, it happens even before it starts executing the first statement of my RFC.

My question, is there a way to check if the value supplied for the data type is valid or not , if not exit gracefully with error message to the RETURN table or raise execption.

Any thoughts? Please let me know. Thanks,

Regards,

Sundar.

Hi,

I have a custom RFC function module and it has currency, quantity data types fields with other fields. If I pass a invalid value to these data types, (from SE37) a core dump occurs. The core dump occurs in such a way that, it happens even before it starts executing the first statement of my RFC.

My question, is there a way to check if the value supplied for the data type is valid or not , if not exit gracefully with error message to the RETURN table or raise execption.

Any thoughts? Please let me know. Thanks,

Regards,

Sundar.

2 REPLIES 2
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
791

Well one way would be generically type the import fields as type string of something like that. Then when in side the function module, you can move them to the appropriate fields, maybe within a TRY CATCH and you can then handle the exceptions.

Regards,

RIch Heilman

Read only

0 Likes
791

Rich,

Your solution is ok for many class errors, but i found an exception to this, the error CX_SY_CONVERSION_NO_NUMBER.

<u>In this escenario:</u>

data a type i.

CATCH SYSTEM-EXCEPTIONS: CONVT_NO_NUMBER = 5.

IF a = 'adsdsd'.

a = 'adsdsd'.

ENDIF.

ENDCATCH.

Here, you have a dump uncatchable. I dont found any solution for this, except check before the data type.

I will like a function with input string and domain, which validates this data. May be another inputs like check_for_initial_values or range limits.

I thinks is very useful.

Regards