07-23-2015 12:48 PM
Hi,
I'm working on a migration tool where I'm reading data from a file and converting these variables in a correct format.
Is there a function module who can check a variable and an other variable from a DDIC data type and can just check if the conversion is possible?
For exemple:
Case1
-----------
Var1 = 'ABCDEFGH'
Var2 TYPE C(4)
=> This should give an error that it's not possible
Case2
-----------
Var1 = 'ABCDEFGH'
Var2 TYPE String
=> OK
Case3
-----------
Var1 = 'ABCDEFGH'
Var2 TYPE I
=> This should give an error that it's not possible
Kind regards
07-23-2015 1:00 PM
You can put below piece of code in your logic.
TRY.
var1 = var2.
CATCH cx_sy_conversion_error.
"Conversion not possible
ENDTRY.
07-23-2015 1:00 PM
You can put below piece of code in your logic.
TRY.
var1 = var2.
CATCH cx_sy_conversion_error.
"Conversion not possible
ENDTRY.