Hi Jordi,
You can create a subclass of CL_HTTP_SERVER and create a new public method to return the security session cookie:
CLASS lcl_my_http_server DEFINITION INHERITING FROM cl_http_server. PUBLIC SECTION. METHODS get_cookie RETURNING value(cookie) TYPE string. ENDCLASS. CLASS lcl_my_http_server IMPLEMENTATION. METHOD get_cookie . cookie = me->m_security_session_cookie. ENDMETHOD. ENDCLASS. DATA lo_http_server TYPE REF TO if_http_server. DATA lo_my_http_server TYPE REF TO lcl_my_http_server. CALL FUNCTION 'HTTP_GET_CURRENT_SERVER_CB' IMPORTING server_cb = lo_http_server EXCEPTIONS no_icf_session = 1 OTHERS = 2. * cast from cl_http_server to your subclass lo_my_http_server ?= lo_http_server. DATA cookie TYPE string. cookie = lo_my_http_server->get_cookie( ). WRITE cookie.
Regards,
Custodio