Extract hierarchy from a flat file

Hello,
I’m trying to extract hierarchy from a flat file.
The hierarchy is built from 3 different infoObjects each infoObject represent different level in the hierarchy. I built the hierarchy in the last level of the hierarchy and put all the levels as external chars in the hierarchy.
(I used the blog: Hierarchy Upload from Flat files: /people/prakash.bagali/blog/2006/02/07/hierarchy-upload-from-flat-files )
When I extract the data into the PSA it looks fine but when I choose to  update the PSA data into the infoObject  the request stays yellow. Three is no dump and I cant find the job in SM50.
Please Advice,
David

Hi David,
Thats the problem with using PSA for flatfile hierarchy loads. If you can change the transfer method to "IDOC" then change and retry the load. The IDoc method gives you an advantrage when dealing with flatfiles as you can debug and notice which record # has errors.
Bye
Dinesh

Similar Messages

  • Numbering nodes when loading hierarchy from a flat file.

    Hi All,
    I want to load a hierarchy from a flat file. When we number the nodes, do they have to be in a sequence or can I give them any number I want? I want to make the GL account number as the node number since it makes it easy to generate the node number that way. The way I see it, the important thing is the parent node number; so this approach should be fine. Please correct me if I am wrong.
    Thanks,
    Uday

    Hi Uday,
       You need to have a running sequence numbers for Node Id field in the flat file. The file structure is as
    NODEID  IOBJNM      NODENAME TLEVEL LINK PARENTID
    00000001 0GLACC     GL233344             00000001
    00000002 0GLACC     GL435556             00000001
    00000003 0GLACC     GL545666             00000001
    00000004 0costcenter cc433232            00000002
    00000005 0costcenter cc433233            00000002
    00000006 0costcenter CC555551            00000003
    The Parentid will calculated by the system automatically.
    when you prepare you file csv please ensure that you have 8 characters for the Node ID " 00000003" other wise you will get error.
    And if you want to add GL Account number to your hierarchy then you need to add GL A/c Number as external characteristics in hierarchy and add it to your flat file .
    Hope it helps.
    Cheers,
    Balaji

  • How to extract data from multiple flat files to load into corresponding tables in SQL Server 2008 R2 ?

    Hi,
              I have to implement the following scenario in SSIS but don't know how to do since I never worked with SSIS before. Please help me.
              I have 20 different text files in a single folder and 20 different tables corresponding to each text file in SQL Server 2008 R2 Database. I need to extract the data from each text file and
    load the data into corresponding table in Sql Server Database. Please guide me in how many ways I can do this and which is the best way to implement this job.  Actually I have to automate this job. Few files are in same format(with same column names
    and datatypes) where others are not.
    1. Do I need to create 20 different projects ?
                   or
        Can I implement this in only one project by having 20 packages?
                 or
        Can I do this in one project with only one package?
    Thanks in advance.

    As I said I don't know how to use object data type, I just given a shot as below. I know the following code has errors can you please correct it for me.
    Public
    Sub Main()
    ' Add your code here 
    Dim f1
    As FileStream
    Dim s1
    As StreamReader
    Dim date1
    As
    Object
    Dim rline
    As
    String
    Dim Filelist(1)
    As
    String
    Dim FileName
    As
    String
    Dim i
    As
    Integer
    i = 1
    date1 =
    Filelist(0) =
    "XYZ"
    Filelist(1) =
    "123"
    For
    Each FileName
    In Filelist
    f1 = File.OpenRead(FileName)
    s1 = File.OpenText(FileName)
    rline = s1.ReadLine
    While
    Not rline
    Is
    Nothing
    If Left(rline, 4) =
    "DATE"
    Then
    date1 (i)= Mid(rline, 7, 8)
     i = i + 1
    Exit
    While
    End
    If
    rline = s1.ReadLine
    End
    While
    Next
    Dts.Variables(
    "date").Value = date1(1)
    Dts.Variables(
    "date1").Value = date1(2)
    Dts.TaskResult = ScriptResults.Success
    End
    Sub

  • How to Extract data from a flat file and how to upload it into table

    Hi
    i want to extract the data from a web page, that data i want to keep in text file.
    from the text file i want to read it and i want to upload into table
    can any one help me its very urgent

    here is my 20min try without debugging (needs a rs232 and loopback connector )
    use the probe and highlight the dataflow to see how it works.
    as always:  there are many ways to solve your problem
    Greetings from Germany
    Henrik
    LV since v3.1
    “ground” is a convenient fantasy
    '˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'
    Attachments:
    read write file to RS232.vi ‏69 KB

  • Error while uploading data from a flat file to the hierarchy

    Hi guys,
    after i upload data from a flat file to the hierarchy, i get a error message "Please select a valid info object" am loading data using PSA, having activated all external chars still get the problem..some help on this please..
    regards
    Sri

    there is o relation of infoobject name in flat file and infoobjet name at BW side.
    please check with the object in the BW and their lengths and type of the object and check your flat file weather u have the same type there,
    now check the sequence of the objects in the transfer rules  and activate them.
    there u go.

  • Hierarchy using a flat file for a master data load.

    Can anyone please tell me the steps involved in creating a hierarchy in BI 7.0.  and loading the data using a flat file into the created hierarchy? I have seen some posts and weblogs but they were not helpful and i have been getting some errors which i dont know how to resolve.
    Can someone please give a clear steps and procedure for this?
    Thanks a lot in advance.
    Naveen

    Hi,
    The flat file is generated in application server by executing an ABAP program in SE38.
    This ABAP program contains the logic to generate hierarchy.
    In our case we used a DSO to store employee & supervisors.
    This program generated a flat file in tmp folder in application server
    In our case, To load this flat file we  created an Infosource on our master data using direct update using RSA1old Tcode
    after Infosource is created right click on the InfoSource and click on Assign DataSource.
    Give the Source System name
    When you open this Info source you can select data source as YHIEROBJ_HIER and then activate the InfoSource.
    create an Info Package to load the Hierarchy. Right click on the PC Files (Source System) and click on u201CCreate InfoPackage".
    Under Extraction tab give the flat file name which is generated by the ABAP program in AL11.
    Select the hierarchy which you want to load. Also, you can rename the Hierarchy after loading it. The update method is selected as u201CFull Updateu201D.
    Logic for Generation of flat file & ABAP Program:
    Flat file structure:
    Node ID     InfoObject     NodeName     Parent ID     Date To      Date From     Language
    u2022     u201CNode IDu201D indicates the unique number which defines the Node.
    u2022     u201CInfoObject u201Cgives the name of the InfoObject which is assigned to this Node ID.
    u2022     u201CNodeNameu201D is the name you specify to that Node.
    u2022     u201CParent IDu201D is the Node ID to which the Current Node ID reports to.
    u2022     u201CDate Tou201D and u201CDate Fromu201D are taken for time references (You can set them constant).
    u2022      u201CLanguageu201C is set to English (E).
    The program Logic can be :
    Declare the hierarchy structure
    Get the data from DSO into internal table
    Read all the EMP values into NodeName Field of the table
    Build lookup table for Parent Node ID
    Fill Parent Node ID field
    Append this data to work area & then to another internal table
    You need to declare the selection parameter as SSFILE1
    & use following code to write back the file
      OPEN DATASET SSFILE1 FOR OUTPUT IN TEXT MODE ENCODING DEFAULT
         MESSAGE MSG.
      IF SY-SUBRC NE 0.
        MESSAGE E008(ZBW1) WITH MSG.
      ENDIF
    Populate the output from that internal table into final work area.
    Transfer this final work area to the ssfile1 which is the desired output file.
    and   CLOSE DATASET SSFILE1.
    When this program is executed, selection screen asks for the name of file
    Enter the desired file name & execute
    flat file would be generated in the Application server now.
    To view the File, Go to Transaction AL11. Search the directory /tmp. Double click on this directory.
    This opens the list of flat files under this directory. Double click on the file name.
    Hope this helps.
    Thanks,
    Rashmi.

  • How to load data from a  flat file which is there in the application server

    HI All,
              how to load data from a  flat file which is there in the application server..

    Hi,
    Firstly you will need to place the file(s) in the AL11 path. Then in your infopackage in "Extraction" tab you need to select "Application Server" option. Then you need to specify the path as well as the exact file you want to load by using the browsing button.
    If your file name keeps changing on a daily basis i.e. name_ddmmyyyy.csv, then in the Extraction tab you have the option to write an ABAP routine that generates the file name. Here you will need to append sy-datum to "name" and then append ".csv" to generate complete filename.
    Please let me know if this is helpful or if you need any more inputs.
    Thanks & Regards,
    Nishant Tatkar.

  • Hierarchy format in Flat file

    Hi gurus,
          please tellme  the Hierarchy format in Flat file.
               ThanQ.
       Regards,
       Ramesh.

    Hi
    1.Defining the source system from which you want to load data:
    Create For a flat file, choose: File System, Manual Metadata; Data via File Interface.
    2.Defining the InfoSource for which you want to load data:
    Create Application Component.
    Create InfoSource , Direct Update
    Choose an InfoObject from the proposal list, and specify a name and a description.
    3.Assigning the source system to the InfoSource
    Assign Source System. You are taken automatically to the transfer structure maintenance.
    The system automatically generates DataSources for the three different data types to which you can load data.
    Attributes, Texts,Hierarchies (if the InfoObject has access to hierarchies)
    The system automatically generates the transfer structure, the transfer rules, and the communication structure (for attributes and texts).
      4.      Maintaining the transfer structure / transfer rules
    Choose the DataSource to be able to upload hierarchies.
    Idoc transfer method: The system automatically generates a proposal for the DataSource and the transfer structure. This consists of an entry for the InfoObject, for which hierarchies are loaded. With this transfer method, during loading, the structure is converted to the structure of the PSA, which affects performance.
    PSA transfer method: The transfer methods and the communication structure are also generated here. 
    5.      Maintaining the hierarchy:
    Choose Hierarchy Maintenance, and specify a technical name and a description of the hierarchy.
    PSA Transfer Method: You have the option here to set the Remove Leaf Value and Node InfoObjects indicator. As a result, characteristic values are not transferred into the hierarchy fields NODENAME, LEAFFROM and LEAFTO as is normally the case, but in their own transfer structure fields.  This option allows you to load characteristic values having a length greater than 32 characters.
    Characteristic values with a length > 32 can be loaded into the PSA, but they cannot be updated in characteristics that have a length >32.
    The node names for pure text nodes remain restricted to 32 characters in the hierarchy (0HIER_NODE characteristic).
    The system automatically generates a table with the following hierarchy format (for sorted hierarchies without removed leaf values and node InfoObjects):
    The system transfers the settings for the intervals and for time-dependency from the InfoObject maintenance. Depending on which settings you have defined in the InfoObject maintenance, further table fields can be generated from the system.
    The valid from and valid to field is filled if you select Total Hierarchy Time-dependent in the InfoObject maintenance. The time-dependent indicator is activated if you select the Hierarchy Nodes Time-dependent option in the InfoObject maintenance.
    6.      Save your entries.
    Depending on which settings you defined in the InfoObject maintenance, additional fields can be generated from the system. Also note the detailed description for Structure of a Flat Hierarchy File for Loading via an IDoc and for Structure of a Flat Hierarchy File for Loading via a PSA.
    Further Steps:
    Maintaining InfoPackages
    Result
    You have uploaded the hierarchy data for the corresponding characteristic.

  • Data Extraction  or IDOC to flat file

    hi,
    I have a project to create a flat file from SAP, for an external legacy system. There are 3 requirement.
    What approach should I take. Simple data extraction OR Idoc to flat file.
    There are 4 requirements:
    1. first time extract all data.
    2. on subsequent run, extract only changed & new records
    3. if in SAP table, a record is deleted, then marked deleted in flat file.
    What approach should I take if I use data extraction.
    Thanks.

    I read your question, my first thought would be to look at where the data is going?
    What are the data requirements of the legacy system. IDOCs can speed up the development related to pushing the data out from SAP. Using ALE and change pointers you can automatically pass out the delta with a limited amount of development.
    However, the receiving system then needs to parse the IDOC data. depending on the IDOC you are working with this can be a challenge especially if the legacy developer doesn't get IDOCs.
    Sometimes its easier to collect and write the data from SAP using "simple data extraction". The data is more readily organized into a format the receiving system is expecting.
    You can also pass the idoc to a middleware maping application if one is available and do the SAP to legacy mapping there.
    Cheers

  • Syntax error while loading hierarchy from an external file

    Dear Expert:
    I am new to BW and I met a problem today while loading hierarchy from an external file. Actually I am following below article to load the hierarchy:
    /people/prakash.bagali/blog/2006/02/07/hierarchy-upload-from-flat-files
    When I schedule the infopackage, the error message says: "Syntax error in template RSTMPL9C, ROW 76". Actually there is only around 20 lines of records.
    Since I am not familiar with hierarchy load, so:
    1. while loading from external file, do I need to create one hierarchy in advance  through "Maintain Hierarchies" in the infoobject? My understanding is since I can load that hierarchy from file, so I do not need to create one in advance, once the load completed, the hierarchy should automatically generated there. Is my understanding correct?
    2. Before loading the hierarchy, do I need to load the master data of external characteristics in the hierarchy first? Here in my example, the sales hierarchy has 2 external characteritics (Country and region) in the hierarchy. Do I need to load some data first?
    3. My 'Preview' function in the infopackage is gray so that I can not test the data loading. Why is it gray?
    Information like file name, file dir, file type(csv), seperator should be correct there.
    Can anybody help me take a look into that? Many thanks for your time in advance!
    Tim

    Hi ctsiszidane:
    There are some other SAP Notes that can help you solve the problem.  Depending on your Support Package level check which of them is applicable.
    Note 659461 - RSAR 682: Syntax error in template RSTMPL9A, row 246
    Note 605690 - Escape characters are not processed correctly
    Note 620152 - Syntax error in RSTMPL9A during data loading from a file
    Regards,
    Francisco Milán.

  • BW 2.1C Download a hierarchy to a flat file

    Hello
    I copy and paste the BW ABAP source "download a hierarchy to a flat file" in a BW 2.1C system.
    When I check programm a error occurs " The type RSSH_S_HTAB" is unknown.
    Can you help me ?

    Hi,
    DATA : BEGIN OF I_DISPLAY OCCURS 0,
            REC(400),
           END OF I_DISPLAY.
      based on date
      select  StudentNo S_Course  from Course Record
               into  i_Course Record
    ****if parameter
       where date eq  p_Date_join
    ****if select-options.
        where date in  s_Date_join.
    select  StudentNo S_Course  from Student Details
               into  i_Student Details
    ****if parameter
       where date eq  p_Date_join
    ****if select-options.
        where date in  s_Date_join.
    select  StudentNo S_Mark S_Subject
      from Student_results
               into  i_Student_results
    ****if parameter
       where date eq  p_Date_join
    ****if select-options.
        where date in  s_Date_join.
    DATA : FNAME(255) TYPE C VALUE '/data/sapdata/eu_ums/astdetails'.
    CONSTANTS : C_COMMA TYPE C VALUE ','.
    ********Fields to insert
    I_FINAL-StudentNo = 'StudentNo.
    I_FINAL-S_Course = 'S_Course'.
    INSERT I_FINAL INDEX 1.
    CLEAR I_FINAL.
      LOOP AT I_FINAL.
        CONCATENATE
            I_FINAL-DOCNUM
            I_FINAL-STATXT
              into I_DISPLAY-REC SEPARATED BY C_COMMA.
         APPEND I_DISPLAY.
         CLEAR I_DISPLAY.
      ENDLOOP.
    OPEN DATASET FNAME FOR OUTPUT IN TEXT MODE.
          LOOP AT I_DISPLAY.
            TRANSFER I_DISPLAY TO  FNAME.
          ENDLOOP.
        CLOSE DATASET FNAME.
    Do this for all tables.
    Don't forget to reward if useful

  • How to extract text from a PDF file?

    Hello Suners,
    i need to know how to extract text from a pdf file?
    does anyone know what is the character encoding in pdf file, when i use an input stream to read the file it gives encrypted characters not the original text in the file.
    is there any procedures i should do while reading a pdf file,
    File f=new File("D:/File.pdf");
                   FileReader fr=new FileReader(f);
                   BufferedReader br=new BufferedReader(fr);
                   String s=br.readLine();any help will be deeply appreciated.

    jverd wrote:
    First, you set i once, and then loop without ever changing it. So your loop body will execute either 0 times or infinitely many times, writing the same byte every time. Actually, maybe it'll execute once and then throw an ArrayIndexOutOfBoundsException. That's basic java looping, and you're going to need a firm grip on that before you try to do anything as advanced as PDF reading. the case.oops you are absolutely right that was a silly mistake to forget that,
    Second, what do the docs for getPageContent say? Do they say that it simply gives you the text on the page as if the thing were a simple text doc? I'd be surprised if that's the case.getPageContent return array of bytes so the question will be:
    how to get text from this array? i was thinking of :
        private void jButton1_actionPerformed(ActionEvent e) {
            PdfReader read;
            StringBuffer buff=new StringBuffer();
            try {
                read = new PdfReader("d:/getjobid2727.pdf");
                read.getMetaData();
                byte[] data=read.getPageContent(1);
                int i=0;
                while(i>-1){ 
                    buff.append(data);
    i++;
    String str=buff.toString();
    FileOutputStream fos = new FileOutputStream("D:/test.txt");
    Writer out = new OutputStreamWriter(fos, "UTF8");
    out.write(str);
    out.close();
    read.close();
    } catch (Exception f) {
    f.printStackTrace();
    "D:/test.txt"  hasn't been created!! when i ran the program,
    is my steps right?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • How to extract text from a PDF file using php?

    How to extract text from a PDF file using php?
    thanks
    fabio

    > Do you know of any other way this can be done?
    There are many ways. But this out of scope of this forum. You can try this forum: http://forum.planetpdf.com/

  • What is the best way to load and convert data from a flat file?

    Hi,
    I want to load data from a flat file, convert dates, numbers and some fields with custom logic (e.g. 0,1 into N,Y) to the correct format.
    The rows where all to_number, to_date and custom conversions succeed should go into table STG_OK. If some conversion fails (due to an illegal format in the flat file), those rows (where the conversion raises some exception) should go into table STG_ERR.
    What is the best and easiest way to archive this?
    Thanks,
    Carsten.

    Hi,
    thanks for your answers so far!
    I gave them a thought and came up with two different alternatives:
    Alternative 1
    I load the data from the flat file into a staging table using sqlldr. I convert the data to the target format using sqlldr expressions.
    The columns of the staging table have the target format (date, number).
    The rows that cannot be loaded go into a bad file. I manually load the data from the bad file (without any conversion) into the error table.
    Alternative 2
    The columns of the staging table are all of type varchar2 regardless of the target format.
    I define data rules for all columns that require a later conversion.
    I load the data from the flat file into the staging table using external table or sqlldr without any data conversion.
    The rows that cannot be loaded go automatically into the error table.
    When I read the data from the staging table, I can safely convert it since it is already checked by the rules.
    What I dislike in alternative 1 is that I manually have to create a second file and a second mapping (ok, I can automate this using OMB*Plus).
    Further, I would prefer using expressions in the mapping for converting the data.
    What I dislike in alternative 2 is that I have to create a data rule and a conversion expression and then keep the data rule and the conversion expression in sync (in case of changes of the file format).
    I also would prefer to have the data in the staging table in the target format. Well, I might load it into a second staging table with columns having the target format. But that's another mapping and a lot of i/o.
    As far as I know I need the data quality option for using data rules, is that true?
    Is there another alternative without any of these drawbacks?
    Otherwise I think I will go for alternative 1.
    Thanks,
    Carsten.

  • Reading special characters from a flat file and inserting into DB

    I'm reading data with special characters like . etc from a flat file , assigning the data to variable in my anonymous block and inserting into my DB. But the show up as inverted ? s. Any clues about how to do this?
    If i try to do the insert directly it works. It seems like the error occurs when reading this data into a variable
    thanks for the help
    Lalit Bhatia

    lalit, this is probably an character set problem, the default on Database creation tends to be 7bit Ascii which does not support special characters, it's been a while since I set up a db in this way, but you need to change settings in oracle.ini. The db will need to be restarted for this. Also, to check current settings try:
    select * from NLS_DATABASE_PARAMETERS
    You want an 8bit, unicode or multibyte character set. Sorry I cannot remember moer off the top of my head, try searching on NLS or character set

Maybe you are looking for

  • How to create Web Service based on PI WSDL message

    Hi all, we have following scenario: Within PI (version 7.1) we set up a message type and inbound service interface. This service interface should send the PI message to a web service running on a SAP J2EE (version 7.01). As the PI message is sent as

  • User can't print from Reader, tried multiple troubleshooting steps

    Working with a client who can no longer print from Reader (v11.0.10). Windows 7 Pro x86 machine.  Tried printing after each of the following steps: Rebooted PC Restarted Print Spooler service Uninstalled/Reinstalled Reader v11 (from fresh download) S

  • Getting repeated values when reading from a text file.

    I need to read from a text file. When the token encounters a particular word (command) I need to read the next line and perform some actions. However, this part is working but it is repeating the values again and again until it encounters the next pa

  • Naming components created in a loop?

    I asked this once before, but none of the answers work in this case. I am creating a series of components as children of a viewstack based on XML loaded.  I am looping through the XML and instancing a component for each node. private function createS

  • Shipment cost condition not copied in the billing document

    hi I have created shipment for the delivery and compelted the shipment cost as well , however when i create the billing document the shipment cost conditions are not copied in to the billing document. i have already set up pricing source as F in copy