Need to take a value from the csv file and query in a OAF page.

Hello,
I have a requirement to take the list of employee numbers in a csv file and display its corresponding job on the page.
I have created a item 'MessageFileupload' where the user will upload the csv file containing the employee number and a Button 'Display Jobs' which will display the corresponding jobs on the page.
Any idea how to take the values from the csv file and query it?
Regards,
den123.

Hi ,
Check
http://oraclearea51.com/contribute/post-a-blog-article/csv-file-upload-for-oa-framework.html
http://www.roseindia.net/jsp/upload-insert-csv.shtml
Below code works from above blogs.
package xx.oracle.apps.pa.Lab.webui;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
// import java.io.*;
import oracle.apps.fnd.common.VersionInfo;
import oracle.apps.fnd.framework.OAApplicationModule;
import oracle.apps.fnd.framework.OAException;
import oracle.apps.fnd.framework.server.OAViewObjectImpl;
import oracle.apps.fnd.framework.webui.OAControllerImpl;
import oracle.apps.fnd.framework.webui.OAPageContext;
import oracle.apps.fnd.framework.webui.beans.OAWebBean;
import oracle.jbo.domain.BlobDomain;
import oracle.cabo.ui.data.DataObject;
import oracle.jbo.Row;
* Controller for ...
public class deptCsvUploadCO extends OAControllerImpl
  public static final String RCS_ID="$Header$";
  public static final boolean RCS_ID_RECORDED =
        VersionInfo.recordClassVersion(RCS_ID, "%packagename%");
   * Layout and page setup logic for a region.
   * @param pageContext the current OA page context
   * @param webBean the web bean corresponding to the region
  public void processRequest(OAPageContext pageContext, OAWebBean webBean)
    super.processRequest(pageContext, webBean);
   * Procedure to handle form submissions for form elements in
   * a region.
   * @param pageContext the current OA page context
   * @param webBean the web bean corresponding to the region
  public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
    super.processFormRequest(pageContext, webBean);
    // Code Addition Started for CSV upload
    OAApplicationModule am = (OAApplicationModule) pageContext.getApplicationModule(webBean);
    OAViewObjectImpl vo = (OAViewObjectImpl) am.findViewObject("deptCsvVO1");
      //if ("GoBtn".equals(pageContext.getParameter(EVENT_PARAM)))
       if (pageContext.getParameter("GoBtn") != null)
      System.out.println("Button Pressed");
          DataObject fileUploadData =(DataObject)pageContext.getNamedDataObject("FileUploadItem");
          String fileName = null;
          String contentType = null;
          Long fileSize = null;
          Integer fileType = new Integer(6);
          BlobDomain uploadedByteStream = null;
          BufferedReader in = null;
                  try
                  fileName = (String)fileUploadData.selectValue(null, "UPLOAD_FILE_NAME");
                  contentType =(String)fileUploadData.selectValue(null, "UPLOAD_FILE_MIME_TYPE");
                  uploadedByteStream = (BlobDomain)fileUploadData.selectValue(null, fileName);
                  in = new BufferedReader(new InputStreamReader(uploadedByteStream.getBinaryStream()));
                  fileSize = new Long(uploadedByteStream.getLength());
                  System.out.println("fileSize"+fileSize);
                  catch(NullPointerException ex)
                  throw new OAException("Please Select a File to Upload", OAException.ERROR);
                  try{ 
                  //Open the CSV file for reading 
                  String lineReader=""; 
                  long t =0;
                  String[] linetext; 
                  while (((lineReader = in.readLine()) !=null) )
                  //Split the deliminated data and
                  if (lineReader.trim().length()>0)
                  System.out.println("lineReader"+lineReader.length());
                  linetext = lineReader.split(","); 
                  t++;
                  //Print the current line being
                  if (!vo.isPreparedForExecution())
                          vo.setMaxFetchSize(0);
                          vo.executeQuery();
                    System.out.println("Trimmed "+  linetext[1].replace("\"", ""));
                  Row row = vo.createRow();
                  row.setAttribute("Deptno", linetext[0].trim());
                  row.setAttribute("Dname",linetext[1].trim().replace("\"", ""));
                  row.setAttribute("Loc",linetext[2].trim().replace("\"", ""));
                  //row.setAttribute("Column4", linetext[3].trim());
                  vo.last();
                  vo.next();
                  vo.insertRow(row);
                  catch (IOException e)
                        throw new OAException(e.getMessage(),OAException.ERROR);
          //else if (pageContext.getParameter("Upload") != null)
          am.getTransaction().commit();
          throw new OAException("Uploaded SuccessFully",OAException.CONFIRMATION);     
}Thanks,
Jit

Similar Messages

  • How can i get the all values from the Property file to Hashtable?

    how can i get the all values from the Property file to Hashtable?
    ok,consider my property file name is pro.PROPERTIES
    and it contain
    8326=sun developer
    4306=sun java developer
    3943=java developer
    how can i get the all keys & values from the pro.PROPERTIES to hashtable
    plz help guys..............

    The Properties class is already a subclass of Hashtable. So if you have a Properties object, you already have a Hashtable. So all you need to do is the first part of that:Properties props = new Properties();
    InputStream is = new FileInputStream("tivoli.properties");
    props.load(is);

  • Need to set default values for the fields plant and location in ME21N

    Hi All,
    i need to set default values for the fields plant and location in ME21N tcode.
    In accout assignment if we give 'A' then we need to create asset by clicking the Asset tab,there you have the fields plant and location.
    How to resolve this?
    Thanks in Advance

    hi .
    i needed to set default strorage location and plant in personal setting  in me21n.
    i solve it with this way.
    go to program SAPLMEPERS in se38.
    create new function in output with the sample name :MODULE ZTEST_001 OUTPUT.
    in this module write:
    if MEPOITEM_PROP-WERKS is INITIAL and  MEPOITEM_PROP-LGORT is INITIAL.
    MEPOITEM_PROP-WERKS = '1000'.
    MEPOITEM_PROP-LGORT = '0032'.
    endif.
    this is the solution.
    best regards.
    maryam

  • My motherboard went out and I got a new computer and I need to deactivate Pro X from the old system and activate it on the new system.  How is this done?

    My motherboard went out and I got a new computer and I need to deactivate Pro X from the old system and activate it on the new system.  How is this done?

    Hi David ,
    If it is a retail version ,then you need to deactivate it and uninstall it as well from your old computer and then you can install it back on the new computer.
    If it a subscription based software ,then you just need to deactivate it and you can operate the same on your new computer by entering in your credentials .
    For more information ,you can refer to this link.
    https://helpx.adobe.com/x-productkb/policy-pricing/activation-deactivation-products.html
    Regards
    Sukrit Dhingra

  • I have a VI and an attched .txt data file. Now I want to read the data from the .txt file and display it as an array in the front panel. But the result is not right. Any help?

    I have a VI and an attched .txt data file. Now I want to read the data from the .txt file and display it as an array in the front panel. But the result is not right. Any help?
    Attachments:
    try2.txt ‏2 KB
    read_array.vi ‏21 KB

    The problem is in the delimiters in your text file. By default, Read From Spreadsheet File.vi expects a tab delimited file. You can specify a delimiter (like a space), but Read From Spreadsheet File.vi has a problem with repeated delimiters: if you specify a single space as a delimiter and Read From Spreadsheet File.vi finds two spaces back-to-back, it stops reading that line. Your file (as I got it from your earlier post) is delimited by 4 spaces.
    Here are some of your choices to fix your problem.
    1. Change the source file to a tab delimited file. Your VI will then run as is.
    2. Change the source file to be delimited by a single space (rather than 4), then wire a string constant containing one space to the delimiter input of Read From Spreadsheet File.vi.
    3. Wire a string constant containing 4 spaces to the delimiter input of Read From Spreadsheet File.vi. Then your text file will run as is.
    Depending on where your text file comes from (see more comments below), I'd vote for choice 1: a tab delimited text file. It's the most common text output of spreadsheet programs.
    Comments for choices 1 and 2: Where does the text file come from? Is it automatically generated or manually generated? Will it be generated multiple times or just once? If it's manually generated or generated just once, you can use any text editor to change 4 spaces to a tab or to a single space. Note: if you want to change it to a tab delimited file, you can't enter a tab directly into a box in the search & replace dialog of many programs like notepad, but you can do a cut and paste. Before you start your search and replace (just in the text window of the editor), press tab. A tab character will be entered. Press Shift-LeftArrow (not Backspace) to highlight the tab character. Press Ctrl-X to cut the tab character. Start your search and replace (Ctrl-H in notepad in Windows 2000). Click into the Find What box. Enter four spaces. Click into the Replace With box. Press Ctrl-V to paste the tab character. And another thing: older versions of notepad don't have search and replace. Use any editor or word processor that does.

  • How to asssign output value in the CSV file for the specific header

    Hi,
    I am using OpenScript 9.10. The problem I am facing is that, to Write the Output value captured from the application, When i am trying to use the methods "Appen String to File" i am unable to write / assign the out put value below the specific header. Can any one please look into this and post the methods related to Write the output vaues in to the CSV files under specific headers.
    Thanks in Advance.
    Thanks.,
    Siva

    Hi Alex,
    Thanks for your reply.I need to write the output value under specified parameter name.
    for example after creating the sales order,the order number have to write in the CSV file under
    OrderNumber column.I tried with appendStringtofille() method,by using this able to write the value under
    first column.But i need to write output value under specified columnname(means Header name in the cSV
    file).can u please give a reply for the above problem.
    Note: In that Csv file i am taking the input vales and also need to write the output values under
    specified column(header)
    Thanks,
    Siva Thota.

  • Need help in loading data from a csv file to a table in Oracle DB

    Hi,
    I am using sqlplus as a client to connect to the server.
    I am trying to load data from a csv file from a client to a table in Oracle DB server.
    I am trying to use the below command
    " LOAD DATA INFILE 'test.csv' INTO TABLE testTable FIELDS TERMINATED BY ',' (test1,test2,testc3,testc4); "
    But, I am encountered with the following error
    "SP2-0042: unknown command "load data" - rest of line ignored."
    Thanks in advance.
    SB

    Hey Frostmann,
    That was a nice post....
    I changed my mind to use an 'Insert into' statement from a shell script.
    I created a DB table named test and I tried using the below shell script to insert a row in the table.
    sqlplus test/test@test <<ENDOFSQL
    INSERT INTO test VALUES('test1',123,'test2','test3');
    exit
    ENDOFSQL
    A row is succesfully inserted into the table when I run the script manually, but it does not insert rows when a cron job is scheduled.
    Could you please help me with this?
    Thanks in advance.
    SB

  • How do you take a picture from the photo library and put it on your desktop?

    I want to be able to take a picture from my photo libray, and drop it on my desktop to be able to access it immediately. Is this possible?

    There are lots of ways of moving files. 
    A simple and popular way to copy files.
    http://wiki.dropbox.com
    Using iTures to transfer files:
    http://support.apple.com/kb/HT4094?viewlocale=en_US&locale=en_US
    Files Connect -- The swiss army knife of remote file connect
    https://itunes.apple.com/us/app/files-connect/id404324302?mt=8
    For syncing pc or mac folders to iPad applications.
    "Using SugarSync, you simply designate folders that you want to “sync” to the cloud and it keeps everything in sync anytime you make changes.  This is the way cloud storage should be done and especially if you are using your iPad for buisness or for school."
    The only potential downside is that so many apps for the iPhone/iPad come with Dropbox sync built in which makes it extremely convenient.
    http://www.tcgeeks.com/best-ipad-cloud-sync-app/
    Doug says:
    "This can be done with Dropbox as well using one of the many Dropbox addons…"
    http://wiki.dropbox.com/DropboxAddons

  • Need to create sale order from the flat file & mail has to be sent

    Hi Experts,
              I have a requirement to create a sale order from a flat file and once the oder is created, mail has to be sent to customer as well as to internal user with the order details. I want to know how this process can be implemented and what adapters are needed to execute this.
    it would be very helpful, if i get an step-by-step procedure.
    Points assured for any helpful answers.
    Thanks in Advance
    Jai

    HI Jai,
    You need to create two interfaces as file will be sending the Sales oreder details that you need to capture in IDOC or RFC and then have to trigger to create the sales order. For this Standard BAPIs are also available.
    These RFC or BAPIs will response with Sales order details that you need to divert to Mail adapter with the use of BPM and also have to go for Async to Sync bridge.
    File -
    >XI (BPM) ---> BAPI/RFC  (Request)
    MailAdapter <- XI (BPM) <--- BAPI/RFC (Response)
    For this refer below links for step by step
    /people/arpit.seth/blog/2005/06/27/rfc-scenario-using-bpm--starter-kit - File to RFC
    https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/1685 [original link is broken] [original link is broken] [original link is broken] - File to Mail
    /people/krishna.moorthyp/blog/2005/06/09/walkthrough-with-bpm - Walk through BPM
    /people/siva.maranani/blog/2005/05/22/schedule-your-bpm - Schedule BPM
    /people/sriram.vasudevan3/blog/2005/01/11/demonstrating-use-of-synchronous-asynchronous-bridge-to-integrate-synchronous-and-asynchronous-systems-using-ccbpm-in-sap-xi - Use of Synch - Asynch bridge in ccBPM
    https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/1403 [original link is broken] [original link is broken] [original link is broken] - Use of Synch - Asynch bridge in ccBPM
    If you will use IDOC then In IDOC inbound processing you need to trigger for Sales order creation and then have to send the Sales Order generated IDOC as an Outbound to Mail Adapter
    Flat file -
    > XI ---> IDOC
    IDOC -
    > XI ---> Mail
    This will be bit easy scenario to develope as compare to using BAPI with BPM
    /people/ravikumar.allampallam/blog/2005/06/24/convert-any-flat-file-to-any-idoc-java-mapping - Any flat file to any Idoc
    configuring IDOC-XI-Mail scenario using following web-log:
    /people/michal.krawczyk2/blog/2005/03/07/mail-adapter-xi--how-to-implement-dynamic-mail-address
    /people/sravya.talanki2/blog/2005/08/18/triggering-e-mails-to-shared-folders-of-sap-is-u - Triggering Email from folder
    Thanks
    Swarup

  • Dulicacy of field values in the CSV file

    Hi Experts
    We are configuring a file to idoc scenario in which the file is a .csv txt file.
    The format of the csv file is
    NMI,BillNo,BillAmount,ContractAcc
    There are instances where there is a duplicacy in the NMI & hence that needs to be filtered before sending it to PI.Any idea about how to filter this either at the source end or PI end.
    Please throw some light in this.
    Regards
    Sabyasachi

    Hi Sabyasachi,
    Manually you will need to open the file put it into excel remove duplicate entries , again move that back again into text file. This method is a very dumb way of doing things.
    A smarter way would be to write a module. The link given below is not a tailor made solution to your query but sufficient to get you started.
    https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/99593f86-0601-0010-059d-d2dd39dceaa0
    Regards
    joel

  • Is there a way to select a certain box of elements from a csv file and read that into LabVIEW?

    Hello all, I was wondering if there was a way to select only a certain "box" of elements from a .csv file in LabVIEW? I have LabVIEW 2011 and my main goal is to take two arrays and graph them against each other. I can import the .csv file just fine and separate each row and each column to be its own, but say I have an 8X8 but want to graph the middle 4X5 or something like that. Is there any way to extract an array without starting at the beginning and without ending at the end? Thank you in advance.
    Solved!
    Go to Solution.

    Hi Szklanam,
    as a CSV file is just a TXT file with a different suffix you can read a certain number of lines of that file. So you can limit the number of rows in your resultung array. To limit the number of columns you still have to use ArraySubset, so maybe it's a lot easier to read the full CSV file and pick the interesting spots with ArraySubset...
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • Separating values from an excel file and plotting

    Hello,
    I am using the read excel table vi to read the values from an excel file.I see the data in the output.
    I wanted to take the first two columns and multiply each value with 20m and then plot it in a XY graph. 
    I am attaching the files below.
    Thanks in advance 
    Solved!
    Go to Solution.
    Attachments:
    test data.xls ‏436 KB
    ReadExcelTable[1].vi ‏23 KB

    Hello,
    i acheived the multiplication in a different way but i have another problem.I am only considering two columns in the above excel sheet.After multiplying each value with 0.02  i get another array for the two columns with values say a,b,c,d and a1,b1,c1,d1 and so on.
    The plot i require is of (a,a1)   (a+b,a1+b1)  (a+b+c,a1+b1+c1) and so on.
    Any ideas that might help me.I am attaching the VI that solves the problem till multiplication.
    Thanks in advance.
    Attachments:
    INS_plot.vi ‏59 KB
    test data.txt ‏246 KB

  • Is there a way to name the .indd files created by a data merge with values in the CSV file

    I have a data merge document that is set to single Record per Document page and 1 page per document.  In my CSV file I have a field for Part Number.  If I run a data merge with 10 records I end up with 10 .indd files.  I need a way so that the resulting .indd files are named the same value that is in the Part Number field.

    Loic has provided a link for my original piece, and I've written up some follow-up pieces for indesignsecrets.com:
    http://indesignsecrets.com/data-merging-individual-records-separate-pdfs.php
    http://indesignsecrets.com/data-merging-individual-records-separate-pdfs-part-2-scripting. php
    So there are several ways to get unique name PDFs from an indesign Data Merge. However, none of these 3 articles will truly answer your question of how to get unique indesign filenames using the database. I can see a practical purpose for this as merging business cards directly to PDFs is great, but I can be guaranteed that while on proof, there will be alts to the business cards that need to be done outside the merge, meaning specific records need to be exported to indesign files for further manipulation.

  • Copying string value from the main file to a thread!

    i.e. I have a string like this in the main file:
    private static String a = new String("1");
    and the value from "a" shuld be copied so that a variable "a" in thread.java gets the same value!
    how to do this?
    thanks
    .leonard

    1) If main has access to a in thread, have main copy it over.
    2) Add a getA() function to main and have thread use that.
    3) Design the program better from the ground up.

  • SQLLOADER fails to load space from the CSV file

    Hello,
    -- I am using sqlloader to load tables(Release 10.2.0.4.0)
    --- I have actual spaces in my CSV files, which i want to load as it is in the tables.
    --- However, sqlloader loads "nulls" instead.
    --- Please help.

    Vishal,
    Use this and you should be able do this, I am attaching a working example based your input data
    Table: Layout
    create table layout (
    col1 varchar2(10),
    col2 varchar2(100),
    col3 varchar2(10)
    );# Control file: layout.ctl
    LOAD DATA
    REPLACE PRESERVE BLANKS INTO TABLE KLONDIKE.LAYOUT
    FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
    TRAILING NULLCOLS
    col1 char(10),
    col2 char(100),
    col3 char(10)
    {code}
    Loading from command line
    {code}
    C:. sqlldr username/password control=layout.ctl data=layout.txt log=layout.log
    {code}
    Verfiy using following sql that data loaded with one white single whitespace
    {code}
    select layout.* , length(col2) from layout;
    {code}
    Regards
    Edited by: OrionNet on Mar 28, 2009 12:09 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Maybe you are looking for

  • I need some advice buying a compatible piece of hardware.

    I want to buy a 4 bay USB enclosure. The problem is, there are many of them out on the market and I want to make sure I find one that's properly compatible with OSX. The most important thing for me is that the device power off and on when the Mac goe

  • I cannot connet to app store using wifi in the library

    I have recently been in the local library to connect to the app store via wi fi as this is required for some apps but i cann connect to i tunes or the app store, i can connect to the net BBC i player etc. Does anyone know why i cannot connect

  • Transmitting text in IDoc

    Hello, I have a scenario wherein I have text object (like sales text in Material master) attached to an IDoc. I want to transfer text that the user enters (within SAP) via IDoc to XI. XI then need to call a webservice and post this text information t

  • ADFS server pointing to multiple top level domains

    Hi, I have two separate Active Directory Forests setup in my environment (domainA.net and domainB.net) Each forest has a few child subdomains. I would like one ADFS website to allow authentication for both AD forests in my environment. Is there a way

  • Connection information to use Query Builder

    I am following the Oracle Reports tutorial - how to add data to a report http://download-east.oracle.com/docs/cd/B14099_17/bi.1012/b14364/rwtutorial_data.htm#i1012227 I am at Step 6: Using the Query Builder. I already have the HR sample schema in my