First of all there two queries are actually inline views rather than sub queries...
Now coming to your issue looks like the only reason you are trying to have two inline views and then joining is to have the grouping at different grain level. I will suggest using windows functions to get the same results as it will eliminate the requirement of splitting to two inline views and joining them back together. And the main reason your performance is not so good is the join clause and after you eliminate that you should get a much better performance..
Now this query will become something like below
SELECT deo_cod,
MAX(cla_ncod) AS CLASIF,
COUNT(DISTINCT ENT_NCOD) AS NumeroEntidades
FROM "_SYS_BIC"."sbs/AN_DETALLE"
WHERE per_ncod = '20130131'
GROUP BY deo_cod
SELECT deo_cod,
MAX(cla_ncod) over (partition by deo_cod ) as CLASIF,
Please check the below link for Windows function reference..
http://help.sap.com/hana/html/_esql_functions_window.html
http://help.sap.com/saphelp_hanaplatform/helpdata/en/20/a353327519101495dfd0a87060a0d3/content.htm