Reading MPP file using MPXJ lib. from sourceforge?

Hello,
MPP file is getting read using(sourceforge mpxj lib) java but not in the proper hierarchical manner I want to read the subtask and add into databse.please suggest the solution!!!!!!!!!!!!!!!!!!!!!!!!!
Thank You,
Deepali Khape

Hai,
Below code would solve your problem of reading the mpp file using mpxj API . Below code is an example of standalone application which takes and argument of mpp file name with out extension. ex. temp.mpp file is given as "temp" argument to the application. Compile and run the file.
//import com.tapsterrock.mpp.MPPFile;
import java.util.*;
import com.tapsterrock.mpx.MPXFile;
import com.tapsterrock.mpx.Task;
import com.tapsterrock.mpx.*;
public class MPPReadTest extends Thread
     public static void main(String[] args)
          try{
int i=0;
Runtime rt=Runtime.getRuntime();
Process p=rt.exec("java com.tapsterrock.utility.MppMpx "+args[0]+".mpp "+args[0]+".mpx");
p.waitFor();
MPXFile mpx=new MPXFile(""+args[0]+".mpx");
LinkedList llist=mpx.getChildTasks();
for(i=0;i<llist.size();i++)
Task t=(Task)llist.get(0);
System.out.println("Task Details : \n"+llist.get(0));
System.out.println("\n\nTask name : "+t.getName());
System.out.println("Task Unique ID : "+t.getUniqueID());
System.out.println("Task Unique ID : "+t.getUniqueID());
System.out.println("\tStart Date : "+t.getStart());
System.out.println("\tFinish Date : "+t.getFinish());
System.out.println("\tDuration : "+t.getDuration().getDuration());
getSubTasks(t,t.getUniqueID());
          }catch(Exception e)
               System.out.println("Error : "+e.toString());
public static void getSubTasks(Task tt,Integer parentTaskId)
int i=0;
int j=0;
Integer tempTaskId=new Integer(0);
if(tt.getChildTasks().size()>0)
for(i=0;i<tt.getChildTasks().size();i++)
Task t=(Task)tt.getChildTasks().get(i);
if(parentTaskId==t.getParentTask().getUniqueID())
System.out.println("\n\nTask name : "+t.getName());
System.out.println("Task Parent Unique ID : "+t.getParentTask().getUniqueID());
System.out.println("Task Unique ID : "+t.getUniqueID());
System.out.println("\tStart Date : "+t.getStart());
System.out.println("\tFinish Date : "+t.getFinish());
System.out.println("\tDuration : "+t.getDuration().getDuration());
tempTaskId=t.getParentTask().getUniqueID();
else
tempTaskId=t.getUniqueID();
System.out.println("\n\nTask name : "+t.getName());
System.out.println("Task Parent Unique ID : "+t.getParentTask().getUniqueID());
System.out.println("Task Unique ID : "+t.getUniqueID());
System.out.println("\tStart Date : "+t.getStart());
System.out.println("\tFinish Date : "+t.getFinish());
System.out.println("\tDuration : "+t.getDuration().getDuration());
LinkedList resources=t.getResourceAssignments();
if(resources.size()>0)
for(j=0;j<resources.size();j++)
System.out.println("\n\t Task ID \t\t Task Name \t\t\t\t\t ResourceID \t\t Resource Name");
System.out.println("\t"+t.getUniqueID()+"\t\t\t\t"+t.getName()+"\t\t"+((ResourceAssignment)resources.get(j)).getResource().getUniqueID()+"\t\t\t\t"+((ResourceAssignment)resources.get(j)).getResource().getName());
if(t.getChildTasks().size()>0)
getSubTasks(t,tempTaskId);
else
Regards
Aravind.V

Similar Messages

  • How to read .mpp file

    Hi,
    I want to read .mpp file and store data from this .mpp file into SQLServer 2000.
    .mpp file is an Microsoft file .
    Thanks in advance........
    madhu
    [email protected]

    First u have to install microsoft project SW.

  • Reading XML file using BAPI and then uploading that xml file data into SAP

    I am getting a xml file from Java server. I need to take
    data from this file using BAPI and need to upload into SAP using SAP.
    Please tell me how to read XML files using BAPI's.

    <b>SDIXML_DATA_TO_DOM</b> Convert SAP data (elementary/structured/table types) into DOM (XML
    <b>SDIXML_DOM_TO_XML</b>  Convert DOM (XML) into string of bytes that can be downloaded to PC or application server
    <b>SDIXML_DOM_TO_SCREEN</b> Display DOM (XML)
    <b>SDIXML_DOM_TO_DATA</b>
    data: it_table like t001 occurs 0.
    data: l_dom      TYPE REF TO IF_IXML_ELEMENT,
          m_document TYPE REF TO IF_IXML_DOCUMENT,
          g_ixml     TYPE REF TO IF_IXML,
          w_string   TYPE XSTRING,
          w_size     TYPE I,
          w_result   TYPE I,
          w_line     TYPE STRING,
          it_xml     TYPE DCXMLLINES,
          s_xml      like line of it_xml,
          w_rc       like sy-subrc.
    start-of-selection.
      select * from t001 into table it_table.
    end-of-selection.
    initialize iXML-Framework          ****
      write: / 'initialiazing iXML:'.
      class cl_ixml definition load.
      g_ixml = cl_ixml=>create( ).
      check not g_ixml is initial.
      write: 'ok'.
    create DOM from SAP data           ****
      write: / 'creating iXML doc:'.
      m_document = g_ixml->create_document( ).
      check not m_document is initial.
      write: 'ok'.
      write: / 'converting DATA TO DOM 1:'.
      CALL FUNCTION 'SDIXML_DATA_TO_DOM'
        EXPORTING
          NAME               = 'IT_TABLE'
          DATAOBJECT         = it_table[]
        IMPORTING
          DATA_AS_DOM        = l_dom
        CHANGING
          DOCUMENT           = m_document
        EXCEPTIONS
          ILLEGAL_NAME       = 1
          OTHERS             = 2.
      if sy-subrc = 0.  write  'ok'.
      else.             write: 'Err =', sy-subrc.
      endif.
      check not l_dom is initial.
      write: / 'appending DOM to iXML doc:'.
      w_rc = m_document->append_child( new_child = l_dom ).
      if w_rc is initial.  write  'ok'.
      else.                write: 'Err =', w_rc.
      endif.
    visualize iXML (DOM)               ****
      write: / 'displaying DOM:'.
      CALL FUNCTION 'SDIXML_DOM_TO_SCREEN'
        EXPORTING
          DOCUMENT          = m_document
        EXCEPTIONS
          NO_DOCUMENT       = 1
          OTHERS            = 2.
      if sy-subrc = 0.  write  'ok'.
      else.             write: 'Err =', sy-subrc.
      endif.
    convert DOM to XML doc (table)     ****
      write: / 'converting DOM TO XML:'.
      CALL FUNCTION 'SDIXML_DOM_TO_XML'
        EXPORTING
          DOCUMENT            = m_document
        PRETTY_PRINT        = ' '
        IMPORTING
          XML_AS_STRING       = w_string
          SIZE                = w_size
        TABLES
          XML_AS_TABLE        = it_xml
        EXCEPTIONS
          NO_DOCUMENT         = 1
          OTHERS              = 2.
      if sy-subrc = 0.   write  'ok'.
      else.              write: 'Err =', sy-subrc.
      endif.
      write: / 'XML as string of size:', w_size, / w_string.
      describe table it_xml lines w_result.
      write: / 'XML as table of', w_result, 'lines:'..
      loop at it_xml into s_xml.
        write s_xml.
      endloop.
      write: / 'end of processing'.
    end of code
    Hope this will be useful.
    regards
    vinod

  • Reading XML file using BAPI  I must use adapters .

    Reading XML file using BAPI and then uploading that xml file data into SAP using BDC.
    I cant take file on to my Application server I am getting the file dynamically from other file server and I need to use BAPis to read data from XML file.please tell me what should be my Import,Export and Tables parameterrs should be.
    Thanks

    Hi,
    Import, export and table parameters for BAPI is required, without that BAPI will not able to collect the data from XML. What you need to do is write a Zprogram and collect the data, store that data in internal table and call the BAPI by passing required parameters.
    Different Scanarios:
    1) Before calling a BAPI write some other program which collects the data from XML and create a UNIX file. Try to get the data from UNIX FILE
    2) If you see the XML tags, data will be in side that tags, try to get the data from XML tags and store that data in one SAP table. You can use the BAPI by fetching the data from table
    3)Create a table and store the data in the table. Use the table in SAP to extract the data.
    BAPI won't work without any parameters, you have to pass some parameters then the BAPI will return some values.
    Hope i am clear.
    Thanks&Regards,
    -Suresh Revuru

  • How to read HTML files using UTL_FILE

    Hello Friends,
    How to read HTML files using UTL_FILE package ? According
    to Oracle documentation UTL_FILE can read or write OS Text Files.
    Thanx in advance..
    Adi

    HI Hareesh,
    i have gone through that blog.
    i tried it...but i am getting mapping error  no receiver determination fond because there are so  many excel files.
    my data is available on sharedString.xml but also it is in not same order.
    i have no clue how to handle this part form the blog.
    "This way our mapping will receive all data from the sheet in an XML format. The only thing that's left is to create an XSD file from the XML file we received in order to be able to use it in the mapping and as our Service Interface and we can proceed with mapping. As you can see from the sheet.xml files all the data is placed with column name and row number so it's not that difficult to map it to an table type format using the Message Mapping only (no java, abap mapping required)."

  • How to read 835 files using ssis

    Hello Everyone,
    It is possible read 835 files using ssis.
    Please share your suggestions on this.
    Regards,
    Vaishu

    Hi Vaishu,
    None of the canned (standard) SSIS tasks let you do so.
    But if you can buy http://www.cozyroc.com/ssis/edi-source (I am not anyhow affiliated with CozyRoc) it states it can read ERA (AKA 835) files. CozyRoc lets you run it for free in Dev.
    If there will be a decision not to buy then you can simply crate a transformation out of several manipulations or by creating a custom SSIS component or some other programming methods need to be used.
    PS: Again, I just know CozyRoc quality of components is awesome, but I do not make any profit from referring to it.
    Arthur My Blog

  • How to create and read text file using LabVIEW 7.1 PDA module?

    How to create and read text file using LabVIEW 7.1 PDA module? I can not create a text file and read it.
    I attach my code here.
    Attachments:
    File_IO.vi ‏82 KB

    Well my acquisition code runs perfect. The problem is reading it. I can't seem to read my data no matter what I do. My data gets saved as a string using the array to string vi but I've read that the string to array vi (which I need to convert back to array to read my data) does not work on the pda. I'm using version 8.0. So I was trying to modify the program posted in this discussion so that it would save data from my DAQ. I did that but I still can't read the data after its saved. I really don't know what else to do. All I need to do is read the data on the pda itself. I can't understand why I'm having such a hard time doing that. I found a possible solution on another discussion that talks about parsing the strings because of the bug in the "string to array" vi. However, that lead me to another problem because for some reason, the array indicators or graphs don't function on the pda. When i build the program to the pda or emulator, the array indicators are faded out on the front panel as if the function is not valid. Does this kind of help give a better picture of what I'm trying to do. Simply read data back. Thanks.

  • To read text file using utl_file

    I would like to read test_file_out.txt which is in c:\temp folder.
    create or replace create or replace directory dir_temp as 'c:\temp';
    grant read, write on directory dir_temp to system;
    then when i execute the below code i get the error .
    // to read text file using utl_file
    DECLARE
    FileIn UTL_FILE.FILE_TYPE;
    v_sql VARCHAR2 (1000);
    BEGIN
    FileIn := UTL_FILE.FOPEN ('DIR_TEMP', 'test_file_out.txt', 'R');
    UTL_FILE.PUT_LINE (FileIn, v_sql);
    dbms_output.put_line(v_sql);
    UTL_FILE.FCLOSE (FileIn);
    END;
    ERROR:
    invalid file operation
    i would like to use ult_file only and also can you let me know to read the text file and place its contents in tmp_emp table?

    Are you trying to read the contents of the file into the local variable? Or write the contents of the local variable to the file?
    Your text talks about reading the file. And you open the file in read mode. But then you call the UTL_FILE.PUT_LINE method which, as SomeoneElse points out, attempts to write data to the file. Since the file is open in read-only mode, you cannot write to the file.
    If the goal is really to read from the file, replace the UTL_FILE.PUT_LINE calls with UTL_FILE.GET_LINE. If the goal is really to write to the file, you'll need to open the file in write mode ('W' rather than 'R' in the FOPEN call).
    Justin

  • How to read a file using servlet

    hi ,
    i've to read a file using servlet ,
    should read the file using servlet and display it in JSP,Could anybody get me how can i do it .
    Shiva

    To do that you need to get the response output stream and write yur file contents to that.
    response.setContentType(mimeType); //Set the mime type for the response
    ServletOutputStream sos = resp.getOutputStream();
    sos.write(bytes from your file input stream);
    sos.close();

  • Can't read text file using UTL_FILE

    Hi All,
    how can I read notepad file using UTL_FILE package.I have specified the UTL_FILE_DIR in the init.ora file.My objective is to when a button is clicked, the contents of the file will display in a text item.Here is my code written in WHEN_BUTTON_PRESSED trigger.
    DECLARE
         file_handle UTL_FILE.FILE_TYPE;
    data_line Varchar2(100);
    BEGIN
         file_handle := UTL_FILE.FOPEN('E:\vimal','abc.txt','R');
              message('directory created');
         UTL_FILE.GET_LINE(file_handle, data_line);
         :block2.t1 := data_line;
         UTL_FILE.FCLOSE(file_handle);
    END;

    Why don't you use text_io? Don't forget that UTL_FILE is reading directories from the database point of view. The E drive for the database is a different E then on your client pc. I presume your database is on a different computer. Are you getting any errors?

  • How to read pdf files using java.io package classes

    Dear All,
    I have a certain requirement that i should read and write PDF files at runtime. With normal java file IO reading is not working. Can any one suggest me how to proceed probably with sample code block
    Thanks in advance.

    hi I also have the pbm. to read pdf file using JAVA
    can any body help meWhy is it so difficult to read the thread you posted in? They say: java.io is pointless, use iText. So why don't you?
    or also I want to read a binary encoded data into
    ascii,
    can anybody give me a hint how to do it.Depends on what you mean with "binary encoding". ASCII's binary encoding, too, basically.

  • Is it possible to read the file using File Adapter which is in client machi

    Is it possible to read the file using file Adapter which is in client machine(on the same network).Then what is thee need of FTP Adapter?

    You can achieve that by exposing your client machine as a drive, then you can go using file adapter.
    FTP adapter will help you to communicate with different machine which is in different network.
    It is considered good etiquette to reward answerers with points (as "helpful" - 5 pts - or "correct" - 10pts).
    Thanks,
    Vijay

  • How to read pdf file using file adapter

    Hi..
        How to read pdf file using file adapter?
    regards
    Arun

    Hi
    This may help you
    /people/sap.user72/blog/2005/07/27/xi-generate-pdf-file-out-of-file-adapter
    /people/alessandro.guarneri/blog/2007/02/21/sap-xi-acting-as-a-huge-file-mover
    ---Ram

  • I am unable to read pdf files using Acrobat Reader on my MAC OS X. Any suggestions?

    How do I read pdf files using my MAC OS X?

    You can read pdf files with preview. Select a pdf document, right click on it, and choose Preview. You can also get info and select to choose Preview for all.
    You can also install Adobe Reader 10.1.3 for Lion. It will also install a plug-in to read pdf docs in the browser.
    http://www.adobe.com/support/downloads/detail.jsp?ftpID=5360

  • Can't read a file using FileInputStream(String path)

    Hi,
    Platform: Fedora Core 3
    IDE: MyEclipse 3.8.1
    Servlet Container: Tomcat 5
    Framework: Struts 1.1
    JDK: 1.5
    1) I'm trying to read a file (mw.properties) which resides in the package aaa.ccc.uuu.struts using FileInputStream("/aaa/ccc/uuu/struts/mw.properties");
    The class (named MyAction) trying to read this file is in the following package
    aaa.ccc.uuu.struts.actions.MyAction
    2) The alternatives that I've tried is:
    a) FileInputStream("aaa/ccc/uuu/struts/mw.properties");
    b) FileInputStream("aaa/ccc/uuu/struts/mw.properties");
    c) FileInputStream("/mw.properties");
    d) FileInputStream("mw.properties");
    (/javaweb is the context path)
    e) FileInputStream("/javaweb/WEB-INF/classes/aaa/ccc/uuu/struts/mw.properties");
    f) FileInputStream("/classes/ccc/uuu/struts/mw.properties");
    g) FileInputStream("classes/aaa/ccc/uuu/struts/mw.properties");
    h)FileInputStream("/usr/local/jakarata-tomcat-5/webapps/javaweb/aaa/ccc/uuu/struts/mw.properties");
    i) FileInputStream("/WEB-INF/classes/aaa/ccc/uuu/struts/mw.properties");
    ...and so forth.
    3) My Tomcat directory structure looks like the following:
    javaweb
    -->src
    ---->aaa
    ------>ccc
    --------->uuu
    ------------>struts/mw.properies
    --------------->actions/MyAction.java (trying to read the mw.properties file from within this file)
    -->web
    --->WEB-INF
    ----->classes
    --------->aaa
    ------------>ccc
    ---------------->uuu
    ------------------->struts/mw.properties
    ----------------------->actions
    --------------------------->MyAction.class (I've placed the mw.properties file here as well)
    ----->jsp
    ------>some more folders
    Note that the mw.properties file is in the source directory as well as the classes directory - I did this to trouble shoot. As far as i know the correct place to put the mw.properties file is in the classes folder (taking into consideration the package structure obviously)
    I'll appreciate any help I'm really stumped! (Not sure if this is the correct forum to post this query)
    Cheers

    Hi,
    My knowledge about web applications is very limited. I would try to create a new file from the app using just a name, and not a path. I would then look for the created file to see where the current path is. But I guess you could figure it out by reading the documentation.
    /Kaj

Maybe you are looking for

  • Opening multiple databases in a single file

         Hello everybody, I need create 1000 small databases(tables) in a single physical file, how to solve? ( I have read chap 3 Access Method Operations in BDB programmer reference,  so I know it's need create a shared database environment, but I don'

  • Enable Deprecation Warnings (again)

    Hi, i want to see deprecated warnings during the build withing bea workshop. I posted this question already. The answer i got from BEA was not sufficient and i didnt get an answer on my reply on their answer ... Please read this thread first: http://

  • A little lost - newbie

    Hi I just started the CS4 trial of Illustrator - I'm used to Photoshop, but a little lost here. I imported a bitmap line drawing, and converted it to a vector by doing a live trace (Illustrator did it BEAUTIFULLY with a one click preset) Now I'd like

  • Anyconnect VPN-Authentication multiple profiles via ACS

    Hi, I'm currently facing the issue, that I need to migrate a customer VPN-structure from VPN-client to the new Anyconnect. There is an ASA5515 and they have ACS with local users and AD-Integration. The problem: The old system used different profiles

  • To delete the transport request.

    when i'm trying to delete the transport request by using se09, it responses with " Request/task BWDK916118 cannot be deleted because it contains locked objects." That request is created by me. It showing same name but it will not allow me to delete.