SAP Knowledge Base Article - Public

2195152 - Query operation to AdHoc API entities fail with an error: Entity type 'ADHOC_XXXX' doesn't support Query Operation!

Symptom

Adhoc is not supporting "Query" Operation.

Also, We do not see the list of Supported operations for Adhoc API in the SFAPI data dictionary.

 

no supported ops.jpg

Environment

SuccessFactors System

Reproducing the Issue

We get the below error when we try to make a Query operation using the Adhoc API.

no query.jpg 

Cause

Adhoc Supports only Query operation via submitQueryJob. Hence the synchronous approach of Query fails to return data.

This is the same reason why Supported operations are not listed in SFAPI Data Dicitionary.

Adhoc API has the below process flow.

  • SubmitQueryJob
  • GetJobStatus (explains status values)
  • GetJobResults or GetJobResultsEmbedded 

Resolution

Please use "submitQueryJob" API call which creates a taskId.

Below is the Request and Response XML for submitQueryJob from SFAPI Audit logs which explains the XML structure.

Request

 <S:Body>
    <submitQueryJob xmlns="urn:sfobject.sfapi.successfactors.com" xmlns:ns2="urn:fault.sfapi.successfactors.com">
      <queryString>SELECT ectint_emailInfo_B_B_EMAIL_ADDRESS,ectint_emailInfo_B_B_IS_PRIMARY
 FROM adhoc_ectint 
 WHERE 
 users_sysinfo_USERS_SYS_USERNAME = 'admin'

 CONSTRAIN BY 
 asOfDate='2015-07-26' AND filter_dept='all'</queryString>
      <param>
        <name>keepReportDefinition</name>
        <value>false</value>
      </param>
    </submitQueryJob>
  </S:Body>

 Response

<S:Body>
    <submitQueryJobResponse xmlns="urn:sfobject.sfapi.successfactors.com" xmlns:ns2="urn:fault.sfapi.successfactors.com">
      <result>
        <taskId>TASK-ADHOC-20154</taskId>
        <taskName>SFAPI_0726185957688MbP_ectint</taskName>
        <createDate>2015-07-26T22:59:57.734Z</createDate>
        <status>submitted</status>
      </result>
    </submitQueryJobResponse>
  </S:Body>

Similarly, From getJobStatus API call,We can observe the status of the task.

Request
<?xml version="1.0" encoding="UTF-8"?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
  <S:Header />
  <S:Body>
    <getJobStatus xmlns="urn:sfobject.sfapi.successfactors.com" xmlns:ns2="urn:fault.sfapi.successfactors.com">
      <taskId>TASK-ADHOC-20154</taskId>
    </getJobStatus>
  </S:Body>
</S:Envelope>

Response
<?xml version="1.0" encoding="UTF-8"?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
  <S:Body>
    <getJobStatusResponse xmlns="urn:sfobject.sfapi.successfactors.com" xmlns:ns2="urn:fault.sfapi.successfactors.com">
      <result>
        <taskId>TASK-ADHOC-20154</taskId>
        <taskName>SFAPI_0726185957688MbP_ectint</taskName>
        <createDate>2015-07-26T22:59:57.734Z</createDate>
        <status>submitted</status>
      </result>
    </getJobStatusResponse>
  </S:Body>
</S:Envelope>
 Finally, We should use getJobResults to get the data for the above request xml. 
Request
<?xml version="1.0" encoding="UTF-8"?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
  <S:Header />
  <S:Body>
    <getJobResult xmlns="urn:sfobject.sfapi.successfactors.com" xmlns:ns2="urn:fault.sfapi.successfactors.com">
      <taskId>TASK-ADHOC-20154</taskId>
      <format>csv</format>
    </getJobResult>
  </S:Body>
</S:Envelope>

 Response

<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"><S:Header/><S:Body/></S:Envelope>
------=_Part_142_2061671481.1437951666146
Content-Type: application/octet-stream
Content-ID: <parameters=0c447df5-11a9-4552-89c6-bbd1fc0b34d7@jaxws.sun.com>
"Business Email Information Email Address","Business Email Information Is Primary"
"admin@ACEcompany.com","Yes"
We observe that the results are fetched as per the given select query.

See Also

We have used the below url to perform the API trials

https://sfapitoolsflms.hana.ondemand.com/SFIntegration/dd.jsp

For more detailed information on the topic, Please read through

HCM Suite SFAPI General Programming Guidelines Handbook - Chapter 11 - Async Job Operations or follow the below link.

http://help.sap.com/saphelp_cloud4hr/helpdata/en/55/be23a911bb418c97d4f0c275da51fc/content.htm?frameset=/en/86/2e8238648a4529abda8f2b8a7fdd3c/frameset.htm&current_toc=/en/86/2e8238648a4529abda8f2b8a7fdd3c/plain.htm&node_id=12

Keywords

Adhoc API , Adhoc api supported operations , KBA , LOD-SF-INT-API , API & Adhoc API Framework , Problem

Product

SAP SuccessFactors HCM Core all versions