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.
I had the same question and came to the same solution as Serban provided. However, I hoped that sending multiple requests from the same browser window would have the same session id -- what is my understanding of session ids BTW. Which does not seem to be the case: subsequent odata calls from the same browser window to the same service (actually the exactly same service calls) showed always different sessionids in the debugger. So I think the sessionid on abap side is not really useful.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.