How to get a specific row value from datatable

Hello folks,

I have 10 purchase orders in my excel file. So,I need to get the purchase order from excel file and need to export the files from one purchase order to another purchase order in SAP. I have also used exception handling in this. So, If I got an exception after completion of second row in excel the current window was moving to previous window in SAP by throwing an error. My requirement comes into picture now, I want to again enter into the current window and wants to continue with the third row in excel file. Will it be feasible to continue with the specific row after a break. If so please suggest how to do it.

Hi @ushu,
Here I mentioned my suggestions.

  1. To navigate the window you can use the attached window and you can maintain the row position in a variable.
  2. Y don’t use to read the excel data into DataTable by using the ReadRange Activity
  3. It very easy to main the row position by for loop. Inside the loop the you can call the sap activity by a Invoke work flow.

Regards
Balamruugan.S

Hi,
Yes it is possible to resume the processing of excel records after an exception occured.

Approach1: Orchestrator Queues-- You can add all the excel records as individual queue items to the orchestrator. When you add a queue item its status is new and after successful processing you can mark the status of this particular queue item as successful. Robot will only pick the queue items with status as new and it will avoid successful transactions being processed twice.

Approach 2: Updating status in the source file itself:
You can add another data column to your excel which will show status. After only successful processing of any row, the status column for that row record should be marked as processed.Initially the bot should only take up the rows where status is empty or not “processed” for keying into SAP.

Approach 1 is easy to implement where as in second approach you will have to design the excel and solution.

  1. use orchestrator queues or
  2. For each loop
    to continue the process without interuption

Thanks Sourav and Rajasekhar, balupad

Balupad, I used the read range activity in my workflow and maintained the data in datatable. But, I didn’t understand the attached window concept. Could you please suggest on it.

Sourav, we are currently working with approach 2. If we get an exception after second row as you said the first two rows status marked as successfully processed and the third row status will be empty. Could you please suggest how can we write a code for that.

Hi Ushu,

1.Add data column( status ) to the existing datatable before we start the process and after reading excel.
then Completing one transaction assign status is Completed(whatever you want based on the status of the transaction)
finally save the datatable in the same path of existing file irrespective of failure or success

2.create a clone data table and add data column (status), assign the status based on transaction status
then finally replace the existing file with the clone datatable

1 Like

Thanks for your suggestion rajsekhar. Will try on it.

Meanwhile, I got an System.IO exception while running the task. I added it in my catch block as a second exception. However, when this exception raises it was simply throwing an error instead of catching it, Could anyone suggest please.

if you are not getting specified exception in this scenario, add default exception is “System.exception” as a final catch block for every try catch… it is a good practice