Search code examples
backendabapsap-gateway

How to get session id from data provider class in SAP Gateway?


I am trying to find out how could I get information about external session id? I see it on a very top of the abap stack: enter image description here

However, did not find any way to access this variable in the Data Provider Class. Do you have any tipp?


Solution

  • The session_id is actually a static attribute specified in the IF_HTTP_SERVER interface. Because of the way in which ABAP sessions work, it is not possible to have two HTTP requests processed simultaneously in the same ABAP session, so I guess it makes sense to have the session_id as static.

    Anyway, you can do something like this in your DPC_EXT class to obtain the session:

    DATA(lv_session) = cl_http_server=>if_http_server~session_id.
    

    Result of above code