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

Similar Messages

  • File from the Application server

    Hi gurus,
    I am working on a scenario where I need to get a file from the application server and for this I need to ask user to enter the location and that too at the selection screen and then I need to read this location using open data set and read data set in my program , once I am done with this I need to do some other validations. so can you please help me out how to achieve this.
    Thanks
    Rajeev Gupta

    Hi
    Declare the selection screen with file as parameter so that the user enter the application server file..
    the use the OPEND DATASET  as mentioned in below code and process
    Refer this:
    http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3ca6358411d1829f0000e829fbfe/frameset.htm
    ABAP code for uploading a TAB delimited file into an internal table. See code below for structures.
    *& Report  ZUPLOADTAB                                                  *                     &----
    *& Example of Uploading tab delimited file                             *
    REPORT  zuploadtab                    .
    PARAMETERS: p_infile  LIKE rlgrap-filename
                            OBLIGATORY DEFAULT  '/usr/sap/'..
    DATA: ld_file LIKE rlgrap-filename.
    *Internal tabe to store upload data
    TYPES: BEGIN OF t_record,
        name1 like pa0002-VORNA,
        name2 like pa0002-name2,
        age   type i,
        END OF t_record.
    DATA: it_record TYPE STANDARD TABLE OF t_record INITIAL SIZE 0,
          wa_record TYPE t_record.
    *Text version of data table
    TYPES: begin of t_uploadtxt,
      name1(10) type c,
      name2(15) type c,
      age(5)  type c,
    end of t_uploadtxt.
    DATA: wa_uploadtxt TYPE t_uploadtxt.
    *String value to data in initially.
    DATA: wa_string(255) type c.
    constants: con_tab TYPE x VALUE '09'.
    *If you have Unicode check active in program attributes then you will
    *need to declare constants as follows:
    *class cl_abap_char_utilities definition load.
    *constants:
       con_tab  type c value cl_abap_char_utilities=>HORIZONTAL_TAB.
    *START-OF-SELECTION
    START-OF-SELECTION.
    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.
    *END-OF-SELECTION
    END-OF-SELECTION.
    *!! Text data is now contained within the internal table IT_RECORD
    Display report data for illustration purposes
      loop at it_record into wa_record.
        write:/     sy-vline,
               (10) wa_record-name1, sy-vline,
               (10) wa_record-name2, sy-vline,
               (10) wa_record-age, sy-vline.
      endloop.
    Regards
    Anji

  • Error while extracting XML file from the application server

    Hi ,
    I am writing a XML file into the application server, after which when i try to extract the file to the local server using the report - RFASLDPC ,
    the file is extracted, but with a '#' symbol at the first position.
    Because of which the XML File does not open. But after i open the file in notepad and manually delete the '#' symbol and then reopen the file, it works fine.
    Is there any way to remove the '#' symbol while extracting itself ??
    Thanks in advance,
    Vikas.

    Select the option "No Character Set Conversion" in stead of Code page 1100.
    However, I still have troubles -> the downloaded xml file misses a space on several places. This causes errors too.

  • Moving of flat file from the application server after upload.

    Hi All,
    I am uploading data from a flat file placed on the application server by a BDC program.
    After the BDC has created the session i want to transfer the flat file from that folder to another folder on the application server by changing the name of the flatfile.
    Can any one suggest the best way of doing this particular scenario?
    Thanks in advance.
    Regards
    Satish Nair.

    Here is a sample program.
    report zrich_0001.
    data: d1 type localfile value '/usr/sap/TST/SYS/Data1.txt',
          d2 type localfile value '/usr/sap/TST/SYS/Data2.txt'.
    data: begin of itab occurs 0,
          rec(20) type c,
          end of itab.
    data: wa(20) type c.
    start-of-selection.
      open dataset d1 for input in text mode.
      if sy-subrc = 0.
        do.
          read dataset d1 into wa.
          if sy-subrc <> 0.
            exit.
          endif.
          itab-rec = wa.
          append itab.
        enddo.
      endif.
      close dataset d1.
      open dataset d2 for output in text mode.
      loop at itab.
        transfer itab to d2.
      endloop.
      close dataset d2.
      delete dataset d1.
    Regards,
    Rich Heilman

  • How to delete  File from the Application Server,ABAP

    Hi Gurus,
    I'm using  DELETE  DATASET  Statement ,
    Based on Date  how can i delete files with in the period in the Application server
    Any BAPI/FM  for this Delete file based  on some Date Period
    Thanks in Advance.

    DATA: BEGIN OF file,
            dirname(75) TYPE c, " name of directory. (possibly truncated.)
            name(75)    TYPE c, " name of entry. (possibly truncated.)
            type(10)    TYPE c,            " type of entry.
            len(8)      TYPE p,            " length in bytes.
            owner(8)    TYPE c,            " owner of the entry.
            mtime(6)    TYPE p, " last modification date, seconds since 1970
            mode(9)     TYPE c, " like "rwx-r-x--x": protection mode.
            useable(1)  TYPE c,
            subrc(4)    TYPE c,
            errno(3)    TYPE c,
            errmsg(40)  TYPE c,
            mod_date    TYPE d,
            mod_time(8) TYPE c,            " hh:mm:ss
            seen(1)     TYPE c,
            changed(1)  TYPE c,
          END OF file.
    DATA: BEGIN OF file_list OCCURS 100,
            dirname(75) TYPE c, " name of directory. (possibly truncated.)
            name(75)    TYPE c, " name of entry. (possibly truncated.)
            type(10)    TYPE c,            " type of entry.
            len(8)      TYPE p,            " length in bytes.
            owner(8)    TYPE c,            " owner of the entry.
            mtime(6)    TYPE p, " last modification date, seconds since 1970
            mode(9)     TYPE c, " like "rwx-r-x--x": protection mode.
            useable(1)  TYPE c,
            subrc(4)    TYPE c,
            errno(3)    TYPE c,
            errmsg(40)  TYPE c,
            mod_date    TYPE d,
            mod_time(8) TYPE c,            " hh:mm:ss
            seen(1)     TYPE c,
            changed(1)  TYPE c,
          END OF file_list.
      DO.
        CLEAR file.                           
        CALL 'C_DIR_READ_NEXT'
          ID 'TYPE'   FIELD file-type
          ID 'NAME'   FIELD file-name
          ID 'LEN'    FIELD file-len
          ID 'OWNER'  FIELD file-owner
          ID 'MTIME'  FIELD file-mtime
          ID 'MODE'   FIELD file-mode
          ID 'ERRNO'  FIELD file-errno
          ID 'ERRMSG' FIELD file-errmsg.
       if sy-subrc eq 0.
          MOVE-CORRESPONDING file TO file_list.
          APPEND file_list.
       else.
          exit.
       endif.
    enddo.
    sort file_list based on date and time ie, MOD_DATE and MOD_TIME fields
    and delete the entries

  • How can I upload a pdf file into the application server?

    Hi,
    I have the otf data, which i have converted into pdf using the funcation module "Convert_otf". Is it possible to upload the pdf file in application server?

    Dear Srishti,
    Use OPEN DATASET in BINARY MODE.
    following link will help you.
    http://scn.sap.com/thread/1480434
    thanks,
    vidyasagar

  • How to select all files from the application server.

    Hi all,
    I have  a requirement to select all files with the same file format I.e i have created no of files with same name but different time stamps addition , now i want to select all the fiels and read the data into an internal table and sort them on the user requirement,  I am using FM -
    /SAPDMC/LSM_F4_SERVER_FILE to get single file name, i should also give the option on the  selection screen for the user to select the file range I.e form which to which the sorting should be done.
    could anybody suggest me the function module which selects all the file names .
    Regards,
    Sre.
    Edited by: Alvaro Tejada Galindo on Mar 10, 2008 4:49 PM

    Hi,
    PARAMETER: p_fdir type pfeflnamel DEFAULT '/usr/sap/tmp'.
    data: begin of it_filedir occurs 10.
    include structure salfldir.
    data: end of it_filedir.
    *START-OF-SELECTION
    START-OF-SELECTION.
    Get Current Directory Listing for OUT Dir
    call function 'RZL_READ_DIR_LOCAL'
    exporting
    name = p_fdir
    tables
    file_tbl = it_filedir.
    List of files are contained within table it_filedir
    loop at it_filedir.
    write: / it_filedir-NAME.
    endloop.
    Regards,
    Omkaram.

  • "Bad data format" when reading txt file from the presentation server

    Hello,
    I have a piece of code which reads a txt file from the presentation server to an internal table like below:
    DATA : lv_filename type string.
    lv_filename = 'C:\abap\Test.txt'. "I created a folder called abap under C:\
    CALL method CL_GUI_FRONTEND_SERVICES=>GUI_UPLOAD
    EXPORTING
       FILENAME              = lv_filename
    CHANGING
       DATA_TAB            = lt_tsd. " lt_tab has the exact same fields as the Test.txt's. Test.txt has only one line, tab delimited.
    When running this code, exception BAD_DATA_FORMAT is issued.
    Is it because of the file encoding or delimiter or other reason?
    Thanks,
    Yang

    Hello,
    If its tab delimited then use the has_field_seperator parameter and check
    DATA : lv_filename type string.
    lv_filename = 'C:\abap\Test.txt'. "I created a folder called abap under C:\
    CALL method CL_GUI_FRONTEND_SERVICES=>GUI_UPLOAD
    EXPORTING
       FILENAME                = lv_filename
       FILETYPE                 = 'ASC'
       HAS_FIELD_SEPARATOR          = u2018Xu2019
    CHANGING
       DATA_TAB            = lt_tsd.
    Vikranth

  • Reading file from the presentation server in the background

    Hi,
    I am trying to read a .csv file from the presentation server into an internal table in the background. what should I do for it? In the foreground it works fine.
    I have declared a selection parameter 'p_file' that has the path of the file. It wokrs fine in the foreground and how to set it up in the background?
    Any thoughts would be helpful. Thanks in advance,
    VG

    hii
    did you achieved the required functionality , i,e, accessing presentation server file i nbackground .
    I too got the same requirement, can you explain the process.
    There is no way you can do it... The best method is to put the file on Appln server and then call it in the background mode.
    Regards,
    Vishwa.

  • Upload and download of  excel file in the application server in background

    Hi all,
    i want to download the excel file from application server into internal table and after processing i have to upload to excel file in the application server in the background mode..
    i mean i'll schedule the program in background.
    im using FM ALSM_EXCEL_TO_INTERNAL_TABLE its working fine in fore ground but not in back ground.
    what method i have to follow ?

    Hi Ankit,
    I think this is not possible to open a Excel-File from the application server because the Excel format before Office 2007 where a binary format (Suffix: .xls). The newer Office file format (Suffix: xlsx) is a zipped XML Format. To read the binary Excel-Format you need an OLE Connection between SAP GUI and Office. But at the application server in background you doesn't have this OLE Connection.
    In my opinion you have two possibilities:
    1. Convert all files in the CSV format. This file format can be read with open dataset.
    2. Upload the files from the presentation server in forground. There are some funktion modules in the standard which can read the xls format. But they have some limits regarding the length of cells content.
    My recommendation is solution no. 1. If you know an VBA expert, he can write an Excel-macro which converts all Excel Files in the CSV-Fomat.
    Regards
    Dirk

  • 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

  • How do upload a file to the application server into a directory?

    hi to all,
    i want to upload file into the database..i need upload the file into the application server and save it to a directory..is there any way?where i can read about this?any information?
    ashwiny

    Hello,
    First, we need to determine the terms we are using, in order to avoid confusion. We (including the documentation) are using "upload" to describe storing the file on the server, and "download" to pull it from the server into local machine.
    You can use the "File Browse" item to upload any file you need from your local machine and into a database table. The default APEX configuration (in the dads.conf file) stored the uploaded file in a table called wwv_flow_file_objects$. In your application, you can access this table using a view called APEX_APPLICATION_FILES.
    After you uploaded a file, any user can access it, using the download procedure described in the reference I gave you. The download procedure gives you an option to store the download file anywhere you need, using the "Open/Save" dialog box.
    I believe this is covering everything you need. If you still having problems, please consider posting the relevant application pages on apex.oracle.com. It will be easier to understand and help you.
    Regards,
    Arie.

  • Regarding reading data from a file in the application server.

    Hello Everyone,
    My question is:
    The file in the application server consists of data with header, detail and trail out of which the detail contains the main information. The detail again contains the data in the form of a continuous string and again some spaces corresponding to a single record. I need to split the data in the internal table in such a way so that the first few characters get into field-1 of the target internal table. Again I need to consider the spaces for accessing the data for filling up in field-2. How do I decide on the 'Split' statement and specially when the whole string has to be taken care of as contatining data in a single string format without space and again some data after some spaces corresponding to a single record.
    Your help is very much needed. Thanks to all the experts in advance.

    Hi
      This is the sample code I was used for the similar requirement.
    DATA: single_line TYPE string .
    v_file_listings = pa_filn1.
    IF v_file_listings IS INITIAL .
    MESSAGE e039 WITH v_file_listings.
    ENDIF.
    *-- read file, split lines into fields and put data into table
    OPEN DATASET v_file_listings FOR INPUT IN TEXT MODE ENCODING NON-UNICODE. "Opening the files
    IF sy-subrc EQ 0.
    DO.
    READ DATASET v_file_listings INTO single_line. "Reading the content of file into line
    IF sy-subrc = 0.
    IF sy-index > 1. "skip header-line
    SPLIT "Split the content of line into work area
    single_line
    AT k_split
    INTO
    wa_listings-kschl " Condition type
    wa_listings-tabname16 " Condition table name
    wa_listings-vkorg " Sales organisation
    wa_listings-kunnr " sold-to party numberor ship-to party number
    wa_listings-matnr " Material Number
    wa_listings-kodatab " Valid-from date
    wa_listings-kodatb1. " Valid-to date
    APPEND wa_listings TO itab_listings. "Appending Work Area to internal table
    ENDIF.
    ELSE.
    EXIT.
    ENDIF.
    v_count1 = sy-tabix.
    ENDDO.
    Regards,
    Sreeram

  • How do I upload only a few lines of a file from the presentation server?

    Hi there guys,
    I'd like to upload the contents of a file on my HD (presentation server) to an internal table. I know this can be achieved by using the GUI_UPLOAD function module. But what if I only want to upload a part of the file, not the whole thing? Like the first 100 bytes or 10 lines or something like that. Some files are just way too big to upload them as a whole. I tried using the OPEN DATASET statement, but that seems to work only for files on the application server. If I try to open 'C:     emp     est.txt' (for example) with OPEN DATASET, I get an error. Do I have to put the filename differently or am I totally wrong with OPEN DATASET? I'm kinda stuck here and I'd appreciate your help.
    Cheers,
    Björn.

    Hi Shashi,
    thanks for your reply. If I understand you correctly, this means I will have to wait for GUI_UPLOAD to upload the whole file and afterwards filter into another table. I don't want to upload the whole thing because it's that big, I'd like to only upload a portion of it in the first place. Can this be done?
    Cheers,
    Björn.

  • Maximum length of header in the file on the application server?

    Hi there,
               I am uploading a file on the application server. I am writing the header separately which is column heading in char format. Then I am writing the data to that file.
               Now the problem is, I am unable to get more than 256 chars for each line in the file, including header, in <b>AL11 file view</b> and while I am <b>downloading that file on to my desktop</b>, I am <b>not</b> getting more than 256 chars from <b>header </b> line in my excel sheet however I am getting all the chars i.e. more than 256 chars of all the <b>data line</b>.
               Please can you tell,what could be the problem or let me know any way to see and download all the header line fields.

    I am using more than 256 chars at both the places i.e. header and data line. Still I am not getting more than 256 chars in the file.
    However while downloading that file onto the desktop, it is not showing more than 256 chars for the header part, but it showing all the values of data line, exceeding 256 chars.

Maybe you are looking for

  • Preview crashes when opening PDF produced by PDF995 software

    I have a PDF from a friend that crashes on Snow Leopard 10.6.2 Preview (v5.0.1). Preview on 10.5.8 does not crash, nor does Acrobat Reader on either OS. We have duplicated the crash on 3 Macs running 10.6.2. Application Specific Information: * error

  • I-Book battery causing freezes?

    Yesterday my i-book started freezing up completely. I tried everything, and eventually re-enstalled OS X, but it still kept freezing. So on a totally random whim I removed my battery and am running just on wall power. So far it has not frozen up agai

  • Spry MenuBar F. Fox fine, IE Explorer displays off

    Hello Friends, I am having an issue with my Horizontal SpryMenubar. In Firefox all seems fine. However when I load my website in IE Explorer, a black bar, (same length as my Spry Menubar) appears below the actual Menubar. It almost seems like it is p

  • Express document error in VF01 while doing individual billing

    Hi,   My Functional consultant is getting an "express document error" for the transaction VF01. I checked SM13 and its showing error message as " Error updating table J_1ipart2". How to resolve this issue ?    We are getting express document error on

  • How to extend my SAP NetWeaver 2004s Trial Version license ?

    Hi All, I am new to the netweaver, thought i had installed the system some time back, now the license of the trial version has expired and i want to know how can i go about extending the trial version license. Or do i have to go through all the pain