I have an excel file that lists sales order numbers, line numbers, and qty.

There are sometimes same sales order numbers.

The robot first read the excel file, and then inputs the data to SAP.

SO | Line | qty |
---|---|---|

30xxxxxx | 10 | 100 |

30xxxxxx | 20 | 200 |

30aaaaaa | 10 | 100 |

30bbbbbb | 10 | 10 |

I need to combine the same sales order and process together.

When the robot loops through the table, it clicks “save” at the end of each iteration, and then goes to the next line.

But I want to avoid to click “save” if the next SO number is the same as the current SO number .

If the next SO number is the same as current one, proceed with the next line input.

If the next SO number is different as the current one, save the current data, and go back to the first step.

I tried to check if the current SO number equals with the next (or previous) one (image below)but it does not work because the first row and the last does not have the previous or next row.

How do I loop through this kind of process?