Read Dataset Issue - #

Hi,
Im trying to read internal table which has just one field. In the application server, tab is recognised as # and so at the end of every line we have #. Here as we have only one column,so the value is having #.
In application server :
Directory  /usr/sap/B01/SYS/global/
Name: plants_of_salesorg_cc1_txt.csv
Plants of Sorg 1#
210#
250#
280#
290#
Generally if there are more number of columns we use SPLIT by which this # issue is not raised. In my requirement as we have only column the value is containg # at the end.
Tried          
gc_tab        TYPE c    VALUE cl_abap_char_utilities=>horizontal_tab .
REPLACE gc_tab IN wa_upload WITH gc_b.
APPEND wa_upload TO gi_upload.
Here # is not being recognised in wa_upload.
How can this issue be resolved.
Thanks in advance.
Regards,
Dedeepya

chances are there for a new line also
data : line TYPE c VALUE cl_abap_char_utilities=>newline .
REPLACE line IN wa_upload WITH gc_b.
APPEND wa_upload TO gi_upload.
if still you are facing then try with cr / lf
try with carrage return.
data: cr TYPE c VALUE cl_abap_char_utilities=>cr_lf .
REPLACE cr  IN wa_upload WITH gc_b.
APPEND wa_upload TO gi_upload.
if it is not working , try with line feed.
data : lf  TYPE c VALUE cl_abap_char_utilities=>cr_lf .
lf = cl_abap_char_utilities=>cr_lf +1(1).
REPLACE lf IN wa_upload WITH gc_b.
APPEND wa_upload TO gi_upload.

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

  • Unicode - Read dataset dump

    *{Comm Unicode Conversion
    OPEN DATASET DDDEIN FOR INPUT IN TEXT MODE.
    *}Comm  Unicode Conversion
    *{Ins   Unicode Conversion
      OPEN DATASET DDDEIN FOR INPUT IN TEXT MODE
                       ENCODING DEFAULT.
    *}Ins  Unicode Conversion
    READ DATASET DDDEIN INTO DEIN.
    here i am geeting dump. this is due ot DEIN is a structure, contains quanity and currency fields. these are not converted.
    So, How can i solve this issues. 
    Note: if dont understand plese leave youe quiries here, i will give reply immediately.
    Thanks
    Sudhakar
    Edited by: sudhakara reddy on Feb 7, 2008 2:34 PM

    Hi,
    Check this link
    http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3d42358411d1829f0000e829fbfe/content.htm
    Regards
    Shiva

  • 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

  • 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

  • Read Only Issues

    Folks,
    Using EPM 2007 with SP2
    I have about 4 PM's that are having read only issue with some of their projects, this has just started to happen in the last month or so.
    I have sat with them and have gone over their save / checkin method and cannot find fault with what they are doing. As the Admin I can access, update checkin / out etc no problems.
    Checking in the "Clean Up Cache" the projects are registering "Not checked out".  In the "Open Folder" they have a Cache Status of Checkin Pending.
    Any suggestion greatly appreciated
    Many thanks
    Noel

    Hi Sujit
    Apologies for the delay, as per your direction all good now
    Regards
    Noel

  • Read only issue

    I have file, read/ write on desktop.
    It's read write on the laptop via router / network.
    But when open now get this new message:
    File is being modified by Kevs, open as read- only or choose to be notified or altered when available.
    These network/read write issues never seem to end! I'm wiped out, any ideas? thanks!

    Uncheck Read Only on the song files in Windows Exploder.

  • Didnt read the issues with ios5 until i've done my update. I ve restored my iphone 4, 3 times, and till now it is locked in a loop of the apple logo, loading

    Didnt read the issues with iOS5 until i've updated my iPhone 4. Restored 3 times and it is still locked in a loop of - Apple logo, loading, and a flash of "...restore successful...few steps away..." and buzz. Please help

    At the end of a Restore, you will be asked if you want the current iPhone to be synched as a New iPhone or use the current iPhone's settings. Selecting the former since to have solved the messaging problem. If u have done back-up of the "old" iPhone on iTunes, then your New iPhone will be the "old" iPhone too after synching with iTunes :)

  • 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

Maybe you are looking for