We have created a dedicated tool for this - - - HANACV2SQL.
Multi cloud support. It will generate optimized, production ready sql.
Importantly, it is not a 1:1 CTE Conversion tool.