READ DATASET

Hi Friends,
I'm getting problem in reading only 100 records from the application server using the READ DATASET statement. The file on the application server may have 8000 records but i wanted to get only 100 records and process them. Then i wanted to get  next 100 records from the file stored on app.server and process and so on.
After I get the 100 records, I wanted to do further operations such as putting them into a custom table.
Will the below code work?
DATA l_item(100) type c.
*Open the .DAT file for reading
  OPEN DATASET p_file1 FOR INPUT IN TEXT MODE ENCODING UTF-8 MESSAGE
  x_error.
  IF sy-subrc NE 0.
*An error occured during opening the dataset !
    MESSAGE x_error TYPE 'E'.
    CLEAR x_error.
  ENDIF.
  DO.
*Read the .DAT file into an internal table
    READ DATASET p_file1 INTO l_item.
    IF sy-subrc EQ 0.
*split the records into data fields based on delimiter ','
*then append the current record to an internal table
      SPLIT l_item AT ',' INTO
                               x_item-inv_item_id
                               x_item-intl_aa_nbr
                               x_item-intl_pba_nbr
                               x_item-intl_ta_nbr
                               x_item-intl_product_code
                               x_item-descr254
                               x_item-intl_stck_id
                               x_item-awr_disallowed_flg
                               x_item-returnable_flg
                               x_item-fulfillment_flg
                               x_item-refund_only_flg
                               x_item-prod_returnable_flg
                               x_item-stock_cat_id.
      APPEND x_item TO i_item.
      CLEAR x_item.
    ELSE.
*Data was read and the end of the file was reached
      MESSAGE i006.
      EXIT.
    ENDIF.
  ENDDO.

Hi,
If you want to process every 100 records once,  you can in ways.
1.  
DO.
*Read the .DAT file into an internal table
    READ DATASET p_file1 INTO l_item.
    IF sy-subrc EQ 0.
*split the records into data fields based on delimiter ','
*then append the current record to an internal table
      SPLIT l_item AT ',' INTO
                               x_item-inv_item_id
                               x_item-intl_aa_nbr
                               x_item-intl_pba_nbr
                               x_item-intl_ta_nbr
                               x_item-intl_product_code
                               x_item-descr254
                               x_item-intl_stck_id
                               x_item-awr_disallowed_flg
                               x_item-returnable_flg
                               x_item-fulfillment_flg
                               x_item-refund_only_flg
                               x_item-prod_returnable_flg
                               x_item-stock_cat_id.
      APPEND x_item TO i_item.
      CLEAR x_item.
      lv_count = lv_count + 1.
     if lv_count = 100.
       perform process 100 records.
        clear: lv_count, x_items.
        refresh x_items.
    endif.
    ELSE.
*Data was read and the end of the file was reached
      MESSAGE i006.
      EXIT.
    ENDIF.
  ENDDO.
2.   Download all records into an internal table once.
then loop internaltable.
data: lv_count type i,
         lv_count1 type i,
         lv_previous type i.
lv_count = lv_count  + 1.
lv_count1 = lv_count1 + 1.
if lv_count1 < = 100.
copy 100 records into another internal table2.
else.
     lv_previous = lv_count - lv_previous.
if lv_previous = 100.
    process records.
   clear: lv_count1,  internal table2.
   refresh internal table2
endif.
endif.
endloop.
regards,
Ganesh

Similar Messages

  • Problem with READ DATASET when reading file from app server

    Hi,
    wondering if anyone can help, I'm using the following code to read from a file on app server, the file is of type .rtf
    OPEN DATASET file_rtf FOR INPUT IN TEXT MODE
                                 ENCODING DEFAULT
                                 WITH SMART LINEFEED.
    DO.
    READ DATASET file_rtf INTO string.
    IF SY-SUBRC = 0.
    EXIT.
    ENDIF.
    ENDDO.
    the open dataset part works sy-subrc = 0, but the read returns sy-subrc = 8 and no data is passed to string.
    Any ideas as to what is causing this problem appreciated, <removed>
    Thanks
    Edited by: Thomas Zloch on Mar 17, 2010 3:57 PM - please don't offer p...

    Hi Adam,
    The source code in the below link has details about how to read/write to application server.
    [Application server file operartions|http://www.divulgesap.com/blog.php?p=NDk=]
    Please let us know if you have any issues.
    Regards,
    Ravi

  • Upload xml file from aplication server using read dataset, parser error.

    Hi,
    I would like to upload xml file from app. server but parser failed. If I upload this xml file from workstation (using ws_upload) it is correct. For uploading xml file from app. server I use open dataset... read dataset. In loop section I remove '#' char. How do You upload xml file from app server? What Could be incorrect.
    I try to open dataset in binary mode, text mode...
    TYPES: BEGIN OF xml_line,
            data(255) TYPE c,
          END OF xml_line.
    DATA: gt_xml_table TYPE TABLE OF xml_line,
          gs_xml_structure TYPE  xml_line,
          gv_xml_table_size TYPE i.
    OPEN DATASET s FOR INPUT IN BINARY MODE.
      IF sy-subrc <> 0.
        MESSAGE e001(zet) WITH '....'.
      ENDIF.
      DO.
        READ DATASET s INTO gs_xml_structure.
        IF sy-subrc <> 0.
          EXIT.
        ELSE.
         len = STRLEN( gs_xml_structure ).
         len = len - 1.
         check len > 0.
         WRITE gs_xml_structure(len) TO gs_xml_structure.
          APPEND gs_xml_structure TO gt_xml_table.
        ENDIF.
      ENDDO.

    You Can do this too
    parameters: p_file like rlgrap-filename.
    data: subrc like sy-subrc.
      create object me.
      REFRESH t_data.
    *  Open XML File
      CALL METHOD me->CREATE_WITH_FILE
        EXPORTING
          filename = p_file
        RECEIVING
          retcode  = subrc.
    * Saves Data in an itab from XML File.
      CALL METHOD me->get_data
        IMPORTING
          retcode    = subrc
        CHANGING
          dataobject = t_data[].
    Regards,
    Claudio.

  • Not able to get file from application server with read dataset

    Hi,
    Firstly i download a file from application server from read data set and then i sent this file as attachment. But problem is that i am able to send .jpg .bmp file but i am not able to send .pdf or .doc file so what can i do for that. ?
    My code is like below...
      DATA : PATH TYPE STRING.
      DATA: E_FILE LIKE RLGRAP-FILENAME.
      CONCATENATE '/tmp/'  NAME_WITH_EXT INTO E_FILE SEPARATED BY SPACE.
      CONDENSE E_FILE NO-GAPS.
      IF EXTENSION = 'TXT'.
        OPEN DATASET E_FILE FOR INPUT IN TEXT MODE ENCODING DEFAULT WITH WINDOWS LINEFEED . " MESSAGE MSG.
        IF SY-SUBRC <> 0.
       WRITE: SY-SUBRC, MSG, ' LIKE ', C_FNAME.
        ELSE.
          WHILE SY-SUBRC = 0.
            READ DATASET E_FILE INTO WA_C.
            IF SY-SUBRC <> 0.
              EXIT.
            ENDIF.
            APPEND WA_C TO IT_C.
          ENDWHILE.
          CLOSE DATASET E_FILE.
        ENDIF.
      ELSE.
        OPEN DATASET E_FILE FOR INPUT IN BINARY MODE. " ENCODING DEFAULT. "    INPUT IN  BINARY MODE . " TEXT MODE ENCODING   NON-UNICODE.
        IF SY-SUBRC = 0.
          DO .
            READ DATASET E_FILE INTO GS_PDF_TAB.
            IF SY-SUBRC = 0.
              APPEND GS_PDF_TAB TO GT_PDF_TAB.
            ELSE.
              EXIT.
            ENDIF.
          ENDDO.
          CLOSE DATASET E_FILE.
        ENDIF.
      ENDIF.
    Regards,
    Gurprit Bhatia

    delete this line DEFAULT WITH WINDOWS LINEFEED  and check this..

  • # problem while reading dataset from application server.

    hi all,
    I uplodaed a  text file which is tab delimeted, to the application server using transaction code cg3z directly. now that file is stored with # in place of tab(space) in application server.
    my broblem is that when i am reading that file using  READ DATASET  its comming with that # symbol also.
    how i split that dataset .
    or if there is any other solution ,like openning file into another mode,
    help me.
    thank uou

    Hi Pawan..
    you can access the Tab character using CL_CHAR_ABAP_UTILITIES=>HORIZONTAL_TAB
    Do like this After READ DATASET.
    DATA : V_RECORD(100).
    DO.
    READ DATASET P_FILE INTO V_RECORD.
    IF SY-SUBRC <> 0.
      EXIT.
    ENDIF.
    SPLIT V_RECORD INTO FIELD1 FIELD2 SEPARATED BY <b>CL_CHAR_ABAP_UTILITIES=>HORIZONTAL_TAB.</b>
      <<<<further operations here>>>>
    ENDDO.
    reward if Helpful.
    <b></b>

  • Reading File from Application Server using Read Dataset

    Hi,
    i am trying to read excel file from Application Server and has multiple records in that based on structure below. but when i execute its giving me error message.here is the code, can sumone suggest me on this please ??
    FORM f_data_upload .
      DATA:
         l_filename TYPE string,   "file name
         l_wa_string TYPE string.  "file record
        l_filename = p_inp_as. "File path from Application Server
        OPEN DATASET l_filename FOR INPUT IN TEXT MODE ENCODING DEFAULT.
        DO.
          IF sy-subrc <> 0.
            EXIT.
          ENDIF.
    Read the data from the file in Application server.
          READ DATASET l_filename INTO l_wa_string.
          IF sy-subrc = 0.
            SPLIT l_wa_string AT cl_abap_char_utilities=>horizontal_tab
                  INTO w_data-tcode
                       w_data-matnr
                       w_data-mtart
                       w_data-werks
                       w_data-vkorg
                       w_data-vtweg
                       w_data-lgort
                       w_data-meins
                       w_data-maktx
                       w_data-spart
                       w_data-kosch
                       w_data-mstae
                       w_data-brgew
                       w_data-ntgew
                       w_data-groes
                       w_data-matkl
                       w_data-prdha
                       w_data-mstde
                       w_data-mtpos_mara
                       w_data-gewei
                       w_data-spart
                       w_data-mstav
                       w_data-mstdv
                       w_data-dwerk
                       w_data-taxkm
                       w_data-versg
                       w_data-kondm
                       w_data-ktgrm
                       w_data-mtpos
                       w_data-mtvfp
                       w_data-tragr
                       w_data-ladgr
                       w_data-herkl
                       w_data-ekgrp
                       w_data-webaz
                       w_data-dismm
                       w_data-beskz
                       w_data-prctr
                       w_data-bklas
                       w_data-bwtty
                       w_data-vprsv
                       w_data-verpr
                   IN CHARACTER MODE.
            APPEND w_data TO i_data.
            CLEAR w_data.
           ENDIF.
        ENDDO.
        CLOSE DATASET l_filename.
    Error Message while executing
    What happened?
        At the conversion of a text from codepage '4110' to codepage '4102':
        - a character was found that cannot be displayed in one of the two
        codepages;
        - or it was detected that this conversion is not supported
        The running ABAP program 'ZHDI_LOMM_VEHI_MAT_MASS_CREATE' had to be terminated
         as the conversion
        would have produced incorrect data.
        The number of characters that could not be displayed (and therefore not
        be converted), is 449. If this number is 0, the second error case, as
        mentioned above, has occurred.
    Error analysis
        An exception occurred that is explained in detail below.
        The exception, which is assigned to class 'CX_SY_CONVERSION_CODEPAGE', was not
         caught in
        procedure "F_DATA_UPLOAD" "(FORM)", nor was it propagated by a RAISING clause.
        Since the caller of the procedure could not have anticipated that the
        exception would occur, the current program is terminated.
        The reason for the exception is:
        Characters are always displayed in only a certain codepage. Many
        codepages only define a limited set of characters. If a text from a
        codepage should be converted into another codepage, and if this text
        contains characters that are not defined in one of the two codepages, a
        conversion error occurs.
        Moreover, a conversion error can occur if one of the needed codepages
        '4110' or '4102' is not known to the system.
        If the conversion error occurred at read or write of  screen, the file
        name was '/usr/sap/interfaces/conversion/pioneer/ddm/data/test_data1.xls'.
         (further information about the file: "X 549
         24064rw-rw----200812232135082008122307293120081223072931")
    Please help me
    Thank You

    Woah ... perfect guru
    but data looks like all junk characters ? its filling with special characters, hashes # and other characters but not with Excel data.. any idea ??
    Temesh
    Edited by: New2Sap Abap on Dec 24, 2008 6:42 AM

  • Error on line read dataset p_zfile into it_int

    hi while executing this below code..
    open dataset p_zfile for input in text mode ENCODING DEFAULT.
        if sy-subrc = 0.
          v_one = 1.
          do.
            v_no = v_no + 1.
         *read dataset pzfile  into it_record*_ this is giving short dump as below
    code to read file
    end do
    short dump
    the following error is being prompted
    CONVT_CODEPAGE
    CX_SY_CONVERSION_CODEPAGE
    A character set conversion is not possible.
    At the conversion of a text from codepage '4110' to codepage '4103':
    - a character was found that cannot be displayed in one of the two
    codepages;
    - or it was detected that this conversion is not supported
    where
    it_record is type infile_struct,
    and infile_struct is as below
    types: begin of infile_struct,
            data(1150)           type c,
           end of infile_struct.
    and p_zfile is used in fm call file_get_nam
    please suggest this code is working fine in 4.6 c not upgraded to SAP ECC 6.0 this error is occuring in the code
    regarda
    arora

    here is code
    open dataset p_infile for input in text mode ENCODING DEFAULT.
    f sy-subrc = 0.
          v_one = 1.
          do.
            v_no = v_no + 1.
            read dataset p_infile into in_record.        if sy-subrc = 0. here dump is occuring at last record i deleted the last record in the file but again the dump comes on last record only when all records are read and finally when the cursor come to read dataset statement last time
              if v_no <> v_one.
                split in_record at v_tab into wa_record-idno
                                              wa_record-stonumber
                                              wa_record-stolineno
                                              wa_record-sched_line
                                              wa_record-pur_group
                                              wa_record-frmplant
                                              wa_record-frmstglocatin
                                              wa_record-toplant
                                              wa_record-tostglocation
                                              wa_record-material
                                              wa_record-matdesc
                                              wa_record-quantity
                                              wa_record-dockdate
                                              wa_record-splinst1
                                              wa_record-splinst2
                                              wa_record-splinst3
                                              wa_record-splinst4
                                              wa_record-delete
                                              wa_record-block.

  • Read dataset - read data randomly

    Dear All,
    I am facing a strange problem while reading data through READ DATASET statement.
    The data is getting read randomly from the file.
    For example, if my text file contains 10,000 records, i am able to see around 800 in my internal table.
    Also, with read dataset statement, sometimes first record gets read, second time fifth record and so on. There is no particular order.
    Read dataset statement is skipping a lot of records while reading data from the file.
    Has anyone face this problem earlier?
    Any clue in this direction will be highly appreciated.
    Many thanks.
    Best Regards,
    Tarun

    Hi,
    how you are looking your input file, if it is in NOTEPAD check menu option 'Format----> Word wrap' is unchecked and then see the how many entries are there in the file.
    Regards,
    Sreeram.

  • Select query and read dataset

    i have to read an excel sheet from the application server into an internal table that i hv created.can you help me to write  select query &read dataset statement?
    suppose the internal table name is T_a and it has fields f1 to f7 which are all present in the excel sheet.
    <REMOVED BY MODERATOR>
    Thanks in advance,
    Anand.
    Edited by: Alvaro Tejada Galindo on Feb 14, 2008 2:33 PM

    Hi
    select f1 f2 f3 f4 f5 f6 f7
    from TABLE
    into table T_a.
    read table T_a with key f1 = <val1>.
    <REMOVED BY MODERATOR>
    Regards,
    Mansi.
    Edited by: Alvaro Tejada Galindo on Feb 14, 2008 2:33 PM

  • Upload read dataset only one line

    hi all
    i have a problem, i want to upload a file from applikation server. When i want to read dataset into a xstring field,
    it read only the first line not all why?
    here is my code
    type-pools dset.
    data lf_filename type string value '/opt/interface/indtrans/d58_sst/integrale/output/PLU.plu'.
    data lf_line type xstring.
    data lf_str_line type string.
    data lf_hex_code type swxmlcont.
    data lt_attr type dset_attributes.
    start-of-selection.
      open dataset lf_filename for input in binary mode.
      do.
        read dataset lf_filename into lf_line.
        if sy-subrc <> 0.
          exit.
        else.
    *      get dataset lf_filename attributes lt_attr.
          append lf_line to lf_hex_code.
        endif.
      enddo.
      close dataset lf_filename.
    thx abap_begin....

    that to be functional, but when i read with the file with cl_gui_frontend_services=>gui_upload with file Typ "BIN"
    CALL METHOD cl_gui_frontend_services=>gui_upload
         EXPORTING
           FILENAME                = l_filename
           FILETYPE                = 'BIN'
    *      HAS_FIELD_SEPARATOR     = SPACE
    *      HEADER_LENGTH           = 0
         IMPORTING
           FILELENGTH              = l_size
    *      HEADER                  =
         CHANGING
           data_tab                = lt_data
         EXCEPTIONS
           FILE_OPEN_ERROR         = c_not_found
           FILE_READ_ERROR         = 3
           INVALID_TYPE            = 4
           NO_BATCH                = 5
           GUI_REFUSE_FILETRANSFER = 7
           others                  = 99.
    i becam a other result then, when i read with
    open dataset lf_filename for input in binary mode.
    why?
    Now i have a idea, i read the file value in text mode and save this in an internal table.
    Then make the loop over table, and convert the value in identical princple such as cl_gui_frontend_services=>gui_upload with the filetype "BIN".
    I dont' know, how you do this?
    thx abap_begin

  • Explain why READ DATASET conversion from codepage '4110' to codepage '4102'

    I am unfamiliar with unicode but I am trying to solve a problem in an ABAP program.
    Our code is
    OPEN DATA p_in FOR INPUT IN TEXT MODE ENCODING DEFAULT.
    DO.
      READ DATASET p_in INTO i_tab.
    The program gives me the error  'At the conversion of a text from codepage '4110' to codepage '4102'.  The program abends on a line in the file that contains the special character '#'.
    Does this mean that the file I am reading is in codepage '4110' and the internal format of i_tab is codepage '4102'?  If so, how do the codepages get assigned to unix files and internal structures   How can I make the both codepage '4110' or codepage '4102'?  Also, what is the difference between these two codepages?
    thanks.
    Ryan
    My

    Hi,
    Use
    open dataset DSN in text mode for input encoding utf-8.

  • How to write read dataset statement in unicode

    Hi All,
    I am writing the program using open dataset concept .
    i am using follwing code.
        PERFORM FILE_OPEN_INPUT USING P_P_IFIL.
        READ DATASET P_P_IFIL INTO V_WA.
        IF SY-SUBRC <> 0.
          V_ABORT = C_X.
          WRITE: / TEXT-108.
          PERFORM CLOSE_FILE USING P_P_IFIL.
        ELSE.
          V_HEADER_CT = V_HEADER_CT + 1.
        ENDIF.
    Read dataset will work for normal code.
    when it comes to unicode it is going to dump.
    Please can u tell the solution how to write read dataset in unicode.
    Very urget.
    Regards
    Venu

    Hi Venu,
    This example deals with the opening and closing of files.
    Before Unicode conversion
    data:
      begin of STRUC,
        F1 type c,
        F2 type p,
      end of STRUC,
      DSN(30) type c value 'TEMPFILE'.
    STRUC-F1 = 'X'.
    STRUC-F2 = 42.
    Write data to file
    open dataset DSN in text mode. ß Unicode error
    transfer STRUC to DSN.
    close dataset DSN.
    Read data from file
    clear STRUC.
    open dataset DSN in text mode. ß Unicode error
    read dataset DSN into STRUC.
    close dataset DSN.
    write: / STRUC-F1, STRUC-F2.
    This example program cannot be executed in Unicode for two reasons. Firstly, in Unicode programs, the file format must be specified more precisely for OPEN DATASET and, secondly, only purely character-type structures can still be written to text files.
    Depending on whether the old file format still has to be read or whether it is possible to store the data in a new format, there are various possible conversion variants, two of which are introduced here.
    After Unicode conversion
    Case 1: New textual storage in UTF-8 format
    data:
      begin of STRUC2,
        F1 type c,
        F2(20) type c,
      end of STRUC2.
    Put data into text format
    move-corresponding STRUC to STRUC2.
    Write data to file
    open dataset DSN in text mode for output encoding utf-8.
    transfer STRUC2 to DSN.
    close dataset DSN.
    Read data from file
    clear STRUC.
    open dataset DSN in text mode for input encoding utf-8.
    read dataset DSN into STRUC2.
    close dataset DSN.
    move-corresponding STRUC2 to STRUC.
    write: / STRUC-F1, STRUC-F2.
    The textual storage in UTF-8 format ensures that the created files are platform-independent.
    After Unicode conversion
    Case 2: Old non-Unicode format must be retained
    Write data to file
    open dataset DSN in legacy text mode for output.
    transfer STRUC to DSN.
    close dataset DSN.
    read from file
    clear STRUC.
    open dataset DSN in legacy text mode for input.
    read dataset DSN into STRUC.
    close dataset DSN.
    write: / STRUC-F1, STRUC-F2.
    Using the LEGACY TEXT MODE ensures that the data is stored and read in the old non-Unicode format. In this mode, it is also possible to read or write non-character-type structures. However, be aware that data loss and conversion errors can occur in Unicode systems if there are characters in the structure that cannot be represented in the non-Unicode codepage.
    Reward pts if found usefull :)
    Regards
    Sathish

  • Incorrect entries from application server file read dataset .

    As i am using below code for fetching file data from application server to internal table in custom report.
    data in internal table in inconsistent is there any another way to do in?
    report zparoman.
    TYPES: BEGIN OF ty_bkpf,  " STRUCTURE DEFINATION bkpf
             belnr TYPE belnr_d ,
             bukrs TYPE bukrs,
             gjahr TYPE gjahr,
             bldat TYPE bldat,
             cpudt TYPE cpudt,
             waers TYPE waers,
             blart TYPE blart,
             budat TYPE budat,
             xblnr TYPE xblnr1,
             bktxt TYPE bktxt,
      END OF ty_bkpf.
    DATA: it_bkpf TYPE STANDARD TABLE OF ty_bkpf INITIAL SIZE 0, " INTERNAL TABLE it_BKPF
           wa_bkpf TYPE ty_bkpf.                                   " work area wa_bkpf
    TYPES: BEGIN OF ty_bseg,
           belnr TYPE belnr_d,
           bukrs TYPE bukrs,
           buzei TYPE buzei,
           bschl TYPE bschl,
           umskz TYPE umskz,
           hkont TYPE hkont,
           zterm TYPE dzterm,
           wrbtr TYPE wrbtr,
           kostl TYPE kostl,
           prctr TYPE prctr,
           mwskz TYPE mwskz,
           sgtxt TYPE sgtxt,
           zuonr TYPE dzuonr,
           zlspr TYPE dzlspr,
           zlsch TYPE schzw_bseg,
       END OF ty_bseg.
    DATA: it_bseg TYPE STANDARD TABLE OF ty_bseg INITIAL SIZE 0, "internal table it_bseg
           wa_bseg TYPE ty_bseg.                                   "work area wa_bseg
    TYPES:BEGIN OF ty_final,                                    " final structue defn
            header TYPE c LENGTH 3,
            belnr TYPE c LENGTH 10,"belnr_d,
            bukrs TYPE c LENGTH 4,"bukrs,
            gjahr TYPE c LENGTH 4,"gjahr,
            bldat TYPE c LENGTH 8,"bldat,
            cpudt TYPE c LENGTH 8,"cpudt,
            waers TYPE c LENGTH 5,"waers,
            blart TYPE c LENGTH 2,"blart,
            budat TYPE c LENGTH 8,"budat,
            xblnr TYPE c LENGTH 16,"xblnr1,
            bktxt TYPE c LENGTH 25,"bktxt,
            buzei TYPE c LENGTH 3,"buzei,
             bschl TYPE c LENGTH 2,"bschl,
             umskz TYPE c LENGTH 1,"umskz,
             hkont TYPE c LENGTH 10,"hkont,
             zterm TYPE c LENGTH 4,"dzterm,
             wrbtr TYPE c LENGTH 13,"wrbtr,
             kostl TYPE c LENGTH 10,"kostl,
             prctr TYPE c LENGTH 10,"prctr,
             mwskz TYPE c LENGTH 2,"mwskz,
             sgtxt TYPE c LENGTH 50,"sgtxt,
             zuonr TYPE c LENGTH 18,"dzuonr,
             zlspr TYPE c LENGTH 1,"dzlspr,
             zlsch TYPE c LENGTH 1,"schzw_bseg,
      END OF ty_final.
    DATA: it_final TYPE STANDARD TABLE OF ty_final INITIAL SIZE 0, " final internal table it_final
            wa_final TYPE ty_final.                                  " work area wa_final
    TYPES: BEGIN OF temp_str,
    wa_string(5000) TYPE c,
       END OF temp_str.
    DATA:it_str TYPE TABLE OF temp_str,
           wa_str TYPE temp_str.
    DATA: gv_file   TYPE rlgrap-filename.
    gv_file = 'E:\USR\SAP\ECS\SYS\CSL_FIGL_TRANS_DATA_04172014162215.TXT'.
    OPEN DATASET gv_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.     "Opening file from Application server
    IF sy-subrc EQ 0.
    *  DO 2 TIMES.
       DO.
         READ DATASET gv_file INTO wa_str.
         IF sy-subrc = 0.
           APPEND wa_str TO it_str.
         ELSE.
           EXIT.
         ENDIF.
       ENDDO.
       ENDIF.
    *   WRITE:/ 'HELLO'.
    LOOP AT it_str INTO wa_str.
        split wa_str at ' ' into
           wa_final-header
            wa_final-belnr
            wa_final-bukrs
            wa_final-gjahr
            wa_final-bldat
            wa_final-cpudt
            wa_final-waers
            wa_final-blart
            wa_final-budat
            wa_final-xblnr
            wa_final-bktxt
            wa_final-buzei
             wa_final-bschl
             wa_final-umskz
             wa_final-hkont
             wa_final-zterm
             wa_final-wrbtr
             wa_final-kostl
             wa_final-prctr
             wa_final-mwskz
             wa_final-sgtxt
             wa_final-zuonr
             wa_final-zlspr
             wa_final-zlsch.
                                             " Split the string separated by SPACE
         append wa_final to it_final.
    ENDLOOP.

    Hi ,
    Try to open the file with encoding UTF-8 :
       Open dataset file for INPUT in TEXT MODE ENCODING UTF-8 .
    Regards

  • READ DATASET  fails!

    Hi,
    data: dsn(95) value '/usr/sap/U6B/D85/work/jana10'.    "dsn data is filled by another program
    DATA: BEGIN OF STR,
             STLNR LIKE STZU-STLNR,
             CNTRL,
          END OF STR.        " this is a pure character type structure
    OPEN DATASET DSN IN TEXT MODE FOR OUTPUT ENCODING UTF-8.
    READ DATASET DSN INTO STR.
    Read always fails in here with subrc = 4.
    Any idea what i have to change to get this working?
    Thanks,
    Ashvini.

    Hello Ashvini
    Combine ... FOR OUTPUT... with ...TRANSFER...    and
    ... FOR INPUT...  with  ...READ DATASET...
    Regards
      Uwe

  • READ DATASET PROBLEM

    Hi all,
    Using the code to read file data
    DATA : Len type i,
                str_name type string.
    READ DATASET name INTO str_name LENGTH len .
    but it only reads first 155 characters i.e. length is always 155 not more that that but as per requirement wants to read more that 155 charcters.
    Any suggestions welcome,
    Regards,

    READ for Files
    Reads a file.
    Syntax
    READ DATASET <dsn> INTO <f>
    [MAXIMUM LENGTH <maxlen>]
    [ACTUAL LENGTH <len>].
    Reads the contents of the file <dsn> on the application server to the variable <f>. The amount of data can be specified using MAXIMUM LENGTH. The number of bytes transferred can be written to <len> using ACTUAL LENGTH.
    Regards,
    Priya.

Maybe you are looking for

  • Need Help with Mounting 3 TB drives

    Have a problem with Mounting /seeing full 3TB drives THE GEAR #1- Macbook Pro 13" mid 2010 Mavericks 10.9.1 #2- Macbook Pro 13" late 2011 Mavericks 10.9.1 1 usb2/esata 2 bay hot swap dock 1 seagate Backup plus 3 TB with enclosure 1 WD 3 TB HD 2 Seaga

  • Many copies of a pictures on Iphoto.

    Hello! I would like to know where I can find more information about using Iphoto. I had to remove all my pictures from Iphoto because there was a mess, many copies of one picture. I deleted some in order to organize them, but they look with low resol

  • Movieclip/Layer Naming Suggestion

    Because you can only animate one movieclip per layer on the timeline. Can we currently or can you (Adobe), make it possible that in the future, when you create a symbol from a fill/line/imported image for the first time on a original-unchanged Layer

  • HT4623 Error occurred installing iOS 6.1.1

    An error occurred installing iOS 6.1.1

  • FAQ: BC-LDAP-USR (Directory Interface for User Management via LDAP )

    Version: 20060317 Q: Where can i find more information to the BC-LDAP-USR interface ? A: Have a look on our ICC webpage in the SDN: SAP NetWeaver AS - Directory Interface for User Management via LDAP (BC-LDAP-USR)[1] [original link is broken] Q: What