Author Topic: Extract Numbers from a SAP Message  (Read 4022 times)

Benjamin Dasari

  • GuiXT Forum
  • Newbie
  • *
  • Posts: 95
    • View Profile
Extract Numbers from a SAP Message
« on: February 18, 2016, 04:15:02 PM »
Purpose:
To strip numbers from a Standard SAP message and use it as required. 

Liquid UI Code:

function testFunction(){   
   myarr = [];
   mymsg = 'The order 123021213 is saved and 542321 updated';   // Sample message
   var res = mymsg.match(/[-+]?[0-9]*\.?[0-9]+/g);
   myarr = res.toString().split(',');   // Store the numbers in an array
   
   for(var idx=0;idx<myarr.length;idx++){
      set('V[z_num&V[idx]]',myarr[idx]);
   }   
}

del('X[IMAGE_CONTAINER]');         // Delete ActiveX control on SAP Easy Access
inputfield([1,1],"Order Number", [1,15], {"name":"z_num0", "size":"15", "readonly":true});
inputfield([2,1],"Deliv. Number", [2,15], {"name":"z_num1", "size":"15", "readonly":true});
pushbutton([TOOLBAR],'Execute','?',{'process':testFunction});   // Function Call


See attachments for code samples!
« Last Edit: February 18, 2016, 04:16:41 PM by Benjamin Dasari »