SAP Tutorials Blog


 


"Lossless assignements using the EXACT operator
"Due to the invalid dates, an exception is raised.
TRY.
    DATA(inv_date1) = EXACT d( '20240231' ).
  CATCH cx_sy_conversion_no_date.
ENDTRY.

TRY.
    DATA(inv_date2) = EXACT d( '2024XY31' ).
  CATCH cx_sy_conversion_no_date.
ENDTRY.

"Assignment of an invalid date of type d to type i; the initial value is produced
"Note: In newer ABAP releases, the following statement shows a syntax 
"warning that the value of the literal (intentionally specified 
"here like this) does not match type d. 
DATA(inv_date3) = CONV i( CONV d( '20240231' ) ).
ASSERT inv_date3 = 0.

Serkan AKKAVAK Computer Engineer BSc Head of SAP & Software Department Contact : serkurumsal@yandex.com