Сравнение версий

Ключ

  • Эта строка добавлена.
  • Эта строка удалена.
  • Изменено форматирование.

...

Get table Version 8 (Net)

Группа действийAction group: SAP 

Опиcание

...

Description

The action returns data from a table-type element in the SAP application windowДействие возвращает данные из элемента табличного типа в окне SAP-приложения.

...

Settings

Свойство
Property
Описание
Description
Тип
Type
Пример заполнения
Filling example
Обязательность
Mandatory 
заполнения поля
field
Параметры
Parameters
SAP
-приложение
application
Экземпляр SAP-приложения, с которым работает действие
SAP application instance that the action works on.Robin.Sap
Да

Yes

Элемент

Элемент табличного типа в окне SAP-приложения. Если указанный элемент не является элементом табличного типа, то действие выдаст ошибку
ElementA table type element in the SAP application window. If the specified element is not an element of a table type, then the action will throw an error.Robin.WinElement
Да

Yes

С заголовком

Если значение «true», строка с заголовком таблицы будет выделена отдельно и не будет входить в строки с содержимым таблицы
HeadingIf the value is «true», the row with the table header will be highlighted separately and will not be included in the row with the contents of the table.Robin.Booleantrue

Нет

Убрать дубли заголовка

Если значение «true», в заголовке полученной таблицы к одинаковым названиям столбцов будут добавлены индексы. Нумерация начинается с
No
Remove duplicate headerIf the value is «true», indexes will be added to the same column names in the header of the resulting table. Numbering starts from 1.Robin.Booleantrue
Нет
No
Результаты
Results

Результат

Таблица с данными
ResultData TableRobin.DataTable

Особые условия использования 



Special conditions of use

For the parameter "HeadingДля параметра "С заголовком

Забираем таблицуGet the spreadsheet:

При включенном параметре в логе будет указано "СтолбцовWith this parameter enabled, the log will show "Columns: 3; строкrows: 2" , т.к. Первая строка взятой области стала заголовком с названиями столбцов "№", "Название" и "Тесты". К этим заголовкам нельзя обратиться как к строке данных, чтобы прочитать, но можно использовать имена столбцов, чтобы обратиться к конкретной ячейке или столбцу (действиями из группы "Таблицы"). Если параметр выключен, то в логе будет указано "Столбцов: 3; строк: 3", названия столбцов в заголовке будут because the first row of the taken area has become a header with the column names "No.", "Title", and "Tests". These headers cannot be accessed as a row of data to read, but you can use the column names to access a specific cell or column (by actions from the "Tables" group). If the option is off, the log will show "Columns: 3; rows: 3", the column names in the header will be "1", "2" и and "3".

Также во все указанные действия добавить во входные параметры чекбокс "Убрать дубли заголовка":

...

Also, in all of the above actions, add the "Remove duplicate header" checkbox to the input parameters:

  • When "true" is true, indices will be added to the header of the tabular value that the actions return as a result to the same column names. The numbering starts from 1. 
    Example No1:
    There is a table:
    Image Added
    With "Remove duplicate header" = true, and "Heading" = True, the "Take table" action will return a table of 10 rows and 4 columns. The column names of this table will be "No.", "Name", "Tests1", "Tests2".
    Example No2:
    There is a table:
    Image Added
    When "Remove duplicate header" = true, and "Heading" = True, the "Take table" action will return a table of 4 rows and 5 columns. The column names of this table will be:
    "Test31", "Test21", "Test22", "Test32", "Test1".
  • If "false", the column names will remain the same. Actions on net that return/process such tables with duplicated column names will crash with an error, because net cannot have a header with the same column names.
  • For example, the source table has columns "Test1", "Test" and "Test". If we add indexes only to the current doubles, the names will become "Test1", "Test1" and "Test2", i.e. new doubles with the name "Test1" will appear. Therefore, when renaming a particular column, the action should check if another column already has such a name and if there is such a match, the current column should have the next index. That is, in this case the action will rename the columns as "Test1", "Test2" and "Test3".

Example of use 

Task

You need to retrieve a table from SAP and save it in CSV format. 

Image Added

 Solution

Use the actions "Connect to session", "Get table", "Save table to CSV". 

Implementation

  1. Assemble a robot scheme consisting of the following actions
    Image Added
  2. Set the parameters for the "Connect to session" action. 
    Image Added
  3. Set the parameters for the "Get table" action. The "Item" parameter must be retrieved via SAP Spy. 
    Image Added
  4. Set the parameters of the "Save table to CSV" action. 
    Image Added
  5. Launch the robot by clicking on the "Start" button in the top panel. 

Result

The program robot completed successfully. 

Image Added


The table is saved in CSV format

  • При значении "false", названия столбцов останутся прежними. Действия на net, которые возвращают\обрабатывают такие таблицы с задублированными названиями столбцов, будут падать с ошибкой, т.к. в net не может быть заголовка с одинаковыми названиями столбцов.
  • Например, в исходной таблице есть столбцы "Тест1", "Тест" и "Тест". Если добавлять индексы только к текущим дублям, то названия станут такими "Тест1", "Тест1" и "Тест2", т.е. в итоге появятся новые дубли с названием "Тест1". Поэтому действие при переименовании конкретного столбца должно проверять, нет ли уже такого названия у другого столбца и при наличии таких совпадений проставлять у текущего столбца следующий по счету индекс. Т.е. в данном случае действие переименует столбцы как "Тест1", "Тест2" и "Тест3".

Пример использования 

Задача: необходимо получить таблицу из SAP и сохранить ее в формате CSV. 

Image Removed

Решение: воспользоваться действиями "Подключиться к сессии", "Получить таблицу", "Сохранить таблицу в CSV". 

Реализация:

...

Результат: 

Программный робот отработал успешно. 

Image Removed

Таблица сохранена в формате CSV