Upload a tab delimited file

anybody knws wats the fm to upload a tab delimited file?
I tried the fm gui_upload but its not working

I have used the  HAS_FIELD_SEPARATOR           = 'X', but only the first column is being transferred
data : p_file2 type string.
CALL FUNCTION 'GUI_UPLOAD'
  EXPORTING
    FILENAME                      = p_file2
   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            =
  NO_AUTH_CHECK                 = ' '
IMPORTING
  FILELENGTH                    =
  HEADER                        =
  TABLES
    DATA_TAB                      = gi_linepost
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.

Similar Messages

  • Functions to upload UNIX tab-delimited file

    plz tell me  lists of  Functions to upload UNIX tab-delimited file in the database table

    HI,
    data : itab like standard table of ZCBU.
    ld_file = p_infile.
    OPEN DATASET ld_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.
    IF sy-subrc NE 0.
    ELSE.
      DO.
        CLEAR: wa_string, wa_uploadtxt.
        READ DATASET ld_file INTO wa_string.
        IF sy-subrc NE 0.
          EXIT.
        ELSE.
          SPLIT wa_string AT con_tab INTO wa_uploadtxt-name1
                                          wa_uploadtxt-name2
                                          wa_uploadtxt-age.
          MOVE-CORRESPONDING wa_uploadtxt TO wa_upload.
          APPEND wa_upload TO it_record.
        ENDIF.
      ENDDO.
      CLOSE DATASET ld_file.
    ENDIF.
    loop at it_record.
    itab-field1 = it_reocrd-field1.
    itab-field2 = it_record-field2.
    append itab.
    endloop.
    *-- Now update the table
    modify ZCBU from table itab.

  • How to upload a TAB Delimited file and pls tell me the internal tble format

    Hello All,
    When i upload a TAB Delimited .txt file its giving me # Symbols in between the internal table fields.
    pls advise.
    Suresh

    data: begin of wa_input,  
            plnnr(8) type c,   
            plnal(2) type c,   
            vornr(4) type c,   
            arbpl(8) type c,   
            steus(4) type c,   
            ltxa1(40) type c,  
            ltext(1000) type c,
           end of wa_input.    
    data: i_input like wa_input occurs 0 with header line.
      call function 'WS_UPLOAD'                  
           exporting                             
                filename            = p_input " file path
                filentype           = 'DAT'      
           tables                                
                data_tab            = i_input    
           exceptions                            
                file_open_error     = 1          
                file_write_error    = 2          
                invalid_filesize    = 3          
                invalid_table_width = 4          
                invalid_type        = 5          
                no_batch            = 6          
                unknown_error       = 7.

  • Upload tab-delimited file from the application server to an internal table

    Hello SAPients.
    I'm using OPEN DATASET..., READ DATASET..., CLOSE DATASET to upload a file from the application server (SunOS). I'm working with SAP 4.6C. I'm trying to upload a tab-delimited file to an internal table but when I try load it the fields are not correctly separated, in fact, they are all misplaced and the table shows '#' where supposedly there was a tab.
    I tried to SPLIT the line using as separator a variable with reference to CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB but for some reason that class doesn't exist in my system.
    Do you know what I'm doing wrong? or Do you know a better method to upload a tab-delimited file into an internal table?
    Thank you in advance for your help.

    Try:
    REPORT ztest MESSAGE-ID 00.
    PARAMETER: p_file LIKE rlgrap-filename   OBLIGATORY.
    DATA: BEGIN OF data_tab OCCURS 0,
          data(4096),
          END   OF data_tab.
    DATA: BEGIN OF vendor_file_x OCCURS 0.
    * LFA1 Data
    DATA: mandt  LIKE bgr00-mandt,
          lifnr  LIKE blf00-lifnr,
          anred  LIKE blfa1-anred,
          bahns  LIKE blfa1-bahns,
          bbbnr  LIKE blfa1-bbbnr,
          bbsnr  LIKE blfa1-bbsnr,
          begru  LIKE blfa1-begru,
          brsch  LIKE blfa1-brsch,
          bubkz  LIKE blfa1-bubkz,
          datlt  LIKE blfa1-datlt,
          dtams  LIKE blfa1-dtams,
          dtaws  LIKE blfa1-dtaws,
          erdat  LIKE  lfa1-erdat,
          ernam  LIKE  lfa1-ernam,
          esrnr  LIKE blfa1-esrnr,
          konzs  LIKE blfa1-konzs,
          ktokk  LIKE  lfa1-ktokk,
          kunnr  LIKE blfa1-kunnr,
          land1  LIKE blfa1-land1,
          lnrza  LIKE blfa1-lnrza,
          loevm  LIKE blfa1-loevm,
          name1  LIKE blfa1-name1,
          name2  LIKE blfa1-name2,
          name3  LIKE blfa1-name3,
          name4  LIKE blfa1-name4,
          ort01  LIKE blfa1-ort01,
          ort02  LIKE blfa1-ort02,
          pfach  LIKE blfa1-pfach,
          pstl2  LIKE blfa1-pstl2,
          pstlz  LIKE blfa1-pstlz,
          regio  LIKE blfa1-regio,
          sortl  LIKE blfa1-sortl,
          sperr  LIKE blfa1-sperr,
          sperm  LIKE blfa1-sperm,
          spras  LIKE blfa1-spras,
          stcd1  LIKE blfa1-stcd1,
          stcd2  LIKE blfa1-stcd2,
          stkza  LIKE blfa1-stkza,
          stkzu  LIKE blfa1-stkzu,
          stras  LIKE blfa1-stras,
          telbx  LIKE blfa1-telbx,
          telf1  LIKE blfa1-telf1,
          telf2  LIKE blfa1-telf2,
          telfx  LIKE blfa1-telfx,
          teltx  LIKE blfa1-teltx,
          telx1  LIKE blfa1-telx1,
          xcpdk  LIKE  lfa1-xcpdk,
          xzemp  LIKE blfa1-xzemp,
          vbund  LIKE blfa1-vbund,
          fiskn  LIKE blfa1-fiskn,
          stceg  LIKE blfa1-stceg,
          stkzn  LIKE blfa1-stkzn,
          sperq  LIKE blfa1-sperq,
          adrnr  LIKE  lfa1-adrnr,
          mcod1  LIKE  lfa1-mcod1,
          mcod2  LIKE  lfa1-mcod2,
          mcod3  LIKE  lfa1-mcod3,
          gbort  LIKE blfa1-gbort,
          gbdat  LIKE blfa1-gbdat,
          sexkz  LIKE blfa1-sexkz,
          kraus  LIKE blfa1-kraus,
          revdb  LIKE blfa1-revdb,
          qssys  LIKE blfa1-qssys,
          ktock  LIKE blfa1-ktock,
          pfort  LIKE blfa1-pfort,
          werks  LIKE blfa1-werks,
          ltsna  LIKE blfa1-ltsna,
          werkr  LIKE blfa1-werkr,
          plkal  LIKE  lfa1-plkal,
          duefl  LIKE  lfa1-duefl,
          txjcd  LIKE blfa1-txjcd,
          sperz  LIKE  lfa1-sperz,
          scacd  LIKE blfa1-scacd,
          sfrgr  LIKE blfa1-sfrgr,
          lzone  LIKE blfa1-lzone,
          xlfza  LIKE  lfa1-xlfza,
          dlgrp  LIKE blfa1-dlgrp,
          fityp  LIKE blfa1-fityp,
          stcdt  LIKE blfa1-stcdt,
          regss  LIKE blfa1-regss,
          actss  LIKE blfa1-actss,
          stcd3  LIKE blfa1-stcd3,
          stcd4  LIKE blfa1-stcd4,
          ipisp  LIKE blfa1-ipisp,
          taxbs  LIKE blfa1-taxbs,
          profs  LIKE blfa1-profs,
          stgdl  LIKE blfa1-stgdl,
          emnfr  LIKE blfa1-emnfr,
          lfurl  LIKE blfa1-lfurl,
          j_1kfrepre  LIKE blfa1-j_1kfrepre,
          j_1kftbus   LIKE blfa1-j_1kftbus,
          j_1kftind   LIKE blfa1-j_1kftind,
          confs  LIKE  lfa1-confs,
          updat  LIKE  lfa1-updat,
          uptim  LIKE  lfa1-uptim,
          nodel  LIKE blfa1-nodel.
    DATA: END   OF vendor_file_x.
    FIELD-SYMBOLS:  <field>,
                    <field_1>.
    DATA: delim          TYPE x        VALUE '09'.
    DATA: fld_chk(4096),
          last_char,
          quote_1     TYPE i,
          quote_2     TYPE i,
          fld_lth     TYPE i,
          columns     TYPE i,
          field_end   TYPE i,
          outp_rec    TYPE i,
          extras(3)   TYPE c        VALUE '.,"',
          mixed_no(14) TYPE c        VALUE '1234567890-.,"'.
    OPEN DATASET p_file FOR INPUT.
    DO.
      READ DATASET p_file INTO data_tab-data.
      IF sy-subrc = 0.
        APPEND data_tab.
      ELSE.
        EXIT.
      ENDIF.
    ENDDO.
    * count columns in output structure
    DO.
      ASSIGN COMPONENT sy-index OF STRUCTURE vendor_file_x TO <field>.
      IF sy-subrc <> 0.
        EXIT.
      ENDIF.
      columns = sy-index.
    ENDDO.
    * Assign elements of input file to internal table
    CLEAR vendor_file_x.
    IF columns > 0.
      LOOP AT data_tab.
        DO columns TIMES.
          ASSIGN space TO <field>.
          ASSIGN space TO <field_1>.
          ASSIGN COMPONENT sy-index OF STRUCTURE vendor_file_x TO <field>.
          SEARCH data_tab-data FOR delim.
          IF sy-fdpos > 0.
            field_end = sy-fdpos + 1.
            ASSIGN data_tab-data(sy-fdpos) TO <field_1>.
    * Check that numeric fields don't contain any embedded " or ,
            IF <field_1> CO mixed_no AND
               <field_1> CA extras.
              TRANSLATE <field_1> USING '" , '.
              CONDENSE <field_1> NO-GAPS.
            ENDIF.
    * If first and last characters are '"', remove both.
            fld_chk = <field_1>.
            IF NOT fld_chk IS INITIAL.
              fld_lth = strlen( fld_chk ) - 1.
              MOVE fld_chk+fld_lth(1) TO last_char.
              IF fld_chk(1) = '"' AND
                 last_char = '"'.
                MOVE space TO fld_chk+fld_lth(1).
                SHIFT fld_chk.
                MOVE fld_chk TO <field_1>.
              ENDIF.       " for if fld_chk(1)=" & last_char="
            ENDIF.         " for if not fld_chk is initial
    * Replace "" with "
            DO.
              IF fld_chk CS '""'.
                quote_1 = sy-fdpos.
                quote_2 = sy-fdpos + 1.
                MOVE fld_chk+quote_2 TO fld_chk+quote_1.
              ELSE.
                MOVE fld_chk TO <field_1>.
                EXIT.
              ENDIF.
            ENDDO.
            <field> = <field_1>.
          ELSE.
            field_end = 1.
          ENDIF.
          SHIFT data_tab-data LEFT BY field_end PLACES.
        ENDDO.
        APPEND vendor_file_x.
        CLEAR vendor_file_x.
      ENDLOOP.
    ENDIF.
    CLEAR   data_tab.
    REFRESH data_tab.
    FREE    data_tab.
    Rob

  • UPLOADING tab delimited file onto FTP server

    Hello all
    Can i upload a tab delimited file onto the FTP server. If yes then how
    points guranteed if answered!!

    Hi,
    Yes you can do this one .. you can have a look at the standard program 'RSEPSFTP'.
    REPORT ZFTPSAP LINE-SIZE 132.
    DATA: BEGIN OF MTAB_DATA OCCURS 0,
    LINE(132) TYPE C,
    END OF MTAB_DATA.
    DATA: MC_PASSWORD(20) TYPE C,
    MI_KEY TYPE I VALUE 26101957,
    MI_PWD_LEN TYPE I,
    MI_HANDLE TYPE I.
    START-OF-SELECTION.
    *-- Your SAP-UNIX FTP password (case sensitive)
    MC_PASSWORD = 'password'.
    DESCRIBE FIELD MC_PASSWORD LENGTH MI_PWD_LEN.
    *-- FTP_CONNECT requires an encrypted password to work
    CALL 'AB_RFC_X_SCRAMBLE_STRING'
         ID 'SOURCE' FIELD MC_PASSWORD ID 'KEY' FIELD MI_KEY
         ID 'SCR' FIELD 'X' ID 'DESTINATION' FIELD MC_PASSWORD
         ID 'DSTLEN' FIELD MI_PWD_LEN.
    CALL FUNCTION 'FTP_CONNECT'
         EXPORTING
    *-- Your SAP-UNIX FTP user name (case sensitive)
           USER            = 'userid'
           PASSWORD        = MC_PASSWORD
    *-- Your SAP-UNIX server host name (case sensitive)
           HOST            = 'unix-host'
           RFC_DESTINATION = 'SAPFTP'
         IMPORTING
           HANDLE          = MI_HANDLE
         EXCEPTIONS
           NOT_CONNECTED   = 1
           OTHERS          = 2.
    CHECK SY-SUBRC = 0.
    CALL FUNCTION 'FTP_COMMAND'
         EXPORTING
           HANDLE = MI_HANDLE
           COMMAND = 'dir'
         TABLES
           DATA = MTAB_DATA
         EXCEPTIONS
           TCPIP_ERROR = 1
           COMMAND_ERROR = 2
           DATA_ERROR = 3
           OTHERS = 4.
    IF SY-SUBRC = 0.
      LOOP AT MTAB_DATA.
        WRITE: / MTAB_DATA.
      ENDLOOP.
    ELSE.
    * do some error checking.
      WRITE: / 'Error in FTP Command'.
    ENDIF.
    CALL FUNCTION 'FTP_DISCONNECT'
         EXPORTING
           HANDLE = MI_HANDLE
         EXCEPTIONS
           OTHERS = 1.  
    Regards
    Sudheer

  • Detecting line-breaks within a column of an uploaded tab-delimited file.

    Suppose you upload a tab-delimited file from your laptop and split each row of the file into some structure that you append to an itab.
    Is there a way inside ABAP to detect that a field of the uploaded file has a CR or CRLF in it?  And if so, where it is ?
    Thanks in advance ...

    You can use any of the following for those char.
    DATA:   head_crnl(1)   TYPE c VALUE cl_abap_char_utilities=>cr_lf,
              top_crnl(1)    TYPE c VALUE cl_abap_char_utilities=>cr_lf,
              end_crnl(1)    TYPE c VALUE cl_abap_char_utilities=>cr_lf,
              blank_crnl(1)  TYPE c VALUE cl_abap_char_utilities=>cr_lf,
              final_crnl(1)  TYPE c VALUE cl_abap_char_utilities=>cr_lf,
              first_pgbr(1)  TYPE c VALUE cl_abap_char_utilities=>form_feed.
    Declare the above variables and check if they occur in the file. Hope this helps.

  • Parse tab delimited file after upload

    I could use some advice. I have a requirement to parse and insert an uploaded, tab delimited file using APEX. Directly off of the file system, I would do this with an external table, but here I am uploading the file into a CLOB field. Does PL/SQL have any native functions to parse delimited files?
    The user will not have access to the data load part of APEX, although I have seen numerous requests on this forum for that functionality to be added to the user GUI. Thoughts?

    j,
    I wrote this a while ago...
    http://www.danielmcghan.us/2009/02/easy-csv-uploads-yes-we-can.html
    I've since improved the code a little bit. If you like the solution, I could do a new post with the latest code.
    Regards,
    Dan
    Blog: http://DanielMcGhan.us/
    Work: http://SkillBuilders.com/

  • Small doubt  reg upload from tab delimited text file

    Hi  all,
    i am uploading a tab delimited text file to a ztable.
    I moving the text file in to internal table
    data : begin of i_tab occurs 0,
           text(1024) type c,
           end of i_tab.
    then i have passed to FM GUI_UPLOAD.
    and then splitting
    loop at i_tab.
    split i_tab at con_tab
                              into i_xyz-matnr
                                   i_xyz-werks.
        append i_xyz.
    endloop..
    is this the right approach . iam getting the results but iam just curious to know.
    Do i need to internal like the one i created
    data : begin of i_tab occurs 0,
           text(1024) type c,
           end of i_tab.
    or do i need to create one with field that i have in text file.
    data : begin of i_tab occurs 0,
       matnr like mara-matnr,
      werks like marc-werks
    end of i_tab.
    WHICH ONE OF THE TWO IS RIGHT.
    THANKS IN ADVANCE

    There will be NO difference,i guess in the 2 methods.
    you can use which you like.
    Check the below program,i also given quantity fields F2,F3.
    its working fine
    REPORT  ZSRIM_TEMP13.
    data : begin of itab occurs 0,
             f1(20) type c,
             f2     type i,
             f3(10)     type p DECIMALS 2,
           end of itab.
           CALL FUNCTION 'GUI_UPLOAD'
             EXPORTING
               FILENAME                      = 'c:a.txt'
              FILETYPE                      = 'ASC'
              <b>HAS_FIELD_SEPARATOR           = 'X'</b>
    *          HEADER_LENGTH                 = 0
    *          READ_BY_LINE                  = 'X'
    *          DAT_MODE                      = ' '
    *          CODEPAGE                      = ' '
    *          IGNORE_CERR                   = ABAP_TRUE
    *          REPLACEMENT                   = '#'
    *          CHECK_BOM                     = ' '
    *          VIRUS_SCAN_PROFILE            = VIRUS_SCAN_PROFILE
    *          NO_AUTH_CHECK                 = ' '
    *        IMPORTING
    *          FILELENGTH                    = FILELENGTH
    *          HEADER                        = 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.
             WRITE :/ ITAB-F1, ITAB-F2,ITAB-F3.
           ENDLOOP.
    my input file i created with TAB seperated text file,
    here is the input file
    LINE1     1000     123.25
    LINE2     2000     234.25
    LINE3     3000     345.25
    LINE1     1000     123.25
    LINE2     2000     234.25
    LINE3     3000     345.25
    Regards
    Srikanth
    Message was edited by: Srikanth Kidambi

  • Program to upload data from a tab-delimited file ...

    I have to upload data from a tab-delimited file with following fields into database table(ZCBU) with same fields:
    CBU (parent)
    KUNNR (child)
    ERDAT (effective from)
    MANDT (client)
    SFID (salesforce ID)
    AEDAT (effective to)
    AENAM (assigned by).
    This file can be of type PC(txt) or UNIX.
    plz tell me how to do this in both type of files

    Hi,
    DATA: bdcdata LIKE bdcdata    OCCURS 0 WITH HEADER LINE.
    DATA: xfile TYPE string.
    DATA: BEGIN OF itab OCCURS 0,
            empno TYPE zmemp-empno,
            name  TYPE zmemp-first_name,
            last  TYPE zmemp-last_name,
            comp  TYPE zmemp-comp,
            place TYPE zmemp-place,
            END OF itab.
    PARAMETER : p_file TYPE rlgrap-filename OBLIGATORY.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
    Form to get the file path of legacy data stored on presentation server
      PERFORM get_file_path.
    START-OF-SELECTION.
      MOVE p_file TO xfile.
    to get the data from excel sheet data into an internal table
      PERFORM get_data.
      LOOP AT itab .
        REFRESH bdcdata.
        PERFORM bdc_dynpro      USING 'ZM_EMPLOYEE' '9001'.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'S9001_EMPNO'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '=CREA'.
        PERFORM bdc_field       USING 'S9001_EMPNO'
                                      itab-empno.
        PERFORM bdc_dynpro      USING 'ZM_EMPLOYEE' '9002'.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'S9002_PLACE'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '=SAVE'.
        PERFORM bdc_field       USING 'S9002_EMPNO'
                                      itab-empno.
        PERFORM bdc_field       USING 'S9002_FIRST_NAME'
                                      itab-name.
        PERFORM bdc_field       USING 'S9002_LAST_NAME'
                                      itab-last.
        PERFORM bdc_field       USING 'S9002_COMP'
                                      itab-comp.
        PERFORM bdc_field       USING 'S9002_PLACE'
                                      itab-place.
        PERFORM bdc_dynpro      USING 'ZM_EMPLOYEE' '9001'.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'S9001_EMPNO'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '=BACK'.
        CALL TRANSACTION 'ZMEMP'
        USING bdcdata
        UPDATE 'A'
        MODE   'N'.
      ENDLOOP.
           Start new screen                                              *
    FORM bdc_dynpro USING program dynpro.
      CLEAR bdcdata.
      bdcdata-program  = program.
      bdcdata-dynpro   = dynpro.
      bdcdata-dynbegin = 'X'.
      APPEND bdcdata.
    ENDFORM.                    "BDC_DYNPRO
           Insert field                                                  *
    FORM bdc_field USING fnam fval.
      CLEAR bdcdata.
      bdcdata-fnam = fnam.
      bdcdata-fval = fval.
      APPEND bdcdata.
    ENDFORM.                    "BDC_FIELD
    *&      Form  get_file_path
    FORM get_file_path .
      CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
        CHANGING
          file_name = p_file.
    ENDFORM.                    " get_file_path
    *&      Form  get_data
    FORM get_data .
      DATA : lines1 TYPE i.
      MOVE p_file TO xfile.
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          filename            = xfile
          filetype            = 'ASC'
          has_field_separator = 'X'
        TABLES
          data_tab            = itab.
      DESCRIBE TABLE itab LINES lines1.
      WRITE : / lines1 , 'REcords uploaded' .
    ENDFORM.                    " get_data
    Regards,
    Nihar Swain,

  • Pgm to upload a tab delimited text file

    Hi ,
    can anyone send me a program to upload a tab delimited text file into a ztable.
    My email id is : [email protected]
    Thanks
    Kajol

    Check the below code:
    *& Report  Z_UPLOAD_MUNCPCODE                                          *
    REPORT  z_upload_muncpcode.
    PARAMETERS : p_fname   LIKE rlgrap-filename.
    TYPES: BEGIN OF ty_munc,
            land1     TYPE tzone-land1,
            zone1     TYPE tzone-zone1,
            vtext TYPE tzont-vtext,
           END OF ty_munc.
    DATA: i_munc   TYPE STANDARD TABLE OF ty_munc,
          i_tzone  TYPE STANDARD TABLE OF tzone,
          i_tzont  TYPE STANDARD TABLE OF tzont,
          wa_munc  TYPE ty_munc,
          wa_tzone TYPE tzone,
          wa_tzont TYPE tzont.
    CONSTANTS: c_path     TYPE char20 VALUE 'C:\',
               c_mask     TYPE char9  VALUE ',*.*,*.*.',
               c_mode     TYPE char1  VALUE 'O',
               c_filetype TYPE char10 VALUE 'ASC',
               c_x        TYPE char01 VALUE 'X'.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_fname.
    *-- Browse Presentation Server
      PERFORM f4_presentation_file.
    START-OF-SELECTION..
    *-- Read presentation server file
      PERFORM f1003_pre_file.
      LOOP AT i_munc INTO wa_munc.
        wa_tzone-mandt = wa_tzont-mandt = sy-mandt.
        wa_tzone-land1 = wa_tzont-land1 = wa_munc-land1.
        wa_tzone-zone1 = wa_tzont-zone1 = wa_munc-zone1.
        wa_tzont-spras = sy-langu.
        wa_tzont-vtext = wa_munc-vtext.
        APPEND wa_tzont TO i_tzont.
        APPEND wa_tzone TO i_tzone.
        CLEAR: wa_munc, wa_tzont, wa_tzone.
      ENDLOOP.
    END-OF-SELECTION.
    Modify Table TZONT
      PERFORM enqueue_table USING text-001.
      MODIFY tzont FROM TABLE i_tzont.
      PERFORM dequeue_table USING text-001.
    Modify Table TZONE
      PERFORM enqueue_table USING text-002.
      MODIFY tzone FROM TABLE i_tzone.
      PERFORM dequeue_table USING text-002.
      WRITE: 'Tables TZONE & TZONT are updated'.
    *&                  Form  f4_presentation_file
    *&                F4 Help for presentation server
    FORM f4_presentation_file .
      CALL FUNCTION 'WS_FILENAME_GET'
        EXPORTING
          def_path         = c_path
          mask             = c_mask
          mode             = c_mode
          title            = text-001
        IMPORTING
          filename         = p_fname
        EXCEPTIONS
          inv_winsys       = 1
          no_batch         = 2
          selection_cancel = 3
          selection_error  = 4
          OTHERS           = 5.
      IF sy-subrc <> 0.
       MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
               WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    ENDFORM.                    " f4_presentation_file
    *&                      Form  f1003_pre_file
    *&                         Upload File
    FORM f1003_pre_file .
      DATA: lcl_filename TYPE string.
      lcl_filename = p_fname.
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          filename                = lcl_filename
          filetype                = c_filetype
          has_field_separator     = c_x
        TABLES
          data_tab                = i_munc
        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.
        EXIT.
      ENDIF.
    ENDFORM.                    " f1003_pre_file
    *&                         Form  enqueue_table
    *&                           Enqueue Table
    FORM enqueue_table USING p_tabname.
      CALL FUNCTION 'ENQUEUE_E_TABLE'
        EXPORTING
          tabname        = p_tabname
        EXCEPTIONS
          foreign_lock   = 1
          system_failure = 2
          OTHERS         = 3.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    ENDFORM.                    " enqueue_table
    *&                        Form  dequeue_table
    *&                           Dequeue Table
    FORM dequeue_table USING p_tabname.
      CALL FUNCTION 'DEQUEUE_E_TABLE'
        EXPORTING
          tabname = p_tabname.
    ENDFORM.                    " dequeue_table
    Regards,
    Prakash.

  • Text Tab delimited file-Strcuture-validation

    Hi Folks,
    1.Is there a way to check whether the file is text tab delimited or not,programatically ?
    2.can we check whether the data in the text tab delimited file is in line with the structure of the internal table into which it is going to be uploaded ?
    Thanks,
    K.Kiran.

    hi try this
    DO.
    READ DATASET p_ufile INTO in_file.
    IF sy-subrc <> 0.
    EXIT.
    ENDIF.
    APPEND in_file.
    CLEAR in_file.
    ENDDO.
    CLOSE DATASET p_ufile.
    LOOP AT in_file.
    SPLIT in_file AT c_tab INTO
    wa_citm_b-type
    wa_citm_b-vbeln
    wa_citm_b-posnr
    wa_citm_b-uepos.
    wa_citm_b-matnr
    lv_menge
    wa_citm_b-arktx
    wa_citm_b-vbegdat
    wa_citm_b-venddat
    wa_citm_b-prctr
    wa_citm_b-zterm
    wa_citm_b-faksp
    wa_citm_b-taxm1
    wa_citm_b-vlaufz
    wa_citm_b-vlauez
    wa_citm_b-vlaufk
    wa_citm_b-vkuegru
    wa_citm_b-bstkd
    wa_citm_b-bstdk
    wa_citm_b-posex
    wa_citm_b-bstkd_e
    wa_citm_b-bstdk_e
    wa_citm_b-period.
    IF NOT wa_citm_b-posnr CA sy-abcde.
    APPEND wa_citm_b TO lt_citm_b.
    ENDIF.
    ENDLOOP.

  • Trouble importing contacts from a tab-delimited file into Contacts on 10.9.5

    I am having Trouble importing contacts from a tab-delimited file into Contacts on MacBook Pro, OS 10.9.5, Intel 2.4 GHz Core 2 Duo., 400GB drive, 4GB memory DDR3
    So far I have:
    - Followed closely the help screen in Contacts app
    - Modified my source document meticulously - first in MS Word, then copied and tweaked in Apple's "Text Edit" app
    - The problem arises when I go to access the document for import.  Specifically, the target document, and all others in that file, are "greyed out" and thus can't be "opened" to facilitate the import process
    - Tried changing the extension of the document name to ".txt", ".rtf", and ".rtd". No change or improvement.
    - Searched Apple.com/help and found nothing relevant
    Can anyone offer some advice or tell me what I may be overlooking in this process?
    Any help will be greatly appreciated!
    Thanks,
    <Email Edited By Host>

    Hi Rammohan,
    Thanks for the effort!
    But I don't need to use GUI upload because my functionality does not require to fetch data from presentation server.
    Moreover, the split command advised by you contains separate fields...f1, f2, f3... and I cannot use it because I have 164 fields.  I will have to split into 164 fields and assign the values back to 164 fields in the work area/header line.
    Moreover I have about 10 such work areas.  so the effort would be ten times the above effort! I want to avoid this! Please help!
    I would be very grateful if you could provide an alternative solution.
    Thanks once again,
    Best Regards,
    Vinod.V

  • Large line to internal tables from  tab delimited file

    Dear All
    I am trying to upload the large file of tab delimited data into a SAP internal table. I am basically stuck with the fact that there are multiple lines and multiple columns in tab delimited file. There are around 300 columns which are tab delimited and separated
    For e.g  (* indicates tab)
    1material*****************1**9888**********5**********34*********3*********346************************-->upto 5000 columns
    1material*****************1**99338************4***********************************6************7************-->upto 5000 columns
    1material*****************1**22888********************5*********7*********************6*****7**************-->upto 5000 columns
    1material*****************1**44844************************5***5*********************************************-->upto 5000 columns
    1material***********34****1**54*******33********33*****33**************************************************-->upto 5000 columns
    1material*****************1**99888*****************************************************************************-->upto 5000 columns
    below upto 500 rows or more
    I want to read this file into a columner internal table.
    I am trying several ways . I have file on APP server. However Line breaks after 1024 characters or comes on another line.
    Currently I am not able to load it in single line of internal table. The structure of file is dynamic .. not static
    Amol

    Hi Amolsonaikar,
    you may try like this:
    TYPES:
      begin of line,
        t_field type table of string,
      end of line,
      t_line type table of line.
    DATA:
      lt_line  type t_line,
      lv_line type string,
      lt_field type table of string.
    open dataset 'XYZ' for input in text mode encoding default.
    while sy-subrc = 0.
      read dataset into lv_line.
      split lv_line at '|' into lt_field.
      append lt_field to lt_line.
    endwhile.
    Regards,
    Clemens

  • Read Tab delimited File from Application server

    Hi Experts,
    I am facing problem while reading file from Application server.
    File in Application server is stored as follows, The below file is a tab delimited file.
    ##K#U#N#N#R###T#I#T#L#E###N#A#M#E#1###N#A#M#E#2###N#A#M#E#3###N#A#M#E#4###S#O#R#T#1###S#O#R#T#2###N#A#M#E#_#C#O###S#T#R#_#S#U#P#P#L#1###S#T#R#_#S#U#P#P#L#2###S#T#R#E#E#T###H#O#U#S#E#_#N#U#M#1
    i have downloaded this file from Application server using Transaction CG3Y. the Downloaded file is a tab delimited file and i could not see "#' in the file,
    The code is as Below.
    c_split  TYPE abap_char1 VALUE cl_abap_char_utilities=>horizontal_tab.
    here i am using IGNORING CONVERSION ERRORS in order to avoid Conversion Error Short Dump.
    OPEN DATASET wa_filename-file FOR INPUT IN TEXT MODE ENCODING DEFAULT IGNORING CONVERSION ERRORS.
          IF sy-subrc = 0.
            WRITE : /,'...Processing file - ', wa_filename-file.   
           DO.
          Read the contents of file
              READ DATASET wa_filename-file INTO wa_file-data.
              IF sy-subrc = 0.
                SPLIT wa_file-data AT c_split INTO wa_adrc_2-kunnr
                                                   wa_adrc_2-title
                                                   wa_adrc_2-name1
                                                   wa_adrc_2-name2
                                                   wa_adrc_2-name3
                                                   wa_adrc_2-name4
                                                   wa_adrc_2-name_co
                                                   wa_adrc_2-city1
                                                   wa_adrc_2-city2
                                                   wa_adrc_2-regiogroup
                                                   wa_adrc_2-post_code1
                                                   wa_adrc_2-post_code2
                                                   wa_adrc_2-po_box
                                                   wa_adrc_2-po_box_loc
                                                   wa_adrc_2-transpzone
                                                   wa_adrc_2-street
                                                   wa_adrc_2-house_num1
                                                   wa_adrc_2-house_num2
                                                   wa_adrc_2-str_suppl1
                                                   wa_adrc_2-str_suppl2
                                                   wa_adrc_2-country
                                                   wa_adrc_2-langu
                                                   wa_adrc_2-region
                                                   wa_adrc_2-sort1
                                                   wa_adrc_2-sort2
                                                   wa_adrc_2-deflt_comm
                                                   wa_adrc_2-tel_number
                                                   wa_adrc_2-tel_extens
                                                   wa_adrc_2-fax_number
                                                   wa_adrc_2-fax_extens
                                                   wa_adrc_2-taxjurcode.
    WA_FILE-DATA is having below values
    ##K#U#N#N#R###T#I#T#L#E###N#A#M#E#1###N#A#M#E#2###N#A#M#E#3###N#A#M#E#4###S#O#R#T#1###S#O#R#T#2###N#A#M#E#_#C#O###S#T#R#_#S#U#P#P#L#1###S#T#R#_#S#U#P#P#L#2###S#T#R#E#E#T###H#O#U#S#E#_#N#U#M#1
    And this is split by tab delimited and moved to other variables as shown above.
    Please guide me how to read the contents without "#' from the file.
    I have tried all possible ways and unable to get solution.
    Thanks,
    Shrikanth

    Hi ,
    In ECC 6 if all the unicode patches are applied then UTF 16 will defintly work..
    More over i would suggest you to ist replace # with some other  * or , and then try to see in debugging if any further  # appears..
    and no # appears then try to split now.
    if even now the # appears after replace statement then try to find out what exactly is it... wheather it is a horizantal tab etc....
    and then again try to replace it and then split..
    Please follow the process untill all the # are replaced...
    This should work for you..
    Let me know if you further face any issue...
    Regards
    Satish Boguda

  • To import addresses, need format of tab delimited file

    I am trying to import addresses from my G3 PB Mozilla App. I exported addresses on G3 to both ldif and tab-delimited files and then attached to an email message which I sent to myself. I received email on Mac mini, but the 2 files showed up inline, not as attachments. I copied the ldif portion to a text file; ditto for tab-delimited. I tried importing into Address Book, but got message that format was not valid.
    Can't I just edit the tab-delimited file in TextEdit, save as RTF, and get Address Book to recognize the data?
    Thanks,
    Owen

    Hi, Did you get solution for this? Please let me know as I'm looking for the same solution. The Bank requirement is to generate a Tab delimited file but the RFFOGB_T with Format GB_BACS issues the output as below...
    Required by Bank:
    692532 73855963 RRS P R BACKLEY         169.91 GSLV
    294518 99855581 CETS PRITECTIIN         799.72 GSLV
    The output I get from SAP/DMEE:
    ........1........2........3........4........5........6....
    VOL1000004                           ....953312
                  1 <CR/LF>
    HDR1A953312S  195331200000400010001       10040 100420000000
                    <CR/LF>
    HDR2F0200000100                                   00
                    <CR/LF>
    UHL1 10041999999    000000001 DAILY  000
                    <CR/LF>
    6010392865540009960062063474662    00000115000ABC UK Ltd.       0
    1465                                <CR/LF>
    6006206347466201760062063474662    00000115000SAPBACS0000003306 C
    ONTRA            ABC UK LTD.        <CR/LF>
    EOF1A953312S  195331200000400010001       10040 100420000000
                    <CR/LF>
    EOF2F0200000100                                   00
                    <CR/LF>
    UTL10000000115000000000011500000000010000001
                    <CR/LF>
    END
                    <CR/LF>
    <END>
    Rgds,
    Stan

Maybe you are looking for

  • Can I choose which backup file to restore?

    Just lost my data off my 3GS, which would hang during the backup, sync, upgrade process every time I tried to go from OS 3 to 4 in the past 6 mos or so. Went to Apple store, decided to just trash everything, restart on OS 4 and just use most recent s

  • I tried to update the iTunes software on my iPhone today, and now the phone won't work unless I "restore" it.  I don

    I tried to update my iTunes software on my iPhone today and plugged it into my laptop.  Before the process was complete, I received an error message saying I had to "restore" my iPhone before it would work with iTunes.  Even more importantly, and tro

  • Macbook Pro conected to Plasma TV causes mouseover problem

    I just bought a Samsung PS42A466 plasma TV and hooked it up to my Macbook Pro (early 2009 model) via a Minidisplay Port to DVI adapter - DVI to HDMI adapter and a HDMI cable to TV. I duplicate the desktop in order to get Quicktime to displey the vide

  • DISPLAY CHANGED UNXPECTEDLY!!!!!

    I suddenly lost my millions of color display spontaneously!!!! It became like "over-shinning" with no-borders-icons and very low resolution. I opened System Preferences and Display pane and adjusted to thousands of colors with same results, and then

  • Add a new datafile to the standby database

    Hi, i have a standby database in recovery managed mode. Now i must add a new datafile on the production database and i would like to know how i realized adding the new datafile on the stanby database. is it right when i do the follow steps? Before i