Liquid UI - Documentation - 10.08 Get last executed function code using _last_fcode

10.08 Get last executed function code using _last_fcode


Prerequisites


Purpose

Learn how to use the _last_fcode system variable to return the last executed function code for which the client has processed. The following example demonstrates the value of the ‘_last_fcode’ printed on the Cornelius window.

 
Note: Available from WS Version 1.2.295.0 and Liquid UI Server Version 3.5.522.0 onwards.
 
  1. Add a toolbar pushbutton to call the function
  2. Add the lastfcode function to capture the last executed function code

 

//Create this file inside your script folder for customizing SAP Easy Access screen SAPLSMTR_NAVIGATION.E0100.sjs

 //Now, let's start adding the Liquid UI script to the above file and save it.

  1. Logon to SAP and delete the image container using the del command on the SAP Easy Access screen, as shown below.
     
    // Deletes an image container on the easy access screen
    del("X[IMAGE_CONTAINER]");
     

     
  2. Add a toolbar pushbutton with the label _last_fcode -Test to call the function lastFcode when clicked.
     
    //Creates a pushbutton that executes a process lastfcode on click. 
    pushbutton([TOOLBAR], "_last_fcode - Test",'/nVA02', {"process":lastFcode});        
    
     

     
  3. Add a lastfcode function to capture the last executed function code in the _last_fcode system variable. The value of the ‘_last_fcode’ is displayed on the Cornelius window.
     
    //function to capture the last executed function code in the '_last_fcode' system variable. 
    function lastFcode(){
    onscreen 'SAPMV45A.0102'
    set('F[Order]','5004');
    println('\nThe last fcode is:'+_last_fcode+':\n');
    enter();

    onscreen 'SAPMSDYP.0010'
    println('\nThe last fcode is:'+_last_fcode+':\n');
    enter();

    onscreen 'SAPMV45A.4001'
    set('V[z_va02_ponum]','&F[PO Number]');
    println('\nThe last fcode is:'+_last_fcode+':\n');
    enter('=T\\03');

    // Change Rush Order 5004: Overview
    onscreen 'SAPMV45A.4001'
    println('\nThe last fcode is:'+_last_fcode+':\n');
    enter('/6');

    // Display Customer: General Data
    onscreen 'SAPMF02D.7000'
    println('\nThe last fcode is:'+_last_fcode+':\n');
    enter('=TAB04');

    // Display Customer: General Data
    onscreen 'SAPMF02D.7000'
    println('\nThe last fcode is:'+_last_fcode+':\n');
    enter('/3');

    // Change Rush Order 5004: Overview
    onscreen 'SAPMV45A.4001'
    println('\nThe last fcode is:'+_last_fcode+':\n');
    enter('/3');

    // Change Sales Order: Initial Screen
    onscreen 'SAPMV45A.0102'
    println('\nThe last fcode is:'+_last_fcode+':\n');
    enter('/n');

    onscreen 'SAPLSMTR_NAVIGATION.0100'
    println('\nThe last fcode is:'+_last_fcode+':\n');
    enter('?');
    }


     


SAP Process

  1. Now, refresh the SAP screen, and click on the _last_fcode-Test toolbar pushbutton to view the value of the '_last_fcode' in the Cornelius window, as shown in the image below.
     
     

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