Alpha conversion in HANA SQL

To do a alpha conversion directly in AMDP script the following expression can be used:

SELECT ..., CASE WHEN ( LENGTH(LTRIM(hanaview."CHARACTERISTIC",' 0123456789')) = 0 and LTRIM(hanaview."CHARACTERISTIC",' ') <> '' )
THEN LPAD( hanaview."CHARACTERISTIC",5,'0' ) ELSE hanaview."CHARACTERISTIC" END as "/BIC/CHARACTERISTIC", ... FROM ...

This statement checks if the string is not empty and only numeric. If so, it fills up to in this example a length of 5 characters with 0.

This entry was posted in SAP BW/4 HANA and tagged , , . Bookmark the permalink.

1 Response to Alpha conversion in HANA SQL

Leave a comment