Saturday, April 14, 2012

Export data into an Excel File using escript


In fact, there are different ways to export a excel file from Siebel. Anyway, this time, let’s focus on using scripting as a tool to extract accurate information from Siebel, which is also easy to implement through COMCreateObject.

 First of all, let me say, that in the most cases are no need of adding lots of scripting in Siebel. In other words,   be aware of a “out-of-the-box” solution instead of code, for many reasons well known, such as reduce maintenance cost, easier way to upgrade, and so on.

After said this, here’s a list detailed step by step the most common points, which you would do well to follow:

  • Create the Application Object: 
          COMCreateObject("Excel.Application")
  • Make Excel visible through the Application Object:
          ExcelApp.Visible = true;
  • Open a File using the Open Method on the Application Object:
          ExcelApp.WorkBooks.Open(fileName);
  • Insert data in a concret Cell:
          ExcelApp.ActiveSheet.Cells(1,1).Value = "Value:";
  • Close Excel using Quit Method on the Application Object:
          ExcelApp.Application.Quit();





Once implemented, we could use the business service simulator to invoke Write_To_Excel method, so navigate to Administrator – Business Service > Simulator:




Finally, as a result, bellow it’s shown that we fill data into worksheet cells from three different sheets:



Hope it helps!
Arreveure.
Joan.


Usefull expressions:

=SIERROR(CONSULTAV(D3;A:A;1;FALSO);0)