Skip to Content
Personal Insights

Getting started with out of the box RPA solution : Create Sales Orders(4G5)

Introduction

In this blog post, I am sharing my experience with activating standard bot “Create Sales Orders (4G5)”. This is an API based bot and activating it was not as easy as 1..2..3. 🙂 Please read on to know more about the challenges I faced and the solution for them.

 

Main Content

After reading through the standard test script document for this bot, I could not find what API is being consumed by the bot to create sales orders. Without the name of the API, we cannot proceed even a single step further.

Now to find the name of the API, we have to study the JS code. Download the project package and open the project in your desktop studio. Navigate through the script file and find the place where the API.POST is executed. The code looks as below:-

sc.localData.salesOrderNumber = sc.localData.headers[sc.localData.Startloop_1].SalesOrderNumber;
delete sc.localData.headers[sc.localData.Startloop_1].SalesOrderNumber;
var posturl = getConstructedURL(sc.localData.Resources, rootData.SystemEndPoint, 
                              sc.localData.Resources['settings']['api_post'], sc.localData.SAP_CLIENT);
API.POST(posturl, sc);

 

If we observe carefully, the function “GetConstructedURL” uses

sc.localData.Resources['settings']['api_post']

This statement indicates that there is a “Resources” file and contains all the values. The API name is fetched using the pointers “settings” & “api_post” in the resources file. The resources file can be seen in the project package folder.

On opening the “Resources” file, you will get all the name / value pair used in the entire project. We are interested in finding the name /value pair with pointers as “settings” & “api_post”. It can be seen as below: –

   "settings":{
   "api_get":"/API_SALES_ORDER_SRV/A_SalesOrder?%24top=1",
   "api_post":"/API_SALES_ORDER_SRV/A_SalesOrder"
   }

The API is based on OData API_SALES_ORDER. After maintaining the service in the transaction /n/IWFND/MAINT_SERVICE and doing all the needful, we are set to consume it.

For the bot to execute, we need to maintain the cloud factory variables. One of the main variable is the systemURL. The problem is how to find the system URL for the OData to be consumed.

The “systemURL”  can be found by looking that the metadata file of the Odata with the tags <atom:link> with “href” attribute. The system URL should be only till the name of the API.

 

Conclusion

We understand how to get the system URL for the API which is the most critical part of the setup. We also understand, how to look for the relevant “Resources” file and find for required name/value pair to understand the code.

 

Keeping automating ! Thanks 🙂

 

/
1 Comment
You must be Logged on to comment or reply to a post.
  • Hi Srinivas,

    Thank you so much for sharing your experience and feedback on your journey of automation with SAP.

    We will take your feedback into account to provide our customers more transparency of our pre-built bots. 

    Regards,

    Chuck