title: Finding the (usob)Hash of a Core Data /OData Service Required for the Authorization Object S_SERVICE (parameter SRV_NAME)
body: <p>To access an OData web service that exposes data from a Core Data Service (CDS) in SAP R/3, a user needs has to have an authorization role assigned that contains the authorization object <code>S_SERVICE</code>.</p>
  <p>The authorization object <code>S_SERVICE</code> requires two parameters:</p>
  <ol>
  <li>the <strong>service type</strong> (<code>SRV_TYPE</code>) which is set to <code>HT</code> = &quot;TADIR Object&quot; in my case</li>
  <li>the <strong>service hash</strong> (<code>SRV_NAME</code>).</li>
  </ol>
  <p>Using the debugger I found out, that the function module <code>AUTHORITY_CHECK_TADIR_SERVICE</code> compares the hash from the <code>S_SERVICE</code> authorization object with the hash stored in a record of table <code>usobhash</code>:
  <a href="https://i.stack.imgur.com/I9U4A.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/I9U4A.png" alt="se16 view of table usobhash" /></a></p>
  <p>I also found out, that function module <code>AUTH_TRACE_CALC_HASH</code> uses the data from the columns <code>PGMID</code>, <code>OBJECT</code> and <code>OBJ_NAME</code> in table <code>usobhash</code> as input to generate the hash which is then stored in column <code>NAME</code>.</p>
  <p>So far, whenever I wanted to grant a user/role permission to access a OData service I needed to know this hash. To get the hash, I either checked the usobhash table or manually executed <code>AUTH_TRACE_CALC_HASH</code> and then entered the hash when I assigned the authorization object to an authorization role in transaction <code>pfcg</code>. I guess there has to be an easier, more &quot;official&quot; way to do this. My approach feels like a dirty workaround but I was unable to find any documentation about how to do it right.</p>
  <p><strong>tl;dr</strong> How do I set the <code>S_SERVICE</code> authorization object without either debugging <code>AUTH_TRACE_CALC_HASH</code> or searching for the relevant entry in <code>usobhash</code>?</p>