Command: Set

Previous  Next |  Direct link to this topic

Go to list of all Commands

Syntax: Set(<target>|<valueToSet>);

 

This command can be used to set a fixed value to an item.

For this you need 2 arguments:

Argument

Description

Target

Standard Formatted search style $[$item.column.type]

Type

Rules

0/String [Default]

As it is

NUMBER

No thousands separators

CURRENCY

Decimal-separator = .

Thousands-separator = ,

DATE

YYYY-MM-DD (2007-04-20 = 20th of April 2007)

 

In addition to a numbered row you can use the following keywords to refer to special rows:

 

Keyword

Description

.FIRST

Refer to the First row in the Matrix (does essentially the same a ".1")

.LAST

Refer to the Last row in the Matrix

LAST-1

Refer to the Second to Last row in the matrix (this is in many cases handy as SAP normally have an new empty line for new row entries)

.SELECTED

Refer to the Row that have a Selection (aka highlighted in Yellow). If no selection this will fall back to working with the first row

.FOCUSED

Refer to the Tow that have cell focus (the row where the "yellow" cell is). If no cell focus this will fall back to working with the first row

ValueToSet

The value to set. Please see the value type how special data should be entered.

TIP: You can use dynamic data from the current window in the value to set using $[$item.column.type].

TIP: You can make the value to set come from an SQL-sentence if you start it with SQL:<SQL-statement>.

TIP: You can make the value to set come from an SQL-sentence if you start it with SQL_INVARIANT:<SQL-statement>. SQL invariant is used to ensure that decimal numbers are returned in the correct format depending on your system

TIP: If you wish to insert line breaks please use the <newline> keyword to do it.

Sample1: Set($[$4.0.DATE]|2007-01-31); will set the value of item with Uid 4 to 31rd of January 2007 (if item 4 is bound to a Date-field)

Sample2: Set($[$38.11.CURRENCY]|1.75); will set the value of matrix with Uid 38 of its column 11 to 1.75

Sample3: Set($[$16.0.0]|$[$4.0.0]); will set the value of item 16 with the value of item 4.

Sample4 [MSSQL]: Set($[$16.0.0]|SQL:SELECT CardName FROM OCRD WHERE CardCode = $[$4.0.0]); will set the value of item 16 with the result of the SQL

Sample5 [MSSQL]: SET($[$10.0.DATE]|SQL: SELECT CONVERT(VARCHAR(10), GETDATE(), 120));will set the date in item 10 to today’s date. Please note that Conversion of the GetDate to the yyyy-MM-dd format is needed as getdate returns values based on SQL localization/language

 
Sample 6 [HANA]: SET($[$10.0.DATE]|SQL:SELECT TO_CHAR(ADD_DAYS(TO_DATE(CURRENT_DATE, 'yyyy-mm-dd'), 5), 'yyyy-mm-dd') FROM DUMMY); will set the date in item 10 to 5 days in the future.

TIP: If your set-command need to have line breaks you can use the special keyword <NEWLINE> to symbolize this.

Sample6: Set($[$16.0.0]|Line1<NEWLINE>Line2); will set the value of item 16 with the value “Line1”, then a line break and then “Line2”.

NB: You cannot set fields that are read-only in the UI. You can try and unlock the field using the "Enable" function but B1UP cannot break the SAP UI logic.

Known limitation: It is not possible to set/transfer custom values to fields SAP can overwrite with CTRL+Tab. This is due to a SAP SDK UI-API Limitation. Please go vote for the option to do this on SAP idea Place: https://influence.sap.com/sap/ino/#/idea/131306 so we can offer it in the future.

FAQ: When it is possible to read and write data using the dynamic syntax

 


Similar/Related Commands:
- Blank
- BlankUdfSideBar
- MultiSetFromSQL
- SetUdfSidebar
- Transfer
- TransferBack
- TransferBackUdfSidebar
- TransferUdfSidebar