Excel Order Example for SAP

I have a problem with this activity in UiPath. I manage to insert the first orders from my Excel example into SAP very well.

I have used an If/Else condition for this.
NOT String.IsNullOrEmpty(CurrentRow.ByField(“Client”)) The order is then created here with the first article.
In the Else branch, String.IsNullOrEmpty(CurrentRow.ByField(“Client”)) is then used. AND NOT String.IsNullOrEmpty(CurrentRow.ByField(“Material”))
here it then enters the second item from the order.
However, this only works for me with orders with two items. At the end of my sample data in Excel, I still have an order with one item and an order with three items. However, it does not execute them correctly.
Does anyone have any idea how I can solve this? Can I add an If/else after this or is there a simpler solution?

Many thanks for your help.

Hello @Matthias_Kuntz
It is due the Empty row behavior Property has stop in For Each row excl Activity. There is Completely empty row in your File after 129997. So it stops. To avoid this use Stop after 3 consecuyive empty rows Property. Orelse use required one.

Also try by another method. Initailly filter the All 4 column empty to remove it and use for each row activity.


image
Kindly find the Xaml file, it may helps you
Forum_ExcelSAP_IfCondition.zip (57.5 KB)

@Matthias_Kuntz

The problem is because of click submit I believe

you used it in the else condition by default but when the item is only one the submit is to be clicked after first row only…in case of 3…the submit is to be click after the 3rd and not second

so to make it generic use the click outside both the condition, at the start of the process…and use the if condition liek this …in the for loop first add a index variable to the index property and then in the condition use Not index=0 AndAlso Not String.IsNullOrEmpty(currentRow("Client").ToString)

Make sure this is the first activity in for loop

also to click the last submit use a submit click outsude the loop also which will click submit for the last item as well

image

Hope this helps

cheers

@Matthias_Kuntz

One part is correct other needs change

In for each excel row properties only we have an index property available…it gets auto incremented also…and for making it work for any number one more if condition to be added

You can use currentindex to get that index value instead of using a index variable and initiaizing with 0 and then incrementing it

this is how it looks…after this you can add your other conditions as is


Hope this helps

Cheers

@Matthias_Kuntz

I believe you kept wverythin in the else of first if…else of first if will be empty…they will be outside of that if condition totally

Cheers

When right understood the use case is about

  • data can / should be grouped
  • when for a group all members are processed, then a final click, end action is to do
  • then next group will be processed

In such scenario we can

  • fill up the data
  • then grouping the data / Linq or NON-.Linq approaches
  • looping over the groups and processing the members

Thank you very much for your help. It still doesn’t work the way I want it to, but these are probably some other errors now. I think I will get it to work in a similar way. But thanks for your help.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.