Have you thought about feasibility of your requirment p. ABAP AS is receiving connection from Citrix. Citrix works in this case simirarly to reverse proxy. How can ABAP AS know way of connecting user to terminal server? That is one of the drawbacks of terminal servers. I do not think that you can address your requirment in ABAP AS.
Cheers