cancel
Showing results for 
Search instead for 
Did you mean: 

Developing with SAP Integration Suite

nkrishna
Member

I am trying all exercises from C_CPI_14 - Unit 3 - Exercise - Consume Purchase order API from SAP API Business Hub, Step 19 In the configuration view of the OData connector, select the Connection tab. Enter the Request URL you previously took note of. Deselect the CSRF token fetch.

When I tried to provide below URL in the Request & Reply - Address as specified in the document, I am getting connection error

https://sandbox.api.sap.com/s4hanacloud/sap/opu/odata/sap/API_PURCHASEORDER_PROCESS_SRV

Can someone, please help me so that I can continue with my learning and complete.  Appreciation your inputs /

#Developing with SAP Integration Suite

nkrishna
Member
Hello IIIya, I am using /A_PurchaseOrder, but issue I am facing is I am unable to connect to the system with api.sap.com (APIKey) .
(0)
Illya
Employee
If you cannot access api.sap.com with your credentials (which usually must be the case), you must contact the SAP API group. Help information can be found at the bottom of the api.sap.com page. If you can access api.sap.com and successfully test the GET method A_PurchaseOrder there, everything is fine and you can proceed with the iFlow configuration.
(0)

Accepted Solutions (1)

Accepted Solutions (1)

Illya
Employee
Employee

Hi nkrishna,

the error tells us that it has something to do with the API key variable in the externalization step.

Please check the previous steps where you configure the API key (from step 12). First try not to use the externalization step. If it works, then it has something to do with how you configured the externalization step for the API key variable ( {{key}} ).

If it doesn't work either, then your API key may be incorrect. In this case, go back to
https://api.sap.com/api/API_PURCHASEORDER_PROCESS_SRV/tryout   .

and click the "Show API Key" button in the upper right corner to get the correct API key.

Hope, this will help you!
BR,
Illya

nkrishna
Member

Hello lIlya,

Still I am facing problem while configuring OData connection, I am getting error message in step 1 - Failed to connect to the system

Address used - https://sandbox.api.sap.com/s4hanacloud/sap/opu/odata/sap/API_PURCHASEORDER_PROCESS_SRV

I have removed externalization and used same API key created for my user in api.sap.com in the context modifier - header parameter - APIKey - TSU1f4dbpstPqUYFKV49dlHrV8Kan055

I even tried alternative option suggested by you - https://sandbox.api.sap.com/s4hanacloud/sap/opu/odata/sap/API_PURCHASEORDER_PROCESS_SRV/tryout, I am not able to move to step 2 from "Connect to the system"

 Error_1.PNG

Thanks & Regards,

Nagendra

 

(0)
Illya
Employee
Hi Nagendra,
(0)

Answers (4)

Answers (4)

Illya
Employee
Employee

Hi nkrishna,

Please try to do this:

Enter api.sap.com in your browser
Choose a product to explore -> click on S/4HANA Cloud
In the top switch from Overview to API's
In the line below switch from All to ODATA V2
In the right search field enter purchase order and press enter
Click on the ODATA V2 API Purchase Order tile
Click on the Try Out button
If you are not automatically signed in, use your credentials to log in
In the left navigation bar, scroll down and expand Purchase Order and choose the GET API (do not use the Subcontracting Components API)
Enter 15 in the $top parameter field
Click on the Run button
As the result you will see the S/4HANA Cloud sandbox URL in the Request URL field
and the first 15 purchase orders in the request body.
Copy now the API Key from the right button Show APIKey and the Request URL
Enter these informations into step 19 of your iFlow configuration.

BR,
Illya


nkrishna
Member

Hello lllya,

Many thanks for your kind advice and assistance to resolve my issue, appreciated. 

I followed same steps you suggested and the Request URL which I received is "https://sandbox.api.sap.com/s4hanacloud/sap/opu/odata/sap/API_PURCHASEORDER_PROCESS_SRV" and APIKey TSU1f4dbpstPqUYFKV49dlHrV8Kan055. After entering this details, I am getting error message,v "failed to connect to the system".

Not sure where is the problem!!

STEP-1.PNGSTEP1-Error.PNG

(0)
Illya
Employee
Why do you want to connect to the sandbox system explicitly, since this is not described in the learning journey...?
(0)
nkrishna
Member
Hello Illya, When I logon with my user in the api.sap.com,I am getting Request URL as sandbox.api.sap.com by default and APIKey is generated for sandbox.api.sap.com URLs. For this reason I am using sandbox.api.com request URL. Let me know whether any other way to get APIKey for api.sap.com request URL. Thanks for your response, really appreciated.
(0)
Illya
Employee
That is correct. Both Request URL and APIKey must now be entered in the iFlow step (OData Connection). You will see if it works or not at the end when everything is configured.
(0)
nkrishna
Member

Error_Message.PNG

Hello lllya,

Today I have tried the request URL  & APIKey using postman https://sandbox.api.sap.com/s4hanacloud/sap/opu/odata/sap/API_PURCHASEORDER_PROCESS_SRV.

I am getting 401 unauthorized error. May be this is the reason why I am unable to proceed with the connection step. Can you please guide me

(0)
Illya
Employee
Can you start the GET request without errors from the api.sap.com page without going through the sandbox.api.sap.com as explained in the learning journey?
(0)
Illya
Employee
Are you using /A_PurchaseOrder at the end of sandbox URL (..._SRV/A_PurchaseOrder)?
(0)
Illya
Employee
Employee

Hi Nagendra,

You need to configure the connection between the Request&Reply and the Receiver.

Click on the OData connection element and select the Connection tab there to enter the API URL and any other required input.

Illya_0-1638289360570.png

By the way, when I click on the link I provided, it takes me to the SAP API Business Hub page... There you can directly get the API Key as described.

BR,
Illya

nkrishna
Member
Hello IIIya, I followed all your steps, where there is differences is , 1) I am using CPI trail version 2) In api.sap.com , URL generated is for sandbox - https://sandbox.api.sap.com/s4hanacloud/sap/opu/odata/sap/API_PURCHASEORDER_PROCESS_SRV/A_POSubcontr... (3) APIKey , I used in the content modifier header property with value TSU1f4dbpstPqUYFKV49dlHrV8Kan055. Please let me know whether you are able to configure with this details. Sorry for sending too many messages. But issue is not getting resolved
(0)
Illya
Employee
Employee

If you cannot access api.sap.com with your credentials (which usually must be the case), you must contact the SAP API group. Help information can be found at the bottom of the api.sap.com page.
If you can access api.sap.com and successfully test the GET method A_PurchaseOrder there, everything is fine and you can proceed with the iFlow configuration.

sriprasadbhat
Employee
Employee

Hello Nagendra,

Please pass the header name APIKey  in receiver odata adapter request header section ( in addition to Ilya suggested changes ) then you should be able to resolve the issue.

Regards,

Sriprasad Shivaram Bhat

nkrishna
Member
Hello Sriprasad, I am unable to move to second step where you are suggesting me to pass the APIKey, in my case I am getting error message in step 1 itself where we provide address
(0)