简体   繁体   中英

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: 在此处输入图片说明

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

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM