How to iterate over or extract an SAP table that is of category Structured

Hello all

I read the “How to ask a good question” article which speaks of searching the forum for a similar question first. I suppose this question is very much like “Extract Structured data?” in the HowTo section, see Link. However there is no reply at all to it.

The situation :
I need to perform actions on certain rows of a table. The table is structured (I heard this can cause issues). I will have to open a certain row and perform further actions. Then I have to move on to the next row.

My idea :
As far as I have been able to figure out, perhaps it’s best to export the list to Excel, read it in as a datatable and then try to find the correct line in the SAP window based on document or assignment number (or some other identifier).

What I hope :
I hope there is another way of doing this that I am not aware of. Is it possible to iterate over a structured SAP table without extracting it?

If not, what is the best way of extracting it? It’s a large table with over 4000 rows.

MCVE :
My apologies, there is no MCVE as I am asking if it is possible in the first place (iterate over structured table) and if not, how to reliably extract the table into a datatable. I suppose it’s more of a theoretical question and not a code sample question.

UiPath version :
I’m using UiPath Studio 2017.1.6522 Community Edition

Thanks for reading and hopefully contributing to the discussion :smile:

@tvd: Please watch this video on SAP automation. The do extract a SAP table, hope you find it useful.

1 Like

@PD2 Hi Priya, thank you for the reply. I had a look but this doesn’t seem to work for structured tables. The selectors in SAP for structured tables only have an ID, not rows and column indexes. So there is no way to extract the whole table by performing a “Get Table Cell” and then looping over the entire table using counters.

The difference is that a structure doesn’t actually hold data it seems. More about that can be seen in this link Transparent Tables vs Structures

Since structures don’t actually hold any data UiPath can’t extract the data from the source. So the only options are OCR and exporting to Excel. From Excel it can be read into a datatable and then somehow I will have to manipulate elements in SAP. Probably by using “Double Click OCR Text”.

Is my thinking correct?

@tvd: Please try this out:

Using Data scraping click on any of the cells on the table and click on finish to extract as datatable.

Let me know how it goes.

Hi @PD2

Thank you for the suggestion. I tried that before but that technique doesn’t work on tables of the category “structure”. See the link I posted in my previous reply and you will find that these tables don’t actually hold any data that can be extracted. If you try to use datascraping as you suggest, you will get the following error :
SAP_structure_data_scraping

Luckily I can get the data using the export to Excel option in SAP and read the Excel file into a datatable. So by working around it that way I can get the data. But then I still need to find a reliable way to open each line in the structured table based on the row info from the datatable. This can only be done using OCR I think, and my tests show that this isn’t very reliable unfortunately.

1 Like

I had the same issue with a report in SAP. Some of the reports in SAP however, does not have that option to export to excel, or the export format is not good at all. In this case I suggest using screen scraping with the Native method. This will extract all the text in the report and it has a accuracy of 100%. Then you can generate a table and structure the data, allowing you to extract the data you want. Hope this helps! :slight_smile:

Hi @nbjerke, thanks for the suggestion.

I gave it a try but the screen I’m working with has text above the table and the table is 4000+ rows long, so much much more than just 1 screen. The Excel export is working perfectly so I can get the data reliably already and all I have to do is read it in, no extra steps required to structure the data. It would just be nice to be able to natively iterate over the rows in SAP but that’s simply not possible for now :slight_smile:

I’m having the same issue, and the excel export is unreliable / causes an error message to appear. So far, the only way I’ve found to work consistently is to export it to Firefox (IE failed because of ActiveX block settings and Chrome because the UIPath plugin gets more and more unreliable each day). Haven’t found a reliable way to perform actions once the line is properly identified though especially if said line is not visible on screen. I’ll let you know if I find a decent workaround.

Cheers
Stratum

Update on this one: I was able to manipulate / read / act / data-scrape over table data switching in the settings to ALV Grid view. Have you tried that?

Cheers
Stratum