Split data into packages

Hello,
please could you tell me how i can split the data of an internal table into datapackages in my FM used for BI data extraction?
thanks!
MArgit

I believe you asked your question in a better way in this thread :
Re: Open Cursor - internal table
I did answer here,give it a try.

Similar Messages

  • Split data into different fields in TR

    I have a flat file with space (multiple spaces between different fields) as a delimiter. The problem is, file is coming from 3rd party and they don't want to change the separator as comma or tab delimited CSV file. I have to load data in ODS (BW 3x).
    Now I am thinking to load line by line and then split data into different objects in Transfer rules.
    The Records looks like:
    *009785499 ssss BC sssss 2988 ssss 244 sss 772 sss  200
    *000000033 ssss AB ssss        0  ssss   0 ssss 0 ssss 0
    *000004533 ssss EE ssss        8  ssss   3 ssss 2 ssss 4
    s = space
    Now I want data to split like:
    Field1 = 009785499
    Field2 = BC
    Field3 = 2988
    Field4 = 244
    Field5 = 772
    Field6 = 200
    After 1st line load, go to 2nd line and split the data as above and so on. Could you help me with the code pleaseu2026?
    Is it a good design to load data? Any other idea?
    I appreciate your helps..

    Hi,
    Not sure how efficient this is, but you can try an approach on the lines of this link /people/sap.user72/blog/2006/05/27/long-texts-in-sap-bw-modeling
    Make your transfer structure in this format. Say the length of each line is 200 characters. Make the first field of the structure of length 200. That is, the length of Field1 in the Trans Struc will be 200.
    The second field can be the length of Field2 as you need in your ODS, and similarly for Field3 to Field6. Load it as a CSV file. Since there are no commas, the entire line will enter into the first field of the Trans Structure. This can be broken up into individual fields in the Transfer Rules.
    Now, in your Start Routine of transfer rules, write code like this (similar to the ex in the blog):
    Field-symbols <fs> type transfer-structure.
    Loop at Datapak assigning <fs>.
        split <fs>-Field1 at 'ssss' into <fs>-field1 <fs>-field2 <fs>-field3....
        modify datapak from <fs>
    endloop.
    Now you can assign Field1 of Trans Struc to Field1 of Comm Struc, Field2 of Trans Struc to Field2 of Comm Struc and so on.
    Hope it helps!
    Edited by: Suhas Karnik on Jun 17, 2008 10:28 PM

  • Split dates into date range windows

    Hi,
    I have a peculiar requirement to create windows for different dates.
    For example I have two date ranges (two rows in the table column
    Start Date End Date
    01-Jan 28-Feb
    15-Jan 14-Feb (this starts between the previous date range i.e. 01-Jan to 28-Feb)
    I have to split dates in a way so that it creates different windows with start and end date i.e.
    Start Date End Date
    01-Jan 15-Jan (15Jan because it comes before 28 Feb)
    16-Jan 14-Feb ( 14Feb as it comes before 28 Feb)
    15-Feb 28-Feb
    Is there any sql function which can be used to achieve this? or any help you can provide? Thanks.
    -Salman

    Welcome to the forum!
    Unfortunately you posted to the wrong forum. This forum is for sql developer only.
    Repost you question in the SQL and PL/SQL forum and you will get help there.
    Please mark this question ANSWERED to people will follow up in the other forum.

  • Splitting date into year and month

    Hi,
       I am getting it_final-bedat (dd.mm.yyyy).I need to split month as well as year in separate fields
    in the internal table.tell some ideas.

    hi badri , try this program , hope this is u r requirement
    data : BEGIN OF itab OCCURS 0 ,
           pernr like  pa0001-pernr,
           begda like  pa0002-begda,
          END OF itab .
    data : BEGIN OF itab2 OCCURS 0 ,
           pernr like  pa0001-pernr,
           d_date type c LENGTH 2  ,
           d_month type c length 2,
           d_year  type c length 4 ,
          END OF itab2 .
    select pernr begda from pa0001 into CORRESPONDING FIELDS OF TABLE itab WHERE pernr eq 1000.
    loop at itab WHERE pernr eq 1000 .
    clear itab2[].
        itab2-pernr = itab-pernr.
        itab2-d_year = itab-begda+0(4).
        itab2-d_month = itab-begda+4(2).
        itab2-d_date = itab-begda+6(2).
        append itab2.
        write :/ itab2-pernr,
                 itab2-d_date,
                 itab2-d_month,
                 itab2-d_year.
        endloop .
    regards
    chinnaiya

  • Split dates into different shifts.

    Hello all,
    I'm trying to setup a query to get my date ranges into 8 hour shifts which start at 23:00, 07:00, and 15:00.
    create table t (start_date, end_date)
    insert into t values (to_date('11-21-12 21:02:15', 'MM-dd-yy HH24:MI:ss'), to_date('11-21-12 21:02:51', 'MM-dd-yy HH24:MI:ss'));
    insert into t values (to_date('11-21-12 21:09:06', 'MM-dd-yy HH24:MI:ss'), to_date('11-24-12 23:30:18', 'MM-dd-yy HH24:MI:ss'));
    insert into t values (to_date('11-24-12 23:35:28', 'MM-dd-yy HH24:MI:ss'), to_date('11-24-12 23:49:34', 'MM-dd-yy HH24:MI:ss'));Desired output:
    START_DATE        | END_DATE
    11-24-12 23:35:28 | 11-24-12 23:49:34
    11-24-12 23:00:00 | 11-24-12 23:30:18
    11-24-12 15:00:00 | 11-24-12 23:00:00
    11-24-12 07:00:00 | 11-24-12 15:00:00
    11-23-12 23:00:00 | 11-24-12 07:00:00
    11-23-12 15:00:00 | 11-23-12 23:00:00
    11-23-12 07:00:00 | 11-23-12 15:00:00
    11-22-12 23:00:00 | 11-23-12 07:00:00
    11-22-12 15:00:00 | 11-22-12 23:00:00
    11-22-12 07:00:00 | 11-22-12 15:00:00
    11-21-12 23:00:00 | 11-22-12 07:00:00
    11-21-12 21:09:06 | 11-21-12 23:00:00
    11-21-12 21:02:15 | 11-21-12 21:02:51Version:
    Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
    PL/SQL Release 11.2.0.2.0 - Production
    Is this possible?
    Thanks in advance!

    Hi,
    Tarianz wrote:
    ... How would I go about adding another column into this?
    I've been messing around with the query trying to add it myself but have been unsuccessful.
    Similar to:
    *ID is the order the dates were inserted into the table.
    ID| START_DATE        | END_DATE
    3| 11-24-12 23:35:28 | 11-24-12 23:49:34
    2| 11-24-12 23:00:00 | 11-24-12 23:30:18
    2| 11-24-12 15:00:00 | 11-24-12 23:00:00 ...
    That sounds like a job for the analytic ROW_NUMBER function.
    ROW_NUMBER () OVER (ORDER BY x, y, z)     AS t_id   -- id is an Oracle keywordwhere x, y and z are the columns or expressions that indicate the order you want. You can have any number of such expressions (1 or more), and you can use <b>DESC</b>ending order if you want to.
    If the combination (x, y, z) is not unique, that is, if 2 or more rows were added at the same time, then ROW_NUMBER will give them distinct numbers, but there's no telling which number will be lower.
    You need to do this when first using table t, before the rows are split into shifts. In the query I suggested, you could add the expression above in sub-query got_shift_num.
    So if the rows were INSERTed into the table in the same order as start_date, then you could do this:
    WITH     got_base_date     AS
         SELECT     TRUNC (SYSDATE) + (7 / 24)     AS base_date
         FROM     dual
    ,     got_shift_num     AS
         SELECT     t.start_date, t.end_date
         ,     b.base_date
         ,     FLOOR ( (t.start_date - b.base_date)
                    * 3
                    )          AS start_shift_num
         ,     FLOOR ( (t.end_date - b.base_date)
                    * 3
                    )          AS end_shift_num
         ,     ROW_NUMBER () OVER (ORDER BY t.start_date)     -- ***** NEW *****
                           AS t_id                         -- ***** NEW *****
         FROM    got_base_date  b
         CROSS JOIN            t
    ,     cntr     AS
         SELECT  LEVEL - 1     AS n
         FROM     (
                  SELECT  MAX ( end_shift_num
                                - start_shift_num
                        )     AS max_shift_cnt
                  FROM    got_shift_num
         CONNECT BY     LEVEL <= 1 + max_shift_cnt
    SELECT       s.t_id                              -- ***** NEW *****
    ,       GREATEST ( s.start_date
                   , s.base_date + ( ( s.start_shift_num
                                  + c.n
                           / 3
                 )     AS shift_start_date
    ,       LEAST    ( s.end_date
                   , s.base_date + ( ( s.start_shift_num
                                  + c.n
                             + 1
                           / 3
                 )     AS end_start_date
    ,       start_date, end_date          -- For debugging
    FROM       got_shift_num  s
    JOIN       cntr           c  ON c.n  <= s.end_shift_num - s.start_shift_num
    ORDER BY  shift_start_date  DESC
    ;This is exactly what I posted yesterday, only with 3 lines, marked "***** NEW *****", added.
    You could modify Solomon's suggestion, using ROW_NUMBER in sub-query a.

  • How can split data into multiple sheets using an excel template

    Hi all,
    I'm using BIP 10.1.3.4.1 upgrated with the latest rollup patch, 9546699.
    I followed the example inside the article "Real Excel Templates 1.5" (on the Tim Dexter's blog)
    http://blogs.oracle.com/xmlpublisher/2010/05/real_excel_templates_i.html
    and I built my report directly from an excel template containing only one sheet (plus the XDO_METADATA sheet), and for one sheet it worked fine !!!
    Now I need to add more sheets to the template.... and I have two big questions:
    1. if I need to create a second sheet which contains almost the same data (with a different layout), I saw that it is not possible to map a value to more than 1 cell....so if I map a value in the first sheet, I can't map it in the second sheet (because it's already used in the first one).
    How can I map same values into two or different execll
    2. if I need to create a second sheet which contains another dataset (completely different from the dataset in the first sheet), I can I do, considering that every BIP report is based on ONLY a data source.
    Tim wrote: The most impressive, for me at least, is the sheet 'bursting'. You can split your hierarchical data across multiple sheets and dynamically name those sheets
    but I didn't yet understand how this bursting it's possible.....considering what I said above.....
    Surely I've a lack of knowledge.....but anybody can help me to understanding the "multiple excel sheets" black hole ?
    I'll appreciate any kind of help
    Thanks in advance
    Alex

    You can find working solution here http://xlspe.com

  • Select-options split date into month and assign to low and high

    Hi,
       In my select-options i am giving BEDAT (01.04.2004 TO 30.10.2005).I need to split month and
    year in separate fields.that is
    select-option_low-month in one field
    select-option_high-month in second field
    select-option_low-year in third field
    select-option_high-year in fourth field.
    Finally i need to move these four fields to it_final.
    select * from mbewh into corresponding fields of table it_mbewh
               for all entries in it_final where matnr = it_final-matnr and
               bwkey = it_final-werks and lpmon = ? and lfgja = ?
               and  bklas <> ' '.
    what input i have to give in lpmon and lfgja in select query to get for lfmon (04 to 10)
    and lfgja (2004 to 2005).
    suggest some ideas.

    Hi ,
    Can you please check the following code.
    Hi ,
    data :  l_low_yr(4),
              l_high_yr(4),
              l_low_mon(2),
              l_high_mon(2).
    Splitting the select option date to month and year into low and higher values
    l_low_yr        =   s_date-low+00(04). "  Year low value from the date range
    l_low_mon    =   s_date-low+04(02). "  Month low value from the date range
    l_high_yr      =   s_date-high+00(04)."  Year high value from the date range
    l_high_mon   =   s_date-high+04(02)." Month high value from the date range
    selecting the data from the table mbewh based on some conditions.
    select * from mbewh into corresponding fields of table it_mbewh
               for all entries in it_final where matnr = it_final-matnr and
               bwkey = it_final-werks and lfmon BETWEEN  l_low_mon and l_high_mon
    and lfgja BETWEEN l_low_yr and l_high_yr   and  bklas EQ  ' '.
    This select will retrive the desired data records from the table MBEWH.
    Please let me know if this works according to your requirement.
    Thanks and Regards
    Saritha

  • How to split data into tables based on the entries in a column?

    My problem is very similar to this thread: how to link data from one numbers sheet to another sheet, however I could get it to work the way described there. I have one big table for entering data (the first one). I would like to have a few other tables populated automatically based on the entries in one of the columns of the first table. In my example below I put everything in one sheet for clarity. The selection to the other tables is to be done on the column "fruit" in the first table. (second one is "oranges", then "apples" and then "pears" -- had to cut the width of my screenshot due to the limitations of Apple's forums).
    Here is what it would look like, just cannot figure out how to make it happen automatically.
    Tried also importing similar Excel example to Numbers, but the import did not work correctly.
    Any help will be appreciated.
    LD

    Larry,
    Here's an approach that I've used...
    In the Purchases table, Aux column, the expression is:
    =COUNTIF($A$1:A2, A) & "-"&A
    Fill Down
    This expression builds a string that identifies the item and the ocurrance of that item.
    The Date column of the Summary tables, cell a3, contains:
    =IF(ROW()-3<COUNTIF(Purchases :: $A,$A$1), LOOKUP(ROW()-2&"-"&$A$1, Purchases :: $F, Purchases :: B), "")
    Fill Across, then fill down.
    Regards,
    Jerry

  • Append split data into internal table w.r.t fields

    Hai friends,
    I am getting the data matnr : 13235,12124,34234
    and maktx : aaaa,bbbb , cccc
    and lgort : 234, 345, 456
    But I have taken the structure as begin of itab
    matnr like -
    maktx like -
    lgort like-----,
    end of itab.
    now the data as i need to append first row as 13235 to matnr
    aaaa to maktx
    234 to lgort,
    and second row as 12124 to matnr
    bbbb to maktx
    345 to lgort
    and same as third row
    Iam spliting the data but the problem is here matnr is variable i.e based on counter of matnr it should append those no of rows
    please give the solution,
    prasad.

    Hi Prasad,
    Loop at i_matnr.
      itab-matnr = i_matnr-matnr.
      Read table i_maktx with key matnr = i_matnr-matnr.
      if sy-subrc = 0.
       itab-maktx = i_maktx-maktx.
      endif.
      Read table i_lgort with key matnr = i_matnr-matnr.
      if sy-subrc = 0.
       itab-lgort = i_lgort-lgort.
      endif.
      append itab.
    Endloop.

  • Splitting data equaly from one .mdf to several .ndf files

    Hi all,
    Situation:
    We have a db with 1 TB of data in one .mdf file (sql 2012).
    For better performance we want to split this file up into 4 equaly big data files on different drives.
    1st guess:
    Well I thought that's pretty simple, I just add 4 datafiles (.ndf) on different drives, empty my existing .mdf and drop it finaly.
    Well the problem with this is, you cannot delete your .mdf file because it holds metadata (catalog) for your db.
    Solution:
    - I added 3 more datafiles (.ndf) with 250 GB size each, autogrow disabled, on 3 additional drives (no new filegroup)
    - DBCC SHRINKFILE (your_logical_mdf_file, EMPTYFILE)
      (this gives you an error because there is not enough diskspace to split the 1TB .mdf file into 3 x 250 GB .ndf files, but it splits your 1 TB file equaly to all your 4 db files)
    - shrinked my .mdf file and adjusted filesize and autogrow settings for all 4 db files
    Remark:
    Just keep in mind that moving 1 TB of data around takes a while and you better do this in a not so busy time...
    HTH
    acki4711

    Neha,
    I don't see any advantage of the IO with filegroups.
    We don't want to deal with what object should be in what filegroup, (most of the time we maintain 3rd party software/dbs) just want to get better performance by splitting data into more then one db file.
    acki4711
    You could benefit from performance by splitting data in upto 4 or 8 files and each file on a different drive.
    How are the underlying disks configured, do you know? Otherwise, if all of these volumes are carved out of a single lun then there won't be a performance gain that you are looking for. Also, please enable TF 1117 for uniform db file growth once you size
    the files to be of equal size.
    Note: You may want to test the emptyfile option on your .mdf file, as it may not be straightfoward.
    HTH
    Hello AlliedDBA,
    There is no benefit by splitting database files on different disk drives if your Underlying hardware is RAID 10 or RAID 5 you can achieve performance benefit.Daa to data files are written in Round robin fashion and you dont have any control over it.
    Please dont enable any Trace flag.I am not sure what could be solution beacause IMO you anyhow require space
    Please mark this reply as the answer or vote as helpful, as appropriate, to make it useful for other readers
    Hello Shanky..
    Thanks for your feedback, but, I still stand by my suggestion. I see you are opinionating here, so please post some facts to back your claims that 1. No advantage of having multiple files 2. Not sure why your are scared of the term Trace flag but your
    statement "IMO anyhow require space" lacks clarity..What is the relationship between space and trace flag??

  • Abap code for splitting date needed

    Hi Experts,
    I need ABAP code or a function module to split date into date, month and year. As I have very little knowledge in ABAP, I do not know how to do it. Kindly help me.
    Thanks in advance,
    With Kind Regards,
    Kannan

    Hello kannan,
    I tried writing this program , it worked for me .
    PARAMETERS : date(10) TYPE c default '24.12.2014',
                  dd(2) type c,
                  mm(2) type c,
                  yyyy(4) type c.
    split date at '.' into dd mm yyyy.
    WRITE : / 'Day: ', dd.
    WRITE : / 'Month: ', mm.
    WRITE : / 'Year: ', yyyy.
    If you feel this program suits  you try this as well.

  • Help needed with SQL to split huge data into two excel or text files.

    Hi,
    I have a table which has around 1850000 records. I want to split the data into two sets and import the data in .txt or execl file.
    How can i break upthe records using rownum or any thing
    select * from tablename where rownum<940000 fetched some records
    but
    when i gave select * from tablename where rownum>940000 it was not fetching records.
    Guideme

    when i gave select * from tablename where rownum>940000 it was not fetching records.try this
    select * from (select tablename.*, rownum rn from tablename) where rn >940000

  • How To UPLOAD a DATA (.DAT) fiel from PC to internal table and then split it into the data different columns

    Hi all,
    I am new to ABAP Development. I need to upload a .DAT file (the file doesn#t have any proper structure-- Please find the .DAT file in the attachment). After uploading the DATA (.DAT) fiel I need to split in into different columns. Refering the attached .DAT fiel the fields in bracets like:
    [Arbeitstag],  [Pecunia], [Mita], [Kunde], [Auftrag] and  [Position] are different fields that need to be arranged in columns in an internal table. this .DAT fiel which I want to upload and then SPLIT it into various fields will will treated as MASTER DATA table for further programming. The program that I had written is as below. Also please refer the attached .DAT table.
    Please if any one could help me. i searched a lot in different forums but couldn't find me  a solution. Also note that the attached fiel is in text (.txt) format here but in real situation the same fiel is in DATA (.DAT) format.
    *& Report  ZDEMO_ZEITERFASSUNG9
    REPORT  ZDEMO_ZEITERFASSUNG9.
    Types: Begin of ttab,
            Rec(1000) type c,
           End of ttab.
    DATA: itab  type table of ttab.
    DATA: wa_tab type ttab.
    DATA: file_str type string.
    Parameters: p_file type localfile.
    At selection-screen on value-request for p_file.
                                           CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
                                            EXPORTING
    *                                          PROGRAM_NAME        = SYST-REPID
    *                                          DYNPRO_NUMBER       = SYST-DYNNR
    *                                          FIELD_NAME          = ' '
                                               STATIC              = 'X'
    *                                          MASK                = ' '
                                             CHANGING
                                               file_name           = p_file.
    *                                        EXCEPTIONS
    *                                          MASK_TOO_LONG       = 1
    *                                          OTHERS              = 2
    Start-of-Selection.
      file_str = P_file.
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          filename                      = '\\10.10.1.92\Volume_1\_projekte\Zeiterfassung-SAP\BUP_ZEIT.DAT'   " This the file  source address
          FILETYPE                      = 'DAT'
          HAS_FIELD_SEPARATOR           = ';'
    *     HEADER_LENGTH                 = 0
    *     READ_BY_LINE                  = 'X'
    *     DAT_MODE                      = ' '
    *     CODEPAGE                      = ' '
    *     IGNORE_CERR                   = ABAP_TRUE
    *     REPLACEMENT                   = '#'
    *     CHECK_BOM                     = ' '
    *     VIRUS_SCAN_PROFILE            =
    *     NO_AUTH_CHECK                 = ' '
    *   IMPORTING
    *     FILELENGTH                    =
    *     HEADER                        =
        tables
          data_tab                      = itab
       EXCEPTIONS
         FILE_OPEN_ERROR               = 1
         FILE_READ_ERROR               = 2
         NO_BATCH                      = 3
         GUI_REFUSE_FILETRANSFER       = 4
         INVALID_TYPE                  = 5
         NO_AUTHORITY                  = 6
         UNKNOWN_ERROR                 = 7
         BAD_DATA_FORMAT               = 8
         HEADER_NOT_ALLOWED            = 9
         SEPARATOR_NOT_ALLOWED         = 10
         HEADER_TOO_LONG               = 11
         UNKNOWN_DP_ERROR              = 12
         ACCESS_DENIED                 = 13
         DP_OUT_OF_MEMORY              = 14
         DISK_FULL                     = 15
         DP_TIMEOUT                    = 16
         OTHERS                        = 17
      IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      LOOP at itab into wa_tab.
            WRITE: / wa_tab.
      ENDLOOP.
    I will be grateful to all you experts for ur inputs
    regards
    Chandan Singh

    For every Auftrag, there are multiple Position entries.
    Rest of the blocks don't seems to have any relation.
    So you can check this code to see how internal table lt_str is built whose first 3 fields have data contained in Auftrag, and next 3 fields have Position data. The structure is flat, assuming that every Position record is related to preceding Auftrag.
    Try out this snippet.
    DATA lt_data TYPE TABLE OF string.
    DATA lv_data TYPE string.
    CALL METHOD cl_gui_frontend_services=>gui_upload
      EXPORTING
        filename = 'C:\temp\test.txt'
      CHANGING
        data_tab = lt_data
      EXCEPTIONS
        OTHERS   = 19.
    CHECK sy-subrc EQ 0.
    TYPES:
    BEGIN OF ty_str,
      a1 TYPE string,
      a2 TYPE string,
      a3 TYPE string,
      p1 TYPE string,
      p2 TYPE string,
      p3 TYPE string,
    END OF ty_str.
    DATA: lt_str TYPE TABLE OF ty_str,
          ls_str TYPE ty_str,
          lv_block TYPE string,
          lv_flag TYPE boolean.
    LOOP AT lt_data INTO lv_data.
      CASE lv_data.
        WHEN '[Version]' OR '[StdSatz]' OR '[Arbeitstag]' OR '[Pecunia]'
             OR '[Mita]' OR '[Kunde]' OR '[Auftrag]' OR '[Position]'.
          lv_block = lv_data.
          lv_flag = abap_false.
        WHEN OTHERS.
          lv_flag = abap_true.
      ENDCASE.
      CHECK lv_flag EQ abap_true.
      CASE lv_block.
        WHEN '[Auftrag]'.
          SPLIT lv_data AT ';' INTO ls_str-a1 ls_str-a2 ls_str-a3.
        WHEN '[Position]'.
          SPLIT lv_data AT ';' INTO ls_str-p1 ls_str-p2 ls_str-p3.
          APPEND ls_str TO lt_str.
      ENDCASE.
    ENDLOOP.

  • Reading fixed length flatfile & splitting it into header and lineitem data

    Hi Friends,
    I am reading a fixed length flat file from application server into an Internal table.
    But problem is, data in flat file is in the below format with fixed start and end positions.
    1 - 78 -  control header
    1 - 581 - Invoice header data
    1 - 411 - Invoice Line item data
    1 - 45 -   trailer record
    There will be one control header and one trailer record per file and number of invoice headers and its line items can vary.
    There is unique identifiers to identify as below.
    Control header - starts with 'CHR'
    Invoice Header starts with - '000'
    Invoice Lineitem stats with - '001'
    trailer record - starts with 'TRL'
    So its like
    CHR.......control  data..(79)000.....header data...(660)001....lineitem1...(1481)001...lineitem2....multiples of 411 and 581 and ends with... TRL...trailer record..
    (position)
    I am first reading the data set and store in internal table with a field of 255char.
    by looping on above ITAB i have to split it into Header records and line item records.
    Did anyone face this kind of scenario before. If yes appreciate if you can throw some ideas on logic to split this data.
    Any help in splitting up the data is highly appreciated.
    Regards,
    Simha
    ITAB declaration
    DATA: BEGIN OF ITAB OCCURS 0,
                   FIELD(255),
               END OF ITAB,
                lt_header type table of ZTHDR,
                lt_lineitem type table of ZTLINITM.

    Hi,
    i am sending sample code which resembles your requiremeant.
    data: BEGIN OF it_input OCCURS 0, "used for store all the data in one line.
          line type string ,
          END OF it_input,
          it_header type TABLE OF string WITH HEADER LINE,"use to store all header with corresponding items
          it_item   type TABLE OF string WITH HEADER LINE.."used to store all item data
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        filename                      = 'd:\test.txt'
      FILETYPE                      = 'ASC'
      HAS_FIELD_SEPARATOR           = ' '
      HEADER_LENGTH                 = 0
      READ_BY_LINE                  = 'X'
      DAT_MODE                      = ' '
      CODEPAGE                      = ' '
      IGNORE_CERR                   = ABAP_TRUE
      REPLACEMENT                   = '#'
      CHECK_BOM                     = ' '
      VIRUS_SCAN_PROFILE            =
      NO_AUTH_CHECK                 = ' '
    IMPORTING
      FILELENGTH                    =
      HEADER                        =
      tables
        data_tab                      = it_input
    EXCEPTIONS
      FILE_OPEN_ERROR               = 1
      FILE_READ_ERROR               = 2
      NO_BATCH                      = 3
      GUI_REFUSE_FILETRANSFER       = 4
      INVALID_TYPE                  = 5
      NO_AUTHORITY                  = 6
      UNKNOWN_ERROR                 = 7
      BAD_DATA_FORMAT               = 8
      HEADER_NOT_ALLOWED            = 9
      SEPARATOR_NOT_ALLOWED         = 10
      HEADER_TOO_LONG               = 11
      UNKNOWN_DP_ERROR              = 12
      ACCESS_DENIED                 = 13
      DP_OUT_OF_MEMORY              = 14
      DISK_FULL                     = 15
      DP_TIMEOUT                    = 16
      OTHERS                        = 17
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    LOOP AT  it_input.
       write : it_input-line.
    ENDLOOP.
    before doing the below steps just takethe controle record and trail record cutt of from the table input based up on the length
      split it_input-line AT '000' INTO TABLE it_header IN CHARACTER MODE.
      LOOP AT  it_header.
        split it_header AT '0001' INTO TABLE it_item IN CHARACTER MODE.
        write :/ it_header.
      ENDLOOP.
    after this you need to cut the records in tocorresponding  fields in to respective tables by putting loop on item and header table as i decleared above.
    i think this may solve your problem you need to keep some minnor effort.
    Regaurds,
    Sree..

  • What is the best protocol to import data into sqlserver using an SSIS Package?

    Im trying to import data into SQL Server from EXCEL with an SSIS package. In my data flow I am using "Excel Source" object and an "OLE DB Command" object.  Im getting the following error message, "...Excel Connection Manager"
    is an incorrect type....."  May someone explain why I get this and point me in the right direction in choosing the proper source for my package so I can complete my task.  Thanks.

    Hi jsorrisone,
    The data type mismatch issue is a common issue when using Excel Source in SSIS. The Excel driver recognizes only a limited set of data types. The following section of the document
    Excel Source should point you in the right direction:
    The Excel driver recognizes only a limited set of data types. For example, all numeric columns are interpreted as doubles (DT_R8), and all string columns (other than memo columns) are interpreted as 255-character Unicode strings (DT_WSTR). Integration
    Services maps the Excel data types as follows:
    Numeric – double-precision float (DT_R8)
    Currency – currency (DT_CY)
    Boolean – Boolean (DT_BOOL)
    Date/time – datetime (DT_DATE)
    String – Unicode string, length 255 (DT_WSTR)
    Memo – Unicode text stream (DT_NTEXT)
    Integration Services does not implicitly convert data types. As a result, you may need to use Derived Column or Data Conversion transformations to convert Excel data explicitly before loading it into a non-Excel destination, or to convert non-Excel data
    before loading it into an Excel destination. In this case, it may be useful to create the initial package by using the Import and Export Wizard, which configures the necessary conversions for you. Some examples of the conversions that may be required include
    the following:
    Conversion between Unicode Excel string columns and non-Unicode string columns with specific codepages
    Conversion between 255-character Excel string columns and string columns of different lengths
    Conversion between double-precision Excel numeric columns and numeric columns of other types
    If you need further help, post the complete error message as well as the data nature in your Excel source file for further analysis.
    Regards,
    Mike Yin
    TechNet Community Support

Maybe you are looking for