Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Moving parameters in other with differenct data type

Hi,

I want to check if it's possible to convert one parameter in an other.

For example when I want to move a string to a data, the move should go in exception.

I was trying this with following code, but the code is just converting a string in a data, without going in exception.

DATA: lv_var1 type String.

DATA: lv_var2 type DATUM.

lv_var1 = 'Test'

TRY.

     MOVE lv_var1 TO lv_var2.

CATCH cx_sy_conversion_error into Exception

     RETURN Exception.

ENDTRY.

Result: lv_var2 = 'Test'

=> I want the program to check 2 parameters and return an exception, but this is not happening

Tags:
Not what you were looking for? View more on this topic or Ask a question