Author Topic: Liquid UI: Table Scroll  (Read 5510 times)

chirag.amin@guixt.com

  • GuiXT Forum
  • Newbie
  • *
  • Posts: 34
    • View Profile
Liquid UI: Table Scroll
« on: January 26, 2016, 03:11:42 PM »
Basic example of Table Scroll using VA02/VA03.

LiquidUI Code:

//////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Author: Synactive, Inc. [1065 E. Hillsdale Blvd, Foster City, CA, 94404, USA]
// Email: support@guixt.com; sales@guixt.com;
// Contact: 650.341.3310
// Version: 1.0.0.0
//////////////////////////////////////////////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////////////////////////////////////////////////
// DESIGN
//////////////////////////////////////////////////////////////////////////////////////////////////////////////

onUIEvents['Enter']={"process":va03_execute};

del("G[Search Criteria]");

pushbutton([TOOLBAR], "Reset", "?", {"process":clearValues});

box([4,0], [10,40], "Sales Order Data");
inputfield([5,2],"Standard Order",[5,17], {"size":10, "readonly":true, "name":"z_va03_standard_order"});
inputfield([6,2],"Sold-to Party",[6,17], {"size":10, "readonly":true, "name":"z_va03_sold_to"});
inputfield([7,2],"Ship-to Party",[7,17], {"size":10, "readonly":true, "name":"z_va03_ship_to"});
inputfield([8,2],"PO Number",[8,17], {"size":22, "readonly":true, "name":"z_va03_po_number", "maxlength":35});
inputfield([9,2],"PO date", [9,17], {"size":10, "readonly":true, "name":"z_va03_po_date"});

// Initialize z_item_toal
if(!z_item_toal){
   z_item_toal = 0;
}

// Use z_item_toal to dynamically create the box size and run the for loop
box([4,42], [6+z_item_toal,90], "All items");
for(i=1; i<z_item_toal; i++){
   inputfield([5+i,44], {"nolabel":true, "readonly":true, "size":6, "name":"z_va03_item_&V"});
   inputfield([5+i,52], {"nolabel":true, "readonly":true, "size":18, "name":"z_va03_desc_&V"});
   inputfield([5+i,72], {"nolabel":true, "readonly":true, "size":15, "name":"z_va03_mat_&V"});
}


//////////////////////////////////////////////////////////////////////////////////////////////////////////////
// FUNCTIONS
//////////////////////////////////////////////////////////////////////////////////////////////////////////////

// This function clears all variables we use, triggered on the pushbutton "Reset"
function clearValues(){
   set("V[z*]", "");
}

// This function will go to the next screen, grab the data and come back to the initial Sales Order screen
function va03_execute(){
   // Use an onmessage to capture any error the user may enter
   onmessage
      if(_message.substring(0,2)=="E:"){
         message(_message);
         enter("?");
         goto FUNC_END;
      }
      else{
         enter();    // In case there is a warning message
      }
      
      
      onscreen 'SAPMV45A.4001'
         // Grab the Sales Order Data
         set("V[z_va03_standard_order]","&F[Standard Order]");
         set("V[z_va03_sold_to]","&F[Sold-to party]");
         set("V[z_va03_ship_to]","&F[Ship-to party]");
         set("V[z_va03_po_number]","&F[PO Number]");
         set("V[z_va03_po_date]","&F[PO date]");
         
         // Table Scroll begins here   
         absrow = 1;
         relrow = 1;
         z_item_toal = 0;
         
         // Fetch the table attributes
         gettableattribute("T[All items]", {"firstvisiblerow":"FVisRow", "lastvisiblerow":"LVisRow", "lastrow":"LastRow"});
new_screen:;
         // Scroll to the absolute row
         enter("/ScrollToLine=&V[absrow]", {"table":"T[All items]"});
         
      onscreen 'SAPMV45A.4001'
         // Refetch table attributes, in case they might of changed
         gettableattribute("T[All items]", {"firstvisiblerow":"FVisRow", "lastvisiblerow":"LVisRow", "lastrow":"LastRow"});
         // Reset the relevant row
         relrow = 1; // reset the relative row with a new screen
new_row:;
         if(absrow>LVisRow){
            // end of the screen?
            goto new_screen;
         }
         if(absrow>LastRow){
            // end of the table?
            goto end_of_table;
         }
         
         // Grab the values we want from the row
         set("V[z_va03_item_&V[absrow]]","&cell[All items,Item,&V[relrow]]");
         set("V[z_va03_desc_&V[absrow]]","&cell[All items,Description,&V[relrow]]");
         set("V[z_va03_mat_&V[absrow]]","&cell[All items,Material,&V[relrow]]");
         
         // Increment out counters
         z_item_toal++;
         absrow++;
         relrow++;
         goto new_row;
         
end_of_table:;
         // Scroll back to the top of the table
         enter("/ScrollToLine=1", {"table":"T[All items]"});
         
      onscreen 'SAPMV45A.4001'
         // Go back to the initial screen
         enter("/3");
FUNC_END:;
}



See attachments