Liquid UI - WS Reference Library

getfieldattribute()


Purpose

With getfieldattribute() command, you can attain the attributes of both native SAP or Liquid UI fields.


Syntax

getfieldattribute(Field name,{"option":value…});


Properties

  • Field name - Name of the element.


Sub Properties of name option

  • name.label - Specifies the onscreen label of a given field or screen element.
  • name.icon - Specifies the icon ID of the field element.
  • name.tip - Specifies the tooltip of the field element.


Available Options

You can use the following options with the getfieldattribute: 

"column":".."

"column":true - This option specifies the column number of a text area for the text field.

"columnnumber":".."

"columnnumber":true - This option specifies the ID of a given column in a table.

"displaycolumnnumber":".."

"displaycolumnnumber":true - This option specifies the screen display number for columns in a table.

"header":".."

"header":SAPColumnName - This option specifies the header, if the element is a table column.

"isprotected":".."

"isprotected":string - This option specifies whether a given screen element is active or not. For edit fields, radiobuttons and checkboxes, '1' equals readonly and '0' equals editable. For pushbuttons, '1' equals inactive and '0' equals active. For all elements, 'null' equals not found.

"name":".."

"name":string - This option specifies the onscreen label for a given screen element.

"row":".."

"row":string - This option specifies the row number of the text area for the given text field.

"size":".."

"size":string - This option specifies the number of characters a text field contain.

"techname":".."

"techname":string - This option specifies the technical name of a screen element (Eg. VBKD-BSTKD).

"textcolumn":".."

"textcolumn":string - This option specifies the column number of a screen element's label.

"textrow":".."

"textrow":string - This option specifies the row number of a screen element's label.

"width":".."

"width":string - This option specifies the row number of a screen element's label.


Option Details

column

  1. This option specifies the column number of a text area for the text field.

  2. getfieldattribute("F[Order Type]",{"column":"fcol"});
    println("\t fcol = " + fcol);
    
  3. As per the code, this option specifies the column number of the Order Type field.

columnnumber

  1. This option specifies the ID of a given column in a table.

  2. getfieldattribute("F[Order Type]",{"columnnumber":"fcolno"});
    println("\t fcolno = " + fcolno);
    
  3. Note: This option can only be used with tables.

displaycolumnnumber

  1. This option specifies the screen display number for columns in a table.

  2.  getfieldattribute("F[Order Type]",{"displaycolumnnumber":"fdisplaycolumnnumber"});
    println("\t fdisplaycolumnnumber = " + fdisplaycolumnnumber);
  3. Note: This option can only be used with tables.

header

  1. This option specifies the header, if the element is a table column.

  2. getfieldattribute("F[Order Type]",{"header":"fheader"});
    println("\t fheader = " + fheader);
    
  3. Note: This option can only be used with tables.

isprotected

  1. This option specifies if a given screen element is active or not. For edit fields, radiobuttons and checkboxes, '1' equals read-only and '0' equals editable. For pushbuttons, '1' equals inactive and '0' equals active. For all elements, 'null' equals not found. 

  2. getfieldattribute("F[Order Type]",{"isprotected":"fprotected"}); 
    println("\t isprotected = " + fprotected);
    
  3. As per the code, this option specifies the isprotected value of the Order Type field.

name

  1. This option specifies the onscreen label for a given screen element.

  2. The properties of the field object can also be used as options in the fieldname command. For example, the name property has several sub-properties, which are as follows:

    name.label
    Specifies the onscreen label of a given pushbutton or other screen element. Columns in a table are excluded.
    name.icon
    For pushbuttons, this specifies the icon ID.
    name.tip
    For pushbuttons, this specifies the tooltip.
  3. getfieldattribute("F[Order Type]",{"name":"fname"});
    println("\t fname = " + fname);
    
  4. As per the code, this option specifies the name of the Order Type field.

row

  1. This option specifies the row number of the text area for the given text field.

  2.  getfieldattribute("F[Order Type]",{"row":"frow"});
    println("\t frow = " + frow);
    
  3. As per the code, this option specifies the row number of the Order Type field.

size

  1. This option specifies the number of characters a text field can contain. 

  2. getfieldattribute("F[Order Type]",{"size":"fsize"});
    println("\t fsize = " + fsize);
  3. As per the code, this option specifies the size of the Order Type field.

techname

  1. This option specifies the technical name of a screen element (eg. VBKD-BSTKD).

  2. getfieldattribute("F[Order Type]",{"techname":"ftechname"});
    println("\t ftechname = " + ftechname);
  3. As per the code, this option specifies the techname of the Order Type field.

textcolumn

  1. This option specifies the column number of a screen element's label.

  2. getfieldattribute("F[Order Type]",{"textcolumn":"ftextcolumn"});
    println("\t ftextcolumn = " + ftextcolumn);
  3. As per the code, this option specifies the textcolumn number of the Order Type field.

textrow

  1. This option specifies the row number of a screen element's label.

  2. getfieldattribute("F[Order Type]",{"textrow":"ftextrow"});
    println("\t ftextrow = " + ftextrow);
    
  3. As per the code, this option specifies the textrow number of the Order Type label.

width

  1. This option specifies the width for columns in a table.

  2. getfieldattribute("F[Order Type]",{"width":"fwidth"});
    println("\t fwidth = " + fwidth);
  3. As per the code, this option specifies the width of the  Order Type field in a table.


Example

The following scenario demonstrate the usage of getfiedattribute() command.

Note: To display output on the screen, use the message().


Script

Enter the following code in Create Sales Order screen(VA01):

//SAPMV45A.E0101

function printInfo(){
	println("Executing getfieldattribute command");
getfieldattribute("F[Order Type]",{"name":"fname","textrow":"ftextrow","textcolumn":"ftextcolumn","row":"frow", "column":"fcol","techname":"ftechname","size":"fsize","isprotected":"fprotected", "header":"fheader","columnnumber":"fcolumnnumber","displaycolumnnumber":"fdisplaycolumnnumber", "width":"fwidth"}); 
println("Printing Field attributes!");
println("\t fname = " + fname);
println("\t ftextrow = " + ftextrow);
println("\t ftextcolumn = " + ftextcolumn);
println("\t frow = " + frow);
println("\t fcol = " + fcol);
println("\t ftechname = " + ftechname);
println("\t fsize = " + fsize);
println("\t isprotected = " + fprotected);
println("\t fheader = " + fheader);
println("\t fcolumnnumber = " + fcolumnnumber);
println("\t fdisplaycolumnnumber = " + fdisplaycolumnnumber);
println("\t fwidth = " + fwidth);
}
printInfo();


Tips and Tricks

  • Display of sub-properties of a pushbutton using getfieldattribute()

    This example explains on how to display icon, tip and label values of a pushbutton using the getfieldattribute(). The properties of the field object can also be used as options in the field name command. For example, the name property has several sub-properties, which are used as follows

     getfieldattribute("P[Pushbutton attributes]", {"name.icon":"fbuttonicon", "name.tip":"fbuttontip", "name.label":"fbuttontext"});

    Learn more about getfieldattribute() on SAP Screens.