Upload Comma separated Text file.

Hi all ,
i would like to upload a comma seperated text file into an internal table using CL_GUI_FRONTEND_SERVICES=>GUI_UPLOAD but am not able to load correctly. Please let me know any aditional parameters should be pass to this FM.
data **********
060000012,1001,01052005,2.5,C123,0198345678912
08000001,1001,01052005,5.0,C123,016545678912
08000001,1002,02052005,2.5,C234,012345678912
types  : Begin of ty_itab,
pernr(10),
ABS_ATT_TYPE(4),
REC_CCTR(10),
work_order(12),
date(8),
hours(8).
types: end of ty_itab.
data : itab type standard table of ty_itab with header line .
CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_UPLOAD
  EXPORTING
    FILENAME                = 'C:\LOAD.TXT'
     FILETYPE                = 'ASC'
    HAS_FIELD_SEPARATOR     = 'X'
   HEADER_LENGTH           = 0
   DAT_MODE                = SPACE
   CODEPAGE                = SPACE
   IGNORE_CERR             = ABAP_TRUE
   REPLACEMENT             = '#'
   READ_BY_LINE            = 'X'
IMPORTING
   FILELENGTH              =
   HEADER                  =
  CHANGING
    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
    NOT_SUPPORTED_BY_GUI    = 17
    ERROR_NO_GUI            = 18
    others                  = 19
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
           WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Thx
Palani

as you are telling that is comma delimited then save the file as comma delimited,
this can be done uisng excel , open the text fiel with excel and save it as .csv file. and try ...
or else i will tell another solution for it...
Data: begin of itab occurs 0,
      rec(1000) type c,
      end of itab.
Data: begin of itab2 occurs 0,
      matnr type mara-matnr
      werks type marc-werks
      quant(10) type c.
      end of itab2.
  file = 'C:test.txt'.
  call method cl_gui_frontend_services=>gui_upload
    exporting
      filename                = file
    filetype                = 'ASC'
     has_field_separator     = 'X'
    changing
      data_tab                = itab
  exceptions
    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.
clear itab2.
split itab-rec at ',' into itab2-matnr
                           itab2-werks
                           itab2-quant.
append itab2.
endloop.
you can do using any of the one...

Similar Messages

  • Uploading comma delimited text file

    Dear Experts,
    I want to upload comma delimited text file in sap and get that values into internal table
    Can any 1 provide a sample code ??
    thanx in advance.

    Hi Suchitra ,
    There is FM GUI_UPLOAD which will help you in this.
    Its has got one parameter calles has_field_separator . Here you can pass comma. So that this will take care while uploading the data in Internal table.
    CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          filename                      = wf_file
          filetype                      = 'ASC'
          has_field_separator           = ','
    *   HEADER_LENGTH                 = 0
    *   READ_BY_LINE                  = 'X'
    *   DAT_MODE                      = ' '
    *   CODEPAGE                      = ' '
    *   IGNORE_CERR                   = ABAP_TRUE
    *   REPLACEMENT                   = '#'
    *   CHECK_BOM                     = ' '
    * IMPORTING
    *   FILELENGTH                    =
    *   HEADER                        =
        TABLES
          data_tab                      = it_data
       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
    Hope this will help you.
    Regards,
    Nikhil

  • Comma separated Excel file FCC?

    Hi Experts,
    I have an excel file like below (I have just mentioned the row n column to give an idea):
    first name(A1), last name(B1), street (C1) city(D1), state(E1)
    John (A2), Smith(B2), MacArthur(C2), Dallas(D2), TX(E2)
    Mike(A3), Dale(B3), Main St(C3), Austin(D3), TX(E3)
    Kevin(A4), Costner(B4), 2nd Steert(C4), Houston(D4), TX(E4)
    Can I tranform this into xml out-of-the box using XI 3.0 file adapter file content conversion? If I have to use the module, is there as stadard module available or should have to build from scratch?
    If I open the excel file in notepad, it opens as comma separated text file
    first name,last name, street,city,state
    John,Smith,MacArthur,Dallas,TX
    Mike,Dale,Main St,Austin,TX
    Kevin,Costner,2nd Steert,Houston,TX
    How do I do FCC for the above CSV file? I mean I have one header with the field names and remaings rows as record sets.

    > I have an excel file like below (I have just mentioned the row n column to give an idea):
    >
    PI Standard Adapter will not support Execl files.,there is no standard module available, you have to develop adapter module to process EXCEL files.
    >
    > Can I tranform this into xml out-of-the box using XI 3.0 file adapter file content conversion? If I have to use the module, is there as stadard module available or should have to build from scratch?
    >  If I open the excel file in notepad, it opens as comma separated text file
    >
    If you have comma separated values in text file then you can use file content conversion to convert CSV file in to XML,standard adapter will support this.
    > How do I do FCC for the above CSV file? I mean I have one header with the field names and remaings rows as record sets.
    search in sdn , many blogs available on the same  ,converting CSV to XML it is very easy.
    Regards,
    Raj

  • Comma delimited text file using pl/sql ???

    Hi friends
    I want to create a comma delimited text file from emp table like using pl/sql program. I have oracle 8.0.4.0.0 production.
    emp.txt
    7844,TURNER,SALESMAN,7698,08-SEP-81,1500,0,30
    7876,ADAMS,CLERK,7788,23-MAY-87,1100,,20
    7900,JAMES,CLERK,7698,03-DEC-81,950,,30
    Thanks
    Sai

    Hi Justin
    I traced out the error message, is below,
    1 declare
    2 fh utl_file.file_type;
    3 d varchar2(20) := 'sample data';
    4 sql_err number(10);
    5 error_info varchar2(60);
    6 begin
    7 fh := utl_file.fopen('c:\','A.TXT','A');
    8 utl_file.put(fh,d);
    9 dbms_output.put_line('file created');
    10 d:='&urdata';
    11 utl_file.putf(fh,'\n given data is %s\n',d);
    12 utl_file.put_line(fh,'this is last line');
    13 utl_file.put(fh,'hello');
    14 utl_file.fflush(fh);
    15 utl_file.fclose(fh);
    16 exception
    17 when others then
    18 sql_err := SQLCODE;
    19 error_info := SQLERRM;
    20 dbms_output.put_line(SQL_ERR||'-'||error_info);
    21 if utl_file.is_open(fh) then
    22 utl_file.fclose(fh);
    23 end if;
    24* end;
    SQL> /
    Enter value for urdata: TEST
    old 10: d:='&urdata';
    new 10: d:='TEST';
    1-User-Defined Exception
    PL/SQL procedure successfully completed.
    Sai

  • How to load a comma seprated text file which contain address in to sql server table using ssis package

    Hi,
    I want to load a file which is comma separated and contain address .Problem is that address its self comma seprated so how do I differenciate whether comma used for column seprator or it used in address.
    for eg.
    One person having address like
    "c/o AB corp,156 cross lane,USA"
    Thanks.....

    Hi SR_MCTS,
    Based on your description, you want to distinguish a comma is used for column separator or used in address column in a text file, then load the data from the text file to SQL Server table.
    As per my understanding, if you can replace the comma column separator to another delimiter like semicolon (;), just do it. Then we can select Semicolon {;} as Column delimiter for the Flat File Connection Manager. Or ensure all columns are enclosed in double
    quotes ("). Then we can set the double quotes (") as Text qualifier for the Flat File Connection Manager, and the commas will be loaded as part of the string fields.
    If you can't have that done, because computers don't know the context of the data, you would have to come up with some kind of rules that decides when a comma represents a delimiter, and when it is just part of the text. I think a custom script component
    would be necessary to pre-process the data, identify where a comma is part of an address, and then treat that as one field.
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • Comma Separated Values files ?!!

    Is there special classes for dealing with CSV (comma separated values) to use a text file just like a database ??
    thanks in advance

    sorry, it just sounds like a strange thing to do. Normally, you would not use CSV for persistent data storage with a High Level Language. In your design, if you wanted to refer to a particular record, you get into all sorts of problems. You could keep a note of where each record is, like what line number its on, but then you would need some way of modifying this note when you add records. Also, you would have to be sure that no-one is accessing the file outside of the program as then things will not be where the program expects them to be. You could refer to each record using some identifier, but then if you are going to start using all of this, then you may as well go the database route. If you are new to java, it will probably help you learn. I just don't envisage you ever having to use the type of design you are talking of in practice. The closest thing that you ever might use it for is if you had a plain text configuration or parameter file for a program.

  • Upload time data text file in ztable for HR module

    dear all SAP guru's
    text file is like that
    260807300001
    270815480001
    270812210002.
    1st  4 char is date&month .
    2nd 4 char is time.
    3rd 4 char is employee no.
    i want to upload this file in z table.
    when i m uploading the time is not uploading correctly.my condition is like that
    already 1 condition is in Z table after that when i upload 2nd entry that time what 1st time is  time in and 2nd is  time out.
    coding as fallows . give any solution for that.
    LOOP AT it_out.
       CONCATENATE sy-datum0(4) it_out-text2(2) it_out-text+0(2) INTO itab1-val1.
       CONCATENATE it_out-text+4(4) '00' INTO itab1-val2.
       MOVE it_out-text+8(4) TO itab1-val3.
       APPEND itab1.
       CLEAR itab1.
    ENDLOOP.
    SELECT *
             FROM ztimedata
             INTO TABLE it_ztimedata.
    DESCRIBE TABLE it_ztimedata LINES cnt.
    LOOP AT it_out.
      CLEAR cnt.
        LOOP AT itab1.
          itab1-date1 = itab1-val1.
          itab1-timein = itab1-val2.
          itab1-pernr = itab1-val3.
            cnt = cnt + 1.
          itab1-counter = cnt.
          MODIFY itab1.
        ENDLOOP.
    ENDLOOP.
    SORT itab1 BY pernr date1 timein.
    DATA cnt1 TYPE i.
    DATA p_date LIKE sy-datum.
      SELECT SINGLE  * FROM ztimedata
                     INTO CORRESPONDING FIELDS OF  it_ztimedata.
    LOOP AT itab1.
              ztimedata-counter    = itab1-counter.
              ztimedata-date1      = itab1-val1.
              ztimedata-pernr      = itab1-val3.
              ztimedata-shift      = itab1-shift.
              ztimedata-attendance = itab1-attendance.
              CLEAR IT_ZTIMEDATA-TIMEIN.
           IF ztimedata-timein IS INITIAL.
              it_ztimedata-timein     = itab1-val2.
              ztimedata-timein     = itab1-val2.
              CLEAR it_ztimedata-timeout .
           ELSEIF ztimedata-timein IS NOT INITIAL.
              it_ztimedata-timeout     = itab1-val2.
              ztimedata-timeout    = itab1-val2.
           ENDIF.
              append it_ztimedata.
              MODIFY ztimedata from it_ztimedata.
           COMMIT WORK.
      ENDLOOP.
    in that coding if any correction pls correct me.
    Nikhil Narkhede

    Hi,
    You just try like this..Move date field into one Variable Year field into one variable and
    Time field into one variable..Then Pass this field to your screen fields.
    Rgs,
    Priya.

  • Unable to Upload data from text file into BEx Analyzer selection screen

    Hi,
    No response from BEx Analyzer when I am trying to upload around 40,000 material from text file into BEx Analyzer selection screen using "Upload selections" options. But I am able to upload only 10,000 material from text file.  I never faced same kind of issue when I am using BEx Analyzer 3.x.  Please let me know I have to change any settings related to BEx or any other.
    Thanks
    Sri Krishna Ponnada.

    Hello
    It seems you are reaching the .NET memory limitation informed in note 1040454.
    Because 3.5 does not use .NET it can work that.
    Regards,
    Ricardo

  • FM to upload TAB DELIMITED TEXT file into Internal table.

    Hello Friends,
    The FM 'ALSM_EXCEL_TO_INTERNAL_TABLE' is used to upload EXCEL file into a Internal table.
    Is there any FM which performs the simillar operation on TAB DELIMITED TEXT FILE.
    Thanks in advance!
    Ashish

    Hi,
    To upload text file with tab delimated you can use FM
    GUI_OPLOAD.
    In this function you have put X in the field HAS_FIELD_SEPARATOR.
    Regards,
    Sujit

  • Upload and plot text files

    Hi
    I would like to upload and plot as overlays several text files in labview.
    Uploading and ploting one file is not a problem but I want to load several and see them overlayed in a single plot.  Presumably I need a looping routine that uploads each file independently putting the data in an array, then plots each of the arrays to the x-y graph.  I just can't figure a way of doing it.  Can anybody help?

    Hi.
    Here is a small example (LV7.1)
    Message Edited by EVS on 09-05-2005 05:01 PM
    Jack
    Win XP
    LabVIEW 6.1, 7.0, 7.1, LabWindows/ CVI 7.1
    Let us speek Russian
    Attachments:
    Add PlotXY.vi ‏56 KB
    Clip_7.jpg ‏64 KB

  • CSV (Comma Separated Value) files in Appleworks

    Hello I have to create a subscribers list to upload to another program. They tell you to create a CSV file. Can I do this with Appleworks? If so, how do I go about doing this.

    Sounds like you're on the right track. First create the spreadsheet. When all the data has been entered, make a block selection of the data. Next, open an AW wordprocessing document window, switch back to the SS window, click on your selection, and drag the selection to the WP window.
    Now your SS information is in a WP document with tabs between the cell entries on each row, and the rows are separated by carriage returns -- don't be too concerned about how it looks. Press command+F to open the "Find/Change" dialog, enter "\t" (without the quotes) in the "Find:" box, and "," (with, or without the quotes, depending on what the recipient needs) in the "Change:" box, and finally, click on the "Change All" button in the Find/Change dialog box.
    Using the "File >Save As..." menu item, save the document as "Text" (from the dialog's "Save As:" pop-up) and include the appropriate file name extension as described earlier.

  • Error while uploading script form text file to SAP system

    hi
      i down loaded a SAP Script from production server to local test file using RSTXSCRP
    it get downloaded successfully but when i am uploading it to development server it is giving ERROR as :
    Transport object FORM ZIV_MEDRUCK_PO is being processed        
    Language vector used: DE                                       
    Original language was set to E                                 
    ERROR: Save with SAVE_TEXT(FORM ZIV_MEDRUCK_PO SAP DEF ) failed
    Text ID DEF 1 for text object FORM 2 does not exist            
    001 fatal error(s) occurred during import                      
    ERROR: Invalid start marker: instead of H                      
    ERROR: Invalid start marker: instead of H                     
    please help .

    Hi ,
    The text used in the previosu script is not in language en or proabably the standard text is not existent at the application server .
    Create the same text first then try uploading it it shold work.
    Regards,
    Nisrin.

  • Apps team uploading 114505 kbof text file,too many archives getting

    the upload is going on ,too many are getting generated in archivelog location
    i have increased 200gb to 900gb
    please let me know how to know for 14505 kb of dataupload how many archives gettting generated
    can we estimate before dataupload how many archives can generate
    can you please explain clearly
    thanks

    Hi,
    There is no specific method to calculate the number of archived log files to be generated for the particular load.
    But, we may do some rough calculation by looking at the rate of archived log generation.
    Check the following things,
    1) How frequently the logs are getting generated and the size of the files.
    2) How many data has been loaded so far.
    Based on the above input, you may get some idea on number of ARCHIVED LOG files to be generated during the rest of the data load.
    Also, you may do the following to avoid keep adding space to archive destination.
    1) Wite a UNIX shell script to BACKUP the ARCHIVED LOG FILES and DELETE the files once backuped up; which should run for every 10 minutes.
    Thanks.

  • How to upload comm seperated flate file into sap r/3?

    plz send me any simple report program

    Hi,
    Please refer code below:
    data : begin of itab1 occurs 0,
            values(1000) type c,
           end of itab1.
    PARAMETERS : p_file LIKE rlgrap-filename OBLIGATORY.
    DATA : filename TYPE string.
    DATA : w_textout LIKE t100-text.
    DATA: BEGIN OF messtab OCCURS 0.
            INCLUDE STRUCTURE bdcmsgcoll.
    DATA: END OF messtab.
    data : begin of itab occurs 0,
               BLDAT(10) TYPE C,
               BLART(2) TYPE C,
               BUKRS(4) TYPE C,
               BUDAT(10) TYPE C,
               MONAT(2) TYPE C,
               WAERS(5) TYPE C,
               NEWBS(2) TYPE C,
               NEWKO(17) TYPE C,
               WRBTR(13) TYPE C,
               SGTXT(50) TYPE C,
               GSBER(4) TYPE C,
               KOSTL(10) TYPE C,
               AUFNR(10) TYPE C,
               TNEWBS(2) TYPE C,
               TNEWKO(17) TYPE C,
               TWRBTR(13) TYPE C,
           end of itab.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
      CLEAR p_file.
      CALL FUNCTION 'F4_FILENAME'
        IMPORTING
          file_name = p_file.
    start-of-selection.
      filename = p_file.
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
         FILENAME                      = filename
         FILETYPE                      = 'ASC'
         HAS_FIELD_SEPARATOR           = 'X'
    *   HEADER_LENGTH                 = 0
    *   READ_BY_LINE                  = 'X'
    *   DAT_MODE                      = ' '
    *   CODEPAGE                      = ' '
    *   IGNORE_CERR                   = ABAP_TRUE
    *   REPLACEMENT                   = '#'
    *   CHECK_BOM                     = ' '
    *   VIRUS_SCAN_PROFILE            =
    * IMPORTING
    *   FILELENGTH                    =
    *   HEADER                        =
        TABLES
          DATA_TAB                      = itab1
    * 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
      LOOP AT ITAB1.
          SPLIT ITAB1 AT ',' INTO ITAB-BLDAT ITAB-BLART ITAB-BUKRS ITAB-BUDAT ITAB-MONAT
                             ITAB-WAERS ITAB-NEWBS ITAB-NEWKO ITAB-WRBTR ITAB-SGTXT ITAB-GSBER ITAB-KOSTL ITAB-AUFNR.
        APPEND ITAB.
      ENDLOOP.
    Thanks,
    Sriram Ponna.

  • Sqlloader:only 1st when clause works for comma separated data file

    LOAD DATA
    INFILE 'XXMI_SUPPLIER_DATA.dat'
    REPLACE
    INTO TABLE APPS.XXMI_AP_SUPPLIERS_STG
    when interface_record_type = '01'
    Fields terminated by "," Optionally enclosed by '"'
    TRAILING NULLCOLS
    and
    INTO TABLE APPS.XXMI_AP_SUPPLIER_SITES_STG
    when interface_record_type = '02'
    Fields terminated by "," Optionally enclosed by '"'
    TRAILING NULLCOLS
    always getting the error for second when clause:
    4 Rows not loaded because all WHEN clauses were failed.
    pls any one can throw some light on this?

    What's Oracle version.
    What's your datafile looks like. Post a few sample line here.
    when interface_record_type = '01'You didn't define interface_record_type in your when clause.
    Sample,
    INTO TABLE dept
       WHEN recid = 1
       (recid  FILLER INTEGER EXTERNAL TERMINATED BY WHITESPACE,
        deptno INTEGER EXTERNAL TERMINATED BY WHITESPACE,
        dname  CHAR TERMINATED BY WHITESPACE) check Oracle doc,
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14215/ldr_control_file.htm#i1004788

Maybe you are looking for

  • Trimming the middle of a song

    I have a 3 minute song that I want to use for a video. Is there an easy way to cut it down to 2 minutes and still use the original beginning and ending of the song? Basically I'd like to cut out the middle 60 seconds of the song and mix the beginning

  • Uninstalled cc and now I can't download it again

    I installed trial versions of Photoshop CC and Lightroom. Lightroom worked but PS would not open no matter what I tried. So I uninstalled both. I want to download again and see if the problem is fixed. But CC thinks I still have both on my computer.

  • Installation - Photoshop has installed, but it doesn't open when I select the program?

    Has anyone else had a similar issue?

  • Transferring CS6 to new computer

    Hi! I have a year long subscription (paid monthly) to CS6 but just got a new computer. How do I transfer CS6 from my old computer to my new computer?

  • Upload 5 files on action of a Button

    HI Friends,    Requirement:  I need to upload master for 5 tables using 5 upload UI elements, on action of a button i should upload legacy data to tables. I am capable of uploading one file but not 5.                                Can someone help m