Author Topic: Reading Data from File to Textbox  (Read 4450 times)

Sai Siddhartha

  • GuiXT Forum
  • Newbie
  • *
  • Posts: 47
    • View Profile
Reading Data from File to Textbox
« on: December 14, 2017, 08:15:00 AM »
Purpose:
To read data from file into a textbox on SAPGUI.

Liquid UI Code:
////////////////////////// SAPLSMTR_NAVIGATION.E0100.sjs //////////////////////////

del("X[IMAGE_CONTAINER]"); // deletes image
textbox([2,1], [8,117], { "name":"z_textbox", "textfont":"Arial", "textheight":"12", "textweight":"5"}); // textbox
pushbutton([TOOLBAR],'Copy from File','?',{'process':z_readfile}); // triggers function on click

function z_readfile(){
// filename specifies the file in use
     openfile('filename.ext'); // command opens specified file
NEXT_LINE_READ:
     readfile('filename.ext',{"z_content":true}); // read file data into variable
     if(isBlank(z_content)){  // condition to exit loop
         println("<<<<<<<<<<<<<<GOING END>>>>>>>>>>>>>>"); 
         goto END;
      }
     copytext({"fromstring":"z_content","totext":"z_textbox", "appendline":true}); //copy data from variable to textbox
     goto NEXT_LINE_READ;
END:   
     closefile('filename.ext');  //close opened file
}

Note: File with data to be read should be available in the specified path.
         Filename is case sensitive.


See attachment for more screenshots
« Last Edit: December 20, 2017, 03:35:34 PM by Rahul Gera »