Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

SAGUI Internal Session ID

Former Member
0 Likes
2,150

Hello,

I need to find a unique identifier for a logon from another on sapgui session level.. i tried function modules or took a glance at the C system functions i couldn't find any..

The requirement is , abap program should contact to active sapgui, find it's "session id" or "thread id" or "internal number" or a key similar to those.. and abap program will let's say, insert this gui-id to a database table as a record.. in another logon, another user will be able to check if this session id still exists and active, if not, record will be deleted...

i hope i could've explained the situation...

Many thanks

Hello,

I need to find a unique identifier for a logon from another on sapgui session level.. i tried function modules or took a glance at the C system functions i couldn't find any..

The requirement is , abap program should contact to active sapgui, find it's "session id" or "thread id" or "internal number" or a key similar to those.. and abap program will let's say, insert this gui-id to a database table as a record.. in another logon, another user will be able to check if this session id still exists and active, if not, record will be deleted...

i hope i could've explained the situation...

Many thanks

9 REPLIES 9
Read only

Former Member
0 Likes
1,636

Hi Sahin,

I'm sure you if I have you understand correct.

Have you take a look to the fucntiongroup <b>THFB</b>

there are functions like

TH_GET_SESSION_ID

Regards,

Stefan

Read only

0 Likes
1,636

Hi Stefan, thank you for the answer and It's my fault that i did not mention the version of sap server is 4.6C. sorry for that.

in that version th_get_session_id does not exist in THFB fugr .

Do you have any other idea ?

Best regards

Sahin

Read only

0 Likes
1,636

Hello Sahin,

try FM <b>TH_SYSTEMWIDE_USER_LIST</b>.

This gives you a list of currently logged on user sessions, with USERID, TERMINAL name, last dialog time,...

Maybe this is what you like to record in the database table. Here you get it "online".

If you find my answer useful, please don't forget the reward.

Regards,

Juergen

Read only

0 Likes
1,636

Hi,

Actually the following is the C call inside the fm that Stefan has given you..

call 'ThUsrInfo' id 'OPCODE' field opcode_get_session_id

id 'SESSION_ID' field session_id

id 'ID_LEN' field id_len.

And the data declaration of opcode_get_session_id is as follows,

DATA: OPCODE_GET_SESSION_ID LIKE TH_OPCODE VALUE 68.

session_id is of TYPE THFB_SESSION_ID (not there in 46C)

but is of CHAR32 length..

id_len is TYPE i.

you get back session_id and id_len..

Hope this helps..

Sri

Read only

0 Likes
1,636

Hello Juergen,

i've already tracked back the logon information like logon time, terminal or details you may see in sm04 but this is not sufficient since teorically there can be identical logon information for two different logon at a point of time.

i need more unique identifier like a thread or session id between sap server and sapgui.

thank you ,

Read only

0 Likes
1,636

Hello Srikanth,

Thank you for your answer,

i run this c function but it returns subrc=1 and session_id/id_len returns null... perhaps this hex-68 value which i guess that corresponds the 'get_session_id' method of opcode, was not recognized.. do you know if this value is defined in 46C kernel or is there a way to have a list of all OPCODES delivered in 46C kernel ?

Many thanks and regards,

Sahin

Read only

0 Likes
1,636

This works for me in my 46c system.



report zrich_0002 .

data: opcode_get_session_id type x value 68.
data: session_id(32) type c.
data: id_len type i.


call 'ThUsrInfo' id 'OPCODE' field opcode_get_session_id
          id 'SESSION_ID' field session_id
          id 'ID_LEN' field id_len.


check sy-subrc = 0.

Regards,

Rich Heilman

Read only

0 Likes
1,636

Hi

i don't know what goes wrong but that piece of code does not return any value in this system.

my gui version is 640/patch 12 sap basis kernel is 46D patch 1290.. running oracle on unix ..

is there anyway to debug or get details info about this opcodes ?

Best regards

Read only

0 Likes
1,636

Hi Sahin,

I tried this on a 46C system in our company with a 46D kernel patch 2041 and a gui 6.20 patchlevel 50.

-> It works - no error.

Have your company planned a kernelpatch in the next time?

Regards,

Stefan