Liquid UI - Documentation - 13.19 Add input field Values to SAP Table

13.19 Add input field Values to SAP Table


Prerequisites

Purpose

The article is a demonstration of how to add input field values to an SAP table using a push button, focusing on the Change Sales Order: Initial Screen. Here, we’ll perform the following actions:

  1. Navigate to VA02 Screen and delete the group box
  2. Add comments to describe the input field values
  3. Add input fields to enter the values
  4. Add a push button to execute the process
  5. Add a function to set the values to the SAP table

User Interface

//Create the file SAPMV45A.0102.sjs inside your scripts folder for customizing the Change Sales Order: Initial Screen
//Now, add the Liquid UI script to the above file and save it.

Customization

  1. Log in to SAP, navigate to Change Sales Order: Initial Screen, and delete the Search Criteria group box using del().
     
    //Deletes Search Criteria group box
    del("G[Search Criteria]");
    
     
     
  2. Add comments labeled Item, Material, Order Quantity, and Plnt to describe the input field values.
     
    //Creates comments to let the user know the values
    comment([4,2], ["Item   Material        Order Quantity  Plnt"]);
    
     
     
  3. Add four input fields with no labels to enter the order-related values.
     
    //Creates input fields to enter the values
    inputfield([5,2], {"name":"z_va02_item", "size":6,"nolabel":true});
    inputfield([5,9], {"name":"z_va02_mat", "size":15,"nolabel":true});
    inputfield([5,25], {"name":"z_va02_qty", "size":15,"nolabel":true});
    inputfield([5,41], {"name":"z_va02_plnt", "size":4,"nolabel":true});
    
     
     
  4. Add a push button labeled Add Values To SAP Table to execute addValuesToSAPtable process on click.
     
    //Creates a push button to execute the process
    pushbutton([2,59],["Add Values To SAP Table"],{"process":addValuesToSAPtable});
    
     
     
  5. Add the addValuesToSAPtable function to add values to the SAP table.
     
    //Function to add values to the SAP table
    function addValuesToSAPtable(){
       onscreen "SAPMV45A.0102"
          enter();
       onscreen "SAPMSDYP.0010"
          enter();
       onscreen "SAPMV45A.4001"
          var absrow = 1;
          var relrow = 1;
          
       NEW_SCREEN:;  
       
          enter("/scrolltoline=&V[absrow]", {"table":"T[All items]"});
       onscreen "SAPMV45A.4001"
          relrow = 1;
    
          gettableattribute("T[All items]", {"firstvisiblerow":"FVisRow", "lastvisiblerow":"LVisRow", "lastrow":"LRow"});
       NEW_ROW:;
    if(absrow > LVisRow){ goto NEW_SCREEN; } if(absrow > LRow){ goto END_OF_TABLE_SCROLL; }
    relrow++; absrow++; goto NEW_ROW; END_OF_TABLE_SCROLL:;
    //Adding input field values to the All items table set("cell[All items,Item,&V[relrow]]","&V[z_va02_item]"); set("cell[All items,Material,&V[relrow]]","&V[z_va02_mat]"); set("cell[All items,Order Quantity,&V[relrow]]","&V[z_va02_qty]"); set("cell[All items,Plnt,&V[relrow]]","&V[z_va02_plnt]");
    //It clears the values in the inputfield set('V[z_*]',''); enter('/11');
    //It navigates to VA02 screen if there is an error onerror message(_message) enter('/nva02') }

SAP Process

  1. Refresh the SAP screen, input values, and click Add Values To SAP Table push button to add values to the All items table, as shown in the image below.
     
     

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