Liquid UI - Documentation - 13.14 Displaying selected SAP table row details in a pop-up window

13.14 Displaying selected SAP table row details in a pop-up window


Prerequisites

Purpose

This article demonstrates how to display the column data of a selected table row inside the pop-up window, using the Change Standard Order (VA02) screen as a guide.

  1. Include a push button.
  2. Implement data fetching/display function.
  3. Delete existing pop-up elements.
  4. Modify title.
  5. Remove default push buttons.
  6. Add input fields for key values.
  7. Create input fields as needed.
  8. Assign values.
  9. Create input fields based on selected rows.
  10. Assign array values to input fields.

User Interface

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

Customization

  1. Insert a Display Row Data toolbar push button. When clicked, this button will execute the DisplayRowData process.
     
    // Creates a push button to execute the process
    pushbutton([TOOLBAR], "@0P@Display Row Data..",{"process":DisplayRowData});
    
     
    Display Row Data button runs DisplayRowData process on click
     
  2. Add DisplayRowData function to fetch selected row values.
     
    // Function to fetch row values
    function DisplayRowData(){
       z_matarray=[];
       z_pricingdatearray=[];
       z_billingdatearray=[];
       z_itemarray=[];
       z_accassigngrparray=[];
       z_quantity=[];
       enter("/o");
       gettableattribute("T[All items]", {"firstvisiblerow":"FVisRow", "lastvisiblerow":"LVisRow", "lastrow":"LastRow","selectedrows":"SelRows"});
       for(i=0;i<LastRow;i++){
       ROW_NUMBER = i;
          if(SelRows[ROW_NUMBER]=="X"){
             // adding 1 as SelRows is array which has index begin from 0
             selected_row_number = ROW_NUMBER+1;
             set("V[z_item]","&cell[All items,Item,"+(selected_row_number)+"]");
             z_itemarray.push(z_item);
             set("V[z_material]","&cell[All items,Material,"+(selected_row_number)+"]");
             z_matarray.push(z_material);
             set("V[z_pricingdate]","&cell[All items,Pricing date,"+(selected_row_number)+"]");
             z_pricingdatearray.push(z_pricingdate);
             set("V[z_billingdate]","&cell[All items,Billing Date,"+(selected_row_number)+"]");
             z_billingdatearray.push(z_billingdate);
             set("V[z_accassigngroup]","&cell[All items,VBAP-KTGRM,"+(selected_row_number)+"]");
             z_accassigngrparray.push(z_accassigngroup);
       	set("V[z_compquantity]","&cell[All items,Component quantity,"+(selected_row_number)+"]");
             z_quantity.push(z_compquantity);
          }
        }
     }
    
     
  3. //Create the file RSM04000_ALV_NEW.E2000.sjs inside your scripts folder for customizing the sessions-related popup window
    //Now, add the Liquid UI script to the above file, and save it.

    Delete the existing elements from the popup window using clearscreen().
     
    // Deletes all existing elements on the popup
    clearscreen();
    
     
    Deletes existing elements from pop-up window
     
  4. Modify the title of the popup window.
     
    // Sets a new title for the popup window
    title('Displaying Selected Row Details', {"size":[1,10]});
    
     
    Modified the title of pop-up window
     
  5. Delete the existing Generate, End Session, Delete Session, and Continue push buttons from the pop-up window.
     
    // Deletes existing push buttons on the popup window
    del('P[Generate]');
    del('P[End Session]');
    del('P[Delete Session]');
    del('P[Continue]');
    
     
    Removes push buttons from the pop-up window
     
  6. Display the key values by adding six input fields, labeled Item, Material, PricingDate, BillDate, AccountAssignGrp, and Quantity.
     
    // Adds six input fields with default values
    inputfield([0,0],{"size":5, "intensified":true, "nolabel":true, "default":"Item", "readonly":true});
    inputfield([0,6],{"size":11, "intensified":true, "nolabel":true, "default":"Material", "readonly":true});
    inputfield([0,18],{"size":11, "intensified":true, "nolabel":true, "default":"PricingDate", "readonly":true});
    inputfield([0,30],{"size":11, "intensified":true, "nolabel":true, "default":"BillDate", "readonly":true});
    inputfield([0,42],{"size":11, "intensified":true, "nolabel":true, "default":"AccountAssignGrp", "readonly":true});
    inputfield([0,54],{"size":5, "intensified":true, "nolabel":true, "default":"Quantity", "readonly":true});
    
     
    Removes push buttons from the pop-up window
     
  7. Add a statement to create input fields based on selected rows.
     
    // Creates input fields based on the selected rows
    for(j=0;j<z_matarray.length;j++){
    inputfield([j+1,0],{"size":5,"name":"z_item_&V[j]","nolabel":true,"readonly":true});
    inputfield([j+1,6],{"size":11,"name":"z_matarray_&V[j]","nolabel":true,"readonly":true});
    inputfield([j+1,18],{"size":11,"name":"z_pricingdate_&V[j]","nolabel":true,"readonly":true});
    inputfield([j+1,30],{"size":11,"name":"z_billingdate_&V[j]","nolabel":true,"readonly":true});
    inputfield([j+1,42],{"size":11,"name":"z_accassigngrp_&V[j]","nolabel":true,"readonly":true});
    inputfield([j+1,54],{"size":5,"name":"z_quantity_&V[j]","nolabel":true,"readonly":true});
    }
    
     
  8. Add a statement to assign array values to input fields.
     
    // Displays  the array values in input fields
    for(j=0;j<z_matarray.length;j++){
       set("V[z_matarray_&V[j]]",z_matarray[j]);
       set("V[z_billingdate_&V[j]]",z_pricingdatearray[j]);
       set("V[z_pricingdate_&V[j]]",z_billingdatearray[j]);
       set("V[z_item_&V[j]]",z_itemarray[j]);
       set("V[z_accassigngrp_&V[j]]",z_accassigngrparray[j]);
       set("V[z_quantity_&V[j]]",z_quantity[j]);
    }
    
     

SAP Process

  1. Go to the VA02 transaction. Enter the Order number and press Enter. On the Overview screen, select the desired rows.
     
    VA02 transaction with Order number entered and rows selected on the Overview screen
     
  2. Now, click on the Display Row Data toolbar push button, and the pop-up window will then appear and display the selected values of the row, as shown in the image below.
     
    Clicking Display Row Data shows a pop-up with selected row values
     

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