---
version: "2026"
language: "en"
---
# SAP FAQ

## How to set or get attributes in SAP elements using SAP blocks in Leapwork

You can get or set the attributes of SAP elements in Leapwork by using the **SAP Action** block.

The available attributes depend on the type of SAP element you capture.

Use **Get Attribute** to read a value from the element, and **Set Attribute** to write a value to it.

Common attributes include **Name** , **Type** , **Id** and **Text**.

**Getting attributes**

To retrieve text from an SAP element:

1. Capture the element in an **SAP Action** block.

2. Select **Get Attribute** as the action.

3. Choose **Text** in the Attribute Name dropdown.

4. Use the **Value** connector to pass the retrieved text to other blocks.

   ![image-20251204-095723.png](https://docs.leapwork.com/__attachments/a_ca9e477c3764776225b0288cabbec51e25071214aa21e05d7b452201e6a80361/image-20251204-095723.png?cb=b51782a6fb6273700d90ea92e9ea7eb3)

**Setting attributes**

To set a value, such as text:

1. Capture the SAP element in an **SAP Action** block.

2. Select **Set Attribute**.

3. If the element supports text, **Text** will appear in the Attribute Name list.

4. Enter the value you want to set in the field provided.

   ![image-20251204-095631.png](https://docs.leapwork.com/__attachments/a_a21b4ba07f41f7536dad4ba0a5fab8dfedbc2454982e6626d1cfc1c27e1ee6d6/image-20251204-095631.png?cb=c79f0c5dad951aabbfa2ada969ffa927)

*** ** * ** ***

## How to perform SAP data validation using SAP building blocks

In Leapwork, you may need to validate data across SAP transactions. For example, checking that a created sales order number matches the expected value. This can be done using two blocks:

**Validate SAP block**

The **Validate SAP** block allows you to compare the text captured from an SAP element with the text specified in the block's **Validate text** field.

This is useful for simple equal-to validations.  
![image-20251204-100300.png](https://docs.leapwork.com/__attachments/a_85e574a6d6efea13a3cece3ceb06ea16720c576eba1cb4f948308b567527c4b2/image-20251204-100300.png?cb=4c516fc808deee13343cebc57ad9491b)

**SAP Action block**

The **SAP Action** block can retrieve values using **Get Attribute**.  
![image-20251204-100321.png](https://docs.leapwork.com/__attachments/a_8eb0023e1315ac30aaffbdf40177ea3fd43990f8f004d23aee63006b7ad7e785/image-20251204-100321.png?cb=9af631bd1a6b8ced778f854a0f68b576)

You can pass the retrieved value to a **Compare** block to perform more advanced validations, such as:

* A contains B

* A is greater than B

* A is less than B

* Other logical comparisons

This method offers more flexibility than the Validate SAP block.

*** ** * ** ***

## How to handle drop-downs in SAP

Leapwork can select SAP dropdown values in two ways:
Select by Args  
This method selects a dropdown value using the **Args** attribute.

**Get the Args value**

1. Add an **SAP Action** block.

2. Capture the dropdown element.

3. Choose **Get Attribute** as the action.

4. Select **Args** as the attribute name.

   ![image-20251205-073437.png](https://docs.leapwork.com/__attachments/a_2b9fa02a428bbd39cd7fc7c75bf8d7cc99ce071ce8320b7b90caeab3b0de467e/image-20251205-073437.png?cb=31eae8dc2a1424643b11b688c7e0eebf)

**Set the dropdown using Args**

1. Add another **SAP Action** block.

2. Choose **Set Attribute**.

3. Select **Args** as the attribute name.

4. Enter the Args value you want to select.

   ![image-20251205-073652.png](https://docs.leapwork.com/__attachments/a_7adb50d68d64d9cc19eada00e6ecf96dbc2ac7efa75cee6218e208256de0bb45/image-20251205-073652.png?cb=be2b70729900fd4eca99d5d9898e0c07)

Select by Key  
SAP dropdowns often show only descriptions, while each option also has a **Key** value.

If keys are not visible, enable them:

1. In SAP GUI, click **Customize Local Layout** or press **ALT + F12**.

   ![image-20251205-073743.png](https://docs.leapwork.com/__attachments/a_5d9c1654bf4b94f22133adfba44d46e1b8bdb57d31bb168be82ab270a5099b77/image-20251205-073743.png?cb=bb2fe1b7fb43f34468299d0f36efd256)
2. Go to **Interaction Design \> Visualization 1**.

3. Enable **Show keys within dropdown lists**.

4. Click **Apply**.

   ![image-20251205-073814.png](https://docs.leapwork.com/__attachments/a_5da34c1bd82e672bfb23e7fa75f68a7ed39a5faf6b58f99b69cd0abe45ce5e70/image-20251205-073814.png?cb=e513c7f44de27c5eb9fa91d13c7d1aba)

**Get the Key value**

1. Use an **SAP Action** block.

2. Capture the dropdown element.

3. Select **Get Attribute**.

4. Choose **Key** as the attribute.

   ![image-20251205-073838.png](https://docs.leapwork.com/__attachments/a_743dd4e35009c9cf739dfec57af563d17858806013f7f38327d7d4a41f76a9ea/image-20251205-073838.png?cb=0a00ba9397d5f0f04b2a3cd17f164178)

**Set the dropdown using Key**

1. Add an **SAP Action** block.

2. Select **Set Attribute**.

3. Choose **Key** as the attribute.

4. Enter the key you want (for example **44**).

   ![image-20251205-073855.png](https://docs.leapwork.com/__attachments/a_23e806250c7530e29dc4096101a89a6dd2bf78ccd134a0d9494a8bec0efb4de1/image-20251205-073855.png?cb=18c5a13bfc6b14fd8f8f15bcdda70e48)