Author Topic: Integrating Windows List View Control with SAPGUI  (Read 9280 times)

umang@guixt.com

  • Administrator
  • Newbie
  • *****
  • Posts: 34
    • View Profile
Integrating Windows List View Control with SAPGUI
« on: January 27, 2016, 10:23:25 AM »
The examples demonstrates the ability to embed Windows COM controls within SAPGUI

Liquid UI Scripts

1. User Interface
pushbutton([0,1],"Orders Since","/0" ,{"process":getOrders});
inputfield([0,20],"Date",[0,30],{"name":"z_date","size":"10"});

if (isBlank(Z_SCRN)) {
} else {
   if (Z_SCRN == 'LIST') {
      pushbutton([TOOLBAR],"Start Over","/0" ,{"process":closeOrders});
      box([1,1],[26,62],"&V[z_rowcount] Orders Since: &V[z_date]");

      var listview = new ActiveXObject('COMCTL.ListViewCtrl');
      addToScreen(listview, [2,2], [26,62], "container1");
      listview.View = 3;

      if(listview.ColumnHeaders.Count == 0) {
         listview.ColumnHeaders.Add(1, "colkey1", "Order No");
         listview.ColumnHeaders.Add(2, "colkey2", "PO Date");
         listview.ColumnHeaders.Add(3, "colkey3", "Customer");
         listview.ColumnHeaders.Add(4, "colkey4", "PO Number");
      }

      for (var idx = 0; idx < z_rowcount; idx++) {

         keyid = idx + 1;

         set('V[keynumber]','key&V[idx]'); 
         
         set('V[vbeln]','&V[vbeln_&V[idx]]');
         set('V[bstdk]','&V[bstdk_&V[idx]]');
         set('V[kunnr]','&V[kunnr_&V[idx]]');
         set('V[bstkd]','&V[bstkd_&V[idx]]');

         keyno = parseInt(keyid);
         keynumberjs = keynumber;
         keyvaluevbeln = vbeln;
         keyvaluebstdk = bstdk;
         keyvaluekunnr = kunnr;
         keyvaluebstkd = bstkd;

         listview.ListItems.Add(keyno,keynumberjs, keyvaluevbeln);
         listview.ListItems(keyno).SubItems(1) = keyvaluebstdk;
         listview.ListItems(keyno).SubItems(2) = keyvaluekunnr;
         listview.ListItems(keyno).SubItems(3) = keyvaluebstkd;

      }
   }
}

2. Function to Retrieve data using RFC Call to ABAP function module
function getOrders() {
   var selopt = [];
   var ordersTable = [];

   vmvaa = "VMVAA";
   bstdk = "BSTDK";
   i = "I";
   ge = "GE";
   from = z_date;

   z_queryOption = padString(vmvaa, 30, PADDING_RIGHT, " ");
   z_queryOption += padString(bstdk, 30, PADDING_RIGHT, " ");
   z_queryOption += i;
   z_queryOption += ge;
   z_queryOption += padString(from, 45, PADDING_RIGHT, " ");
   selopt.push(z_queryOption);

   call("Z_S10_SEARCHHELP", {
      "in.SEARCHHELP": "VMVAA", "in.COLUMNS":"VBELN(10),BSTDK(10),KUNNR(10),BSTKD(20)",
      "table.SELOPT": "selopt",
      "table.DATA(width:50)": "ordersTable"
   });

   for (var rowNumber = 0; rowNumber < ordersTable.length; rowNumber++) {
      var result = {
         vbeln: ordersTable[rowNumber].substring(0, 10),
         bstdk: ordersTable[rowNumber].substring(10, 20),
         kunnr: ordersTable[rowNumber].substring(20, 30),
         bstkd: ordersTable[rowNumber].substring(30, 50)
      };
      set("V[vbeln_&V[rowNumber]]", result.vbeln);
      set("V[bstdk_&V[rowNumber]]", result.bstdk);
      set("V[kunnr_&V[rowNumber]]", result.kunnr);
      set("V[bstkd_&V[rowNumber]]", result.bstkd);
   }
    Z_SCRN = 'LIST';
    set('V[z_rowcount]',ordersTable.length);
    return;
}




See attached documents for details
« Last Edit: January 27, 2016, 12:07:16 PM by umang@guixt.com »