Liquid UI - WS Reference Library

pushbutton()


Purpose

With pushbutton(), you can work on the action-event principle.

A pushbutton on click, trigger an event. You can assign events such as, invoking a SAP transaction, passing variables, calling functions, menu options and so on. You can also use a pushbutton to modify action/events.


Syntax 

Based on the location of the pushbutton, the command syntax varies:

  • On SAP Toolbar
    pushbutton([TOOLBAR],"Label name","/n[tcode]",{"separator":true});
  • On SAP screen
    pushbutton([startrow,startcol],"Label name","/n[tcode]",{"process":process_name,"using":{"param1":"value"}});


Properties

  • startrow,startcol - row & column co-ordinates
  • Label name - label on pushbutton
  • @0Y@Label name - name of the field with icon
  • @4V\\Qlabel Tip@Label name - name of the field with tool tip and icon

Note: Location specified with in pushbutton means location of pushbutton on SAP screen. For Example TOOLBAR, Status Bar.


Available Options

You can use the following options with the pushbutton:

"fcode/tcode":".."

Launches a transaction or function when pushbutton is click.

"process":".."

Calls the process.

"size":".."

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

"TOOLBAR":".."

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

"using":".."

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


Options Detail

fcode/tcode

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

  2.  pushbutton([1,0],"New GR for FG ","/Nva01",{"size":[2,15]});
  3. As per the code, when the user clicks on pushbutton, the "va01" transaction code is executed and navigates to Create Standard Order screen.

process

  1. The Process option either launch or executes a function.

  2. pushbutton([TOOLBAR],"GO TO VA02","?",{"process":navigateVA02});
    
  3. As per the code, "GO TO VA02" pushbutton is created. The process in this code is executed when the button is clicked. When user clicks the Go TO VA02 pushbutton, it navigates to the " VA02" transaction.

size

  1. The size option sets the size of the pushbutton.

  2. pushbutton([1,10],"@3H@Profitability Analysis",{"size":[1,20]});
    
  3. As per the code the size of the pushbutton holds 1 row and 20 columns positioned at [1,10].

TOOLBAR

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

  2. pushbutton([TOOLBAR],"@0G@Back","/3"); 
  3. As per the code "Back" pushbutton is created on the toolbar.

using

  1. To pass values to processes called by pushbuttons.

  2. pushbutton([1,0],"TSFR From LOC to LOC","/nmb1b",{"process":mb1bShowScreen,"size":[2,31],"using":{"screen_number":1}});
  3. As per the code, the using option passes values to the processes "mb1bshowscreen" through pushbutton.
  4. With using option, we can also pass multiple parameters with pushbutton.
  5. pushbutton([1,10],"TEXT LABEL","/nva01",{"process":inputfunction,"using":{'label1':z_guixt_var1,'label2':z_guixt_var2}});
    
  6. As per the code, the using option passes multiple values to "va01" through TEXT LABEL pushbutton.


Example

The following example demonstrates the usage of 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


Tips and Tricks

    • Toggle Layout using a Pushbutton

      This example uses a pushbutton to toggle the layout of a screen

      pushbutton([TOOLBAR],"@BG@Switch To SAP","?",{"process":toggleLiquidUI});

      Learn more about Toggle Layout using a Pushbutton.

    • Pass values between sessions

      Values can be passed between sessions as a parameter by using "using" option.

      pushbutton([TOOLBAR],"Pass Values","/oiw31",{"process":open_new_session,"using":{"z_order_type":"PM01"}});

      Learn more about Pass values between sessions using pushbutton.

    • Liquid UI: The "using" Option

      The “using” option is very useful when calling processes. It allows variables to be passed to functions.

      pushbutton([0,35],"Enter",{"process":displayMessage,"using":{"name":"&V[z_name]"}});

      Learn about Using Option with pushbutton.

    • Using pushbutton to Change the Directory

      Pushbuttons are used to change the current directory. This means the location where the LiquidUI will look for the scripts will change when the button is clicked.

      pushbutton([4,38],"BACK",'/nsession_manager/d1='+dirMain,{'size':[1,33]});

      Learn more about Using pushbutton to Change the Directory.

    • Dynamic execution of functions using pushbutton

      Pushbuttons can also run a process dynamically based on function name. This means function names can be varied based on the variable value.

      pushbutton([TOOLBAR],"RFC Test",{'"process":['RFCTestFunc&V[z_name]']});

      Learn more about Dynamic execution of functions using pushbutton.

    • Fcodes in Pushbutton

      The function keys are used as an option in pushbutton. Navigate to /nva01 transaction and execute the following code:

      pushbutton([12,18],"Move Back","/3");

      By pressing the pushbutton /3 will be executed. The /3 is the fcode for back button. It navigates the user to SAP Easy Access screen.