Author Topic: Displaying Selected Table Row details in a Pop-up window  (Read 6727 times)

Ashfaq Ahmed

  • Administrator
  • Newbie
  • *****
  • Posts: 32
    • View Profile
Displaying Selected Table Row details in a Pop-up window
« on: February 05, 2021, 02:54:11 AM »
Purpose: To Display the Selected SAPGUI Table Rows Details Associated to Particular Columns in a Pop-up Window Liquid UI WS.

-Because accessing the Row Details of the Table which are at the Extreme end is only possible through scrolling which is generally a tedious process.

-We can also display multiple table row details in a Pop-up Window.

Example:
Please follow the Steps below.

Step-1 : Create a script file "SAPMV45A.E4001.sjs" with the following code and save it in your WS scripts directory as configured in "guixt.sjs"  file.

Liquid UI Code

///////////////////////////////////////////////SAPMV45A.E4001.SJS///////////////////////////////////////////////

//Design Script
pushbutton([TOOLBAR], "@0P@Display Row Data..",{"process":DisplayRowData});

//function to fetch the Selected Table Row and store it in the Respective Array.
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);
      }       
    }
 }

Step-2 : Create another script file "RSM_ALV_NEW_E2000.sjs" with the following code and save it in your WS scripts directory which is configured in "guixt.sjs" file.

///////////////////////////////////////////////RSM_ALV_NEW_E2000.SJS///////////////////////////////////////////////

//Design Screen
clearscreen();
title('Displaying Selected Row Details', {"size":[1,10]});
del('P[Generate]');
del('P[End Session]');
del('P[Delete Session]');
del('P[Continue]');
text('P[Cancel]',"@2O@");
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});

//Creating the Inputfields
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});
}

//Displaying the array values in inputfields
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]);
}

Step-3 : Goto the Transaction VA02, Enter the Order Number and Click on the Enter Button.

Step-4 :Select the Rows of the "All items" Table and Click on the "DisplayRowData" TOOLBAR Pushbutton.

Step-5 : It will display the Selected Row Details Row Details Associated to Particular Columns in a Pop-up Window.


Refer to the Attachment for further Reference...