Author Topic: Read Grid Selection Data  (Read 2285 times)

Benjamin Dasari

  • GuiXT Forum
  • Newbie
  • *
  • Posts: 95
    • View Profile
Read Grid Selection Data
« on: April 22, 2016, 11:09:01 AM »
Purpose:
To read data from a grid screen based on user selection. On user entry of Plant and clicking the 'Grid Example' pushbutton will take the user to Grid screen to make user selection and read the Status, Total Qty and Delivered Qty fields.

Liquid UI Code:

// SAPLSMTR_NAVIGATION.E0100.sjs
// User Interface - SAP Easy Access Screen
load('grid_functions.sjs');                                                          // Loading functions file
del("X[IMAGE_CONTAINER]");
inputfield( [1,1], "Plant", [1,20], {"name":"z_coois_plant", "size":4});
inputfield( [2,1], "Status", [2,20], {"name":"z_coois_status", "readonly":true, "size":40});
inputfield( [3,1], "Total Qty", [3,20],{ "name":"z_coois_totalqty", "readonly":true, "size":16});
inputfield( [4,1], "Delivered Qty", [4,20],{ "name":"z_coois_delivqty", "readonly":true, "size":16});
pushbutton( [1,26], "Grid Example", {"process":gridExample});


// SAPLCOISOUTPUT.E0100.sjs
// Grid Display Screen
onUIEvents['/2'] = executeGridSelection();                              // When user double clicks on a selection in the first column, the function is executed
if(_transaction == 'COOIS' && z_coois_selection =='X'){
   set('V[z_coois_getselection]','X');
}


// SAPLCOKO1.E0115.sjs
// Grid Details Screen
if(z_coois_getselection == 'X'){
   set('V[z_coois_getselection]','');
   enter('/0',{"process":readGridDetails});
}


// grid_functions.sjs
// Functions File

// Function to take user input and land on grid screen in COOIS transaction
function gridExample(){
   var z_coois_msg = '';
   
   onscreen 'SAPLSMTR_NAVIGATION.0100'
      enter('/ncoois');

   onscreen 'PPIO_ENTRY.1000'
      set('F[S_WERKS-LOW]','&V[z_coois_plant]');               // Production plant
      enter('/8');
      
   onscreen 'SAPMSDYP.0010'
      set('V[z_coois_msg]','&F[MESSTXT1]');
      enter();
   
   onscreen 'PPIO_ENTRY.1000'
      if(z_coois_msg){
         message('E:'+z_coois_msg);
         enter('/n');
         goto FUNC_END;
      }
      enter('?');   
   FUNC_END:;         
}

// Function to set a flag on the Grid Display screen to avoid infinite loop on auto-enter
function executeGridSelection(){
   set('V[z_coois_selection]','X');
}

// Function to read information from Grid Details screen based on user selection on Grid Display
function readGridDetails(){
   onscreen 'SAPLCOKO1.0115'
      set('V[z_coois_status]','&F[CAUFVD-STTXT]');                 // Status
      set('V[z_coois_totalqty]','&F[CAUFVD-GAMNG]');             // Total Qty
      set('V[z_coois_delivqty]','&F[CAUFVD-GWEMG]');            // Deliv. Qty
      enter('/n');
}


See attachments for code samples!
« Last Edit: April 28, 2016, 03:23:46 PM by Benjamin Dasari »