• Introducing Dark Mode! Switch by clicking on the lightbulb icon next to Search or by clicking on Default style at the bottom left of the page!

Retrieve Session Key (SNKY)

MarshallB

Well Known Member
Hi all,
Is there a business function I can use to retrieve session key? I have an advanced pricing basis code 8 function, in which I would like to edit the SO header cache. There are Business Functions I can use to affect the SO header, but I need to pass in session key.

I should add, Boster has offered some great advice previously on a very similar topic, however I was looking for a way to get Job number (JOBN). If I know the session key I think I can do everything I need to within NER, as I'm pretty limited with C knowledge.
Thanks for any advice,

Marshall

JDE E1 9.1
Win/Sql 2008 R2
 

BOster

Legendary Poster
The session key is really just a GUID. Think of it as a handle to a unique instance of a sales order in memory. Basically like a JobNumber but with a more appropriate name.

Your question probably needs to be a little more specific. If you want a NEW Session Key/GUID to start editing a NEW instance of a sales order then use P42101 to generate a debug log and it shouldn't take you long to find the function Sales Order entry is using to generate the Session Key/GUID.

However, if you want the session key or GUID for an order all ready loaded into memory, that is a different story. The whole idea is that you need to know the Session Key being used with a given instance of an order in memory to call functions that operate on that order in memory. You should have retained that value when you started editing the order since it is the handle to the order in memory. In other words there really can't be a function to return the session key "for an order" because you may have 20, 30, 100+ orders loaded into memory... which one do you want the handle too? There may be a function that, given the Jobnumber used with the underlying SOE MBF, may be able to find the session key some how, or it may be possible provided there is a shared cache design pattern that somehow has this relationship in its records to create a BSFN that does this, but there again, you would need to know the SOE MBF Jobnumber for the specific order you wish to edit... usually if you know the Jobnmber being used by the SOE MBF, then you probably all ready know the Session Key. There is a way, if you know the SessionKey to easily get the SOE MBF JobNumber, but probably not the other way around.
 

MarshallB

Well Known Member
Thanks for the detailed response, that helps give me a better understanding.

As for my particular use case, the session key will already exist. I'm using an advanced pricing basis code 8 function (which allows you to call a custom business function from advanced pricing to manipulate prices). In my function I would like to enable/disable the apply freight field in the so header cache.
For the basis code 8 functionality you have to use a particular data structure (D4500210) that has pointers to the current sales order detail record and item branch record, but not the header.
 
Top