Skip to Content
Technical Articles
Author's profile photo Vijay Sharma

SAP Intelligent RPA – Post General Journal Entries via RFC !!

Business Process Automation is one of the trending skills then ever before and many wonderful tools like SAP intelligent RPA,UiPath, Automation Anywhere etc.,  are there to help you automate the repeated business processes with no value add and eats up a lot of time.

I have been exploring SAP intelligent RPA for last few months and still learning. In my last blog, “SAP Intelligent RPA Trial – Get Ready to build Bots…” , I explained the system setup to get ready to build bots using SAP intelligent RPA. I am glad that you guys found it useful.

SAP has provided repository of pre-built bots ( and is growing continuously) and it includes Bots for JE posting using Fiori application “Upload General Journal Entries (F2548)”  automation and another one using SOAP API . But frankly speaking, i found it quite complicated to make the pre-built bots run in your system.

In this blog, we are going to see another approach to post Journal Entries (JE) using RFC “BAPI_ACC_DOCUMENT_POST” call from SAP intelligent RPA.




  • Journal Entries to be uploaded will be available in standard upload excel template and user receives the file as email attachment.

  • Bot1 is supposed to search email and save the upload file in required folder.
  • Bot is supposed to read the entries from the excel and post them in SAP and update the BAPI response message in the upload excel and
  • send the updated excel back to user over email.


The Bot workflow in this case is very simple, just one step, as posting is done via BAPI call and no screens to be recorded. So, i have just kept one step name to read Data from the template and all the processing is happening in the step (not the best approach but intention was to make it work ;-)). You, can split it into multiple steps also to make it look cleaner.

Let’s see now, what is done inside this single step defined.

Note: Don’t forget to activate the excel and outlook libraries to uses the same in your project.

Bot1– This is simple bot to search the email based on selection criteria, could be subject or Attachment name , sender or combination of multiple and saves the attached upload file to the system. Please check this nice blog  SAP Intelligent RPA: Save Attachments from emails   from Diana  to see how to achieve Bot1 functionality.

Bot2– This will ready the upload file and upload in SAP and will prepare the result file and share the same with user over email.Lets see how Bot2 works and the steps involved.

Step 1 – Read the data from the Excel template using excel library methods and store the same in context variables . In this a case, i am storing the same in scenario local data variables.

As there will be more then one documents to be post , we need to read the each entry details in a loop as shown below.

Step 2 –  Set up the connection with the SAP system in which we are going to call RFC.

Step 3 – Add the BAPI to be called to the connection instance

Step 4 – Populate the RFC Header ad details structures as required with the data read from the excel


Step 5 – Call the BAPI and get the response.

Step 6 – Read the response messages and update the same in upload excel. I kept the message as is for this example, but we can format it better as needed.

Step 7 – Once all the entries from the excel are processed, save the excel and send the same as email attachment to the user.


With the, we have seen how we can use RFC calls to automate business process using SAP iRPA.

Note: Benefit of using RFC over Fiori app automation is that  RFC execution can be unattended, that can run in background. But in case of Fiori app, file selection step needs active screen session and make it to be an attended process. 

Another benefit is, no screen in RFC, which usually can cause timeout issues in Fiori app case if not handled properly or if the network is slow.

Watch the demo here


Keep Learning & Keep Sharing!!

Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Srinivas Rao
      Srinivas Rao

      Excellent blog Vijay Sharma !

      Thanks for sharing. 🙂

      Author's profile photo Vijay Sharma
      Vijay Sharma
      Blog Post Author

      Thanks Srinivas!!

      Author's profile photo Ganesh Jagtap
      Ganesh Jagtap

      Hi Vijay,


      I'm not able to build code. getting below error while compiling code. Could you please help me.

      Author's profile photo Vijay Sharma
      Vijay Sharma
      Blog Post Author

      can you try like this.

      hdrdata("OBJ_TYPE").value = "BKPFF"




      Author's profile photo bhushan dubey
      bhushan dubey

      i get an error "object type required"

      is there any chance i can get the whole code and a sample input excel.

      I am an intern and struggling learning sap IRPA.

      I want to upload data to bapi table from sap irpa

      Author's profile photo Duy Pham Tu
      Duy Pham Tu

      Hi Vijay,

      I push data as bellow but in debug mode in SAP DOCUMENTHEADER-OBJ_KEY is null. Could you please help me?



      Author's profile photo Vinh Phi Huu
      Vinh Phi Huu

      Hi @Tu Duy Pham,

      Please try above code. I worked!

      Author's profile photo M Depa
      M Depa

      Hi Vijay,


      Excellent, it is very help full I need to try for some other use case with different BAPI.

      Author's profile photo Elima Losada
      Elima Losada

      Hi Vijay,


      I am trying to implement step 2 in a script, but I get the following error: ActiveXObject is not defined

      I had found that for browser Chrome, it´s my case, ActiveX is not workimg.

      I had chequed the next link, i think i have all like it recommends.

      Thanks a lot.