Liquid UI - Documentation - 5.08 pushbutton()

5.08 pushbutton()


Purpose

With pushbutton(), you can create and modify pushbuttons within an SAP screen or the toolbar. It’s based on the action-event principle, which means a click action triggers an event. You can assign events such as invoking an SAP transaction, passing variables, calling functions, and so on. With OK code introduction, you can execute a transaction by just using the code in the pushbutton command, instead of processing a function when you click the pushbutton.

Pushbuttons are one of the most useful and powerful screen elements of WS in SAP. This command is used to create, modify, and link pushbuttons to other actions in SAP. For instance, you can program a pushbutton to navigate to other transactions or access menu functions.

 
Note: You can specify the position of the pushbutton in different ways. Learn more about positioning the screen elements.
 


Syntax

You can create pushbuttons at desired location with the required functionalities using the following formats.

Format 1: Adds a pushbutton with the label name at the row and column specified on the SAP screen.

pushbutton([row,col],"label name",{"options":values}); 
 

Format 2: Adds a pushbutton with the label name at the row and column specified and executes the function code/transaction code/function key.

pushbutton([row,col],"label name","/n[tcode]",{"options":values});
pushbutton([row,col],"label name","fcode",{"options":values});
pushbutton([row,col],"label name","fkey",{"options":values});
pushbutton([row,col],"label name","fcode","fkey",{"options":values});
 

Format 3: Adds a pushbutton that will add scan functionality for the designated field.

pushbutton([row,col],"label name","/_gala_scan,?,z_scan_inputfield",{"options":values});
 

Format 4: Adds a pushbutton with an icon, label name, and quick info text. Here ID refers to Icon and the tooltip displays the quick info text.

pushbutton([row,col],"@ID\\Qtooltip@labelname",{"options":values});
 

Format 5: Adds a pushbutton on the toolbar with the label name.

pushbutton([TOOLBAR],"label name",{"options":values}});
 

Format 6: Adds a pushbutton with respect to the other screen element at the row and column specified on the SAP screen.

pushbutton("F[screen element]+[row,col]","label name",{"options":values});
 
Note: You can also create a pushbutton with various options, as explained in detail below.


Properties

  • startrow, startcol - row & column co-ordinates
  • label name - label on pushbutton
  • @iconID@label name - name of the field with icon
  • @iconID\\Qlabel Tip@Label name - name of the field with tooltip and icon
  • /n[tcode] - executes a transaction code
  • fcode - executes a function code
  • fkey - executes a function key
  • /_gala_scan,?,variable - enables scan functionality to the designated field
  • screen element - field name
 
 
Note: Location specified within pushbutton means the location of a pushbutton on SAP screen. For Example, TOOLBAR and Status Bar.


Available Options

You can use the following options with the pushbutton:

"disabled":".."

Disables pushbutton on the screen.

"eventid":".."

"eventid": value - Assigns a value to the pushbutton. You can retrieve this value using _eventid system variable.

"fcode/tcode":".."

Launches a transaction or function when the pushbutton is click.

"process":".."

Calls the process.

"size":".."

"size":[rows,cols] - Specifies the size of the pushbutton in rows and columns.

"separator":".."

"separator":true - This option is used in conjunction with the toolbar option. Adds a small vertical line that separates the pushbutton created from the existing ones on the toolbar.

"TOOLBAR":".."

Places the pushbutton on the toolbar of a given SAP screen.

"using":".."

"using":{"param1":"value","param2":"value"…} - Passes values to processes.


Options Detail

disabled

  1. This option allows you to disable the pushbutton on the screen.

     
  2. pushbutton([18,36], "@0Y@Create Quotation", "/nva21", {"disabled":true,"process":va0xCreateOrderOrQuote});
    
     
     
  3. As per the code, the pushbutton gets disabled i.e., you cannot trigger any process on click.

eventid

  1. This option enables you to assign event value to the pushbutton.

     
    pushbutton([2,4],"Get Order Details",{"eventid":"order"});
    pushbutton([2,29],"Get Material Details",{"eventid":"material"});
    
     
     
  2. As per the code, a related popup message is displayed when the user clicks on the pushbutton.

Learn more about the Display event performed using the eventid option of the pushbutton.

fcode/tcode

  1. This option executes function code (user defined functions/pre-defined functions) or transaction codes.

  2.  pushbutton([0,0],"ME56 - Read List Data","/nME56",{"process":readListData});
     
     
  3. As per the code, when the user clicks on the "Read List Data" pushbutton, all the material data is displayed in the input fields.

process

  1. This option executes a function.

  2. pushbutton([7,7],"@01@Read Data","?",{"process":validateRequiredData});
    
     
     
  3. As per the code, the "Read Data" pushbutton is created. The process in this code is executed when the button is clicked.

size

  1. This option allows you to set the size of the pushbutton.

  2. pushbutton([1,1],"@2V@Sales Orders",'/nsession_manager/d1='+dirSalesOrders,{"size":[2,20]});
    
     
  3. As per the code, the size of the pushbutton holds 2 rows and 20 columns positioned at [1,1].
     

TOOLBAR

  1. This option will place a pushbutton on the toolbar on a given SAP screen. The size is not required for a pushbutton on the toolbar.

  2. pushbutton([TOOLBAR],"@F8@Sales and Distribution Interface",{"process":va0xScreenLayout, "using":{"screen":"SD"}}); 
     
     
  3. As per the code, the "Sales and Distribution Interface" pushbutton is created on the toolbar.

using

  1. To pass values to processes called pushbuttons.

  2. pushbutton([3,0],"Pad Value","/nva01",{"process":padValueWithChar, "using":{"mychar":"0"}}});
     
     
  3. As per the code, the using option passes values to the processes through the pushbutton.
     
  4. With using the option, you can also pass multiple parameters at a time.
    pushbutton([3,0],"Pad Value","/nva01",{"process":padValueWithChar, "using":{label1':z_guixt_var1,'label2':z_guixt_var2}}});
    
     


Example

The following example demonstrates the usage of the pushbutton command:


Script

pushbutton([4,6],"Create Sales Order","/nva01");
pushbutton([4,28],"Create New Material","/nmm01");
pushbutton([10,20],"@4D\\QCreate a Std. Sales Order@Std. Sales Order",{"process":va01_process,"size":[2,24],"using":{"z_va01_ordertype":"OR"}});

Script Details


Execute transaction with Ok code:

Now, you can skip the initial transaction screen, and execute the transaction by assigning fixed values to the initial transaction screen. This can be achieved by using OK code, a built-in feature in SAP-GUI, instead of calling a function attached to the pushbutton. Additionally, you can add quick info for each pushbutton with button size. Also, you can incorporate the pushbuttons in the standard toolbar, and a function key will be assigned automatically.

On the SAP Toolbar, the syntax is written as:

  1. This Executes in the same session:

    This syntax for OK code allows you to navigate to IW31 and set AUFPAR-PM_AUFART=PM02; CAUFVD-IWERK=1000; when you click on the pushbutton.

    pushbutton([TOOLBAR],"Create Work Order (IW31)","{/nIW31 AUFPAR-PM_AUFART=PM02; CAUFVD-IWERK=1000});
  2. This executes in a new session:

    This syntax for OK code will perform the same action in the new session and navigate to IW31.

    pushbutton([TOOLBAR],"Create Work Order (IW31)","{/OIW31 AUFPAR-PM_AUFART=PM02; CAUFVD-IWERK=1000});


Tips and Tricks

  • Delete pushbuttons from the toolbar using del("P[pushbutton_name]");
  • Add a tooltip to an existing pushbutton using tip("P[pushbutton_name]","Tip goes here");.
  • Adds new toolbar pushbuttons on the right-hand side. They are also displayed in the function key overview window (right mouse button). Here the order corresponds to the assigned function keys.
  • You can use a combination of function keys with the Ctrl and Shift keys or use numbers between 13 and 48.
    Shift = +12
    Ctrl = +24
Shift+F1 /13 Ctrl+F1 /25 Shift+Ctrl+F1 /37
Shift+F2 /14 Ctrl+F2 /26 Shift+Ctrl+F2 /38
Shift+F3 /15 Ctrl+F3 /27 Shift+Ctrl+F3 /39
Shift+F4 /16 Ctrl+F4 /28 Shift+Ctrl+F4 /40
Shift+F5 /17 Ctrl+F5 /29 Shift+Ctrl+F5 /41
Shift+F6 /18 Ctrl+F6 /30 Shift+Ctrl+F6 /42
Shift+F7 /19 Ctrl+F7 /31 Shift+Ctrl+F7 /43
Shift+F8 /20 Ctrl+F8 /32 Shift+Ctrl+F8 /44
Shift+F9 /21 Ctrl+F9 /33 Shift+Ctrl+F9 /45
Shift+F10 /22 Ctrlt+F10 /34 Shift+Ctrl+F10 /46
Shift+F11 /23 Ctrlt+F11 /35 Shift+Ctrl+F11 /47
Shift+F12 /24 Ctrlt+F12 /36 Shift+Ctrl+F12 /48


Usage Details


Can't find the answers you're looking for?