Problem  in reading file from application server

while reading the file from application server i am succesful in reading from dataset but the program gets terminated giving a runtime error "CONVT_CODEPAGE".
the code written is as below :
open dataset d1 for input in text mode encoding default.
IF sy-subrc NE 0.
EXIT.
ENDIF.
do.
                Read dataset d1 into btab.
     if sy-subrc <> 0.
     exit.
               else.
               condense btab NO-GAPS.
               wtt_text-text1 = btab-wa+0(10).
               wtt_text-text2 = btab-wa+10(1).
               wtt_text-text3 = btab-wa+11(3).
              append wtt_text.
              clear wtt_text.
              wt_counter = wt_counter + 1.
              ENDIF.
enddo.
write : /10 ' number of records :'.
write :  wt_counter.
kindly help me asap.
regards,
rachu.

If I am not wrong you are working on a Unicode enabled system. That is why this error is coming.
Look at the link below, where the solution is provided.
http://help.sap.com/saphelp_nw2004s/helpdata/en/79/c554dcb3dc11d5993800508b6b8b11/content.htm
open dataset DSN in text mode for output encoding utf-8.
Regards,
Ravi
Note - Please close the thread by selecting PROBLEM SOLVED against the answer which helped your most, if the issue is resolved.

Similar Messages

  • Uploading and reading file from application server

    Hi
    My problem is when am uploading a file to application server it is getting stored in
    usr/sap/transyp1/prod/in   directory
    after that i want to read that file from application server to update database
    when  using below code it is showing some other directory in f4 help
    DATA: lv_hostname TYPE msxxlist-name.
    DATA: lv_server TYPE bank_dte_jc_servername.
    PARAMETERS: p_file TYPE rlgrap-filename.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
    CALL FUNCTION 'BANK_API_SYS_GET_CURR_SERVER'
    IMPORTING
    e_server = lv_server.
    lv_hostname = lv_server.
    CALL FUNCTION 'F4_DXFILENAME_4_DYNP'
    EXPORTING
    dynpfield_filename = 'P_FILE'
    dyname = sy-cprog
    dynumb = '1000'
    filetype = 'P'
    location = 'A'
    server = lv_hostname.
    experts could you please help me out
    Thanks & Regards
    Nagesh.Paruchuri

    User Transaction file. You will get all logical file path names.
    used following fucntion module to read file name and use command open dataset to read the file.
    CALL FUNCTION 'FILE_GET_NAME'
           EXPORTING
                CLIENT           = SY-MANDT
                LOGICAL_FILENAME = C_LOGICAL_FILENAME
                OPERATING_SYSTEM = SY-OPSYS
                PARAMETER_1      = P_IN_FILENAME
           IMPORTING
                FILE_NAME        = P_OUT_FILENAME
           EXCEPTIONS
                FILE_NOT_FOUND   = 1
                OTHERS           = 2.
    OPEN DATASET P_OPEN_FILE ENCODING UTF-8 IN TEXT MODE FOR OUTPUT.
      IF SY-SUBRC <> 0.
        MESSAGE E000(38) WITH 'Error in Opening file: ' V_PHY_FILENAME.
      ENDIF.

  • Problem in uploading file from Application Server

    Hi everyone,
    i got a problem in uplaoding a file from application server.i am having two folder (one folder name is current and another one is processed)in application server. In current folder i am having N no of files.I want to upload all the files names into one internal table and i want to process one by one file.After processing each file the file should be moved to processed folder and the files should not exist in current folder.All these process must be done everyday.Please rectify my problem asap.

    Ramesh,
    Take authorization from basis guy.
    Use the below code to get the list of files from require directory
    *& Report  ZDIRFILES                                                   *
    REPORT  ZDIRFILES    .
    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.
    Now in internal table "it_filedir"  will have all your files.
    For moving and deleting
    report zrich_0001.
    Parameters: d1 type localfile default '/usr/sap/TST/SYS/fld1/Data1.txt',
                d2 type localfile default '/usr/sap/TST/SYS/fld2/Data1.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.
    Check below FM if required
    To move the file to archive directoryuse FMs 'PFL_COPY_OS_FILE'
    To Delete 'EPS_DELETE_FILE'.
    Don't forgot to reward if useful

  • 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

  • Problem during retriving file from application Server

    Hi all,
    i am trying to upload a world file (from desktop ) on application server and
    retrieve it back on local desktop.
    during retrieval of file from application server i am getting all the data in encoded format .
    i am using -
    open DATASET p_fpath for output in text mode encoding UTF-8 WITH SMART LINEFEED.
    plz help.

    Hi,
    use the tcodes CG3Y and
    CG3Z
    Or
    try with this command
    open DATASET p_fpath for output in text mode encoding default.
    Regards,
    nagaraj

  • Dynamically Reading Files From Application Server

    Hi Experts,
    Presently I have to write a program which reads files from the application server dynamically. This program will be scheduled in the background with the frequency of half an hour.
    I am Using the function module
    CALL FUNCTION 'SUBST_GET_FILE_LIST'
    EXPORTING
    DIRNAME = '/usr/sap/xxx/xxx/'
    FILENM = 'DATASET'
    PATTERN = '.txt'
    TABLES
    FILE_LIST = IT_FILELIST
    I am facing problem in specifying the parameter FILENM in the function module,
    As I have to read many files from the apps server. How to assign the parameter of function module so it can take the many files generated in the apps server.
    Thanks in Advance,
    Regards,
    Irfan Hussain

    Hi,
    Instead of the above FM, you can use the following code :
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR po_ifile.
    PERFORM get_current_directory  USING 'PO_IFILE'   po_ifile
                                              rov-home_dir rov-curr_dir.
        PERFORM get_filename-of-server TABLES itab_filename
                                           USING  rov-curr_dir rov-gen_name.
        PERFORM help_values_get_with_table_ext TABLES itab_filename
                                           USING  rov-curr_dir
                                                       po_ifile.
    *&      Form  get_current_directory
          text
         -->P_0023   text
         -->P_PO_IFILE  text
         -->P_ROV_HOME_DIR  text
         -->P_ROV_CURR_DI  text
         -->P_CALL  text
         -->P_FUNCTION  text
         -->P_0029   text
         -->P_IMPORTING  text
         -->P_FILE_NAME  text
         -->P_=  text
         -->P_PO_IFILE  text
      FORM get_current_directory  USING _fieldname
                                        _filename
                                        homedir
                                        currdir.
        IF _fieldname <> space.
          PERFORM dunp_value_read USING _fieldname _filename.
        ENDIF.
        IF _filename = space.
          currdir = homedir.
        ELSE.
          rov-work_dir = _filename.
          rov-fdpos = STRLEN( rov-work_dir ).
          DO.
            IF rov-fdpos = 0.
              EXIT.
            ENDIF.
            rov-fdpos = rov-fdpos - 1.
            ASSIGN rov-work_dir+rov-fdpos(1) TO <rov_p>.
            IF <rov_p> = rov-delchar.
              <rov_p> = space.
              EXIT.
            ELSE.
              <rov_p> = space.
            ENDIF.
          ENDDO.
          currdir = rov-work_dir.
        ENDIF.
      ENDFORM.                    " get_current_directory
    *&      Form  get_filename-of-server
          text
         -->P_ITAB_FILENAME  text
         -->P_ROV_CURR_DIR  text
         -->P_ROV_GEN_NAME  text
      FORM get_filename-of-server TABLES nametab STRUCTURE itabfilename
                                  USING  _dirname _genname.
        CALL 'C_DIR_READ_FINISH'             " just to be sure
                               ID 'ERRNO'  FIELD rov-errno
                               ID 'ERRMSG' FIELD rov-errmsg.
        CALL 'C_DIR_READ_START' ID 'DIR'    FIELD _dirname
                                ID 'FILE'   FIELD _genname
                                ID 'ERRNO'  FIELD rov-errno
                                ID 'ERRMSG' FIELD rov-errmsg.
        IF sy-subrc <> 0.
          EXIT.
        ENDIF.
        REFRESH _nametab.
        DO.
          CLEAR _nametab.
          CALL 'C_DIR_READ_NEXT'  ID 'TYPE'   FIELD _nametab-type
                                  ID 'NAME'   FIELD _nametab-name
                                  ID 'LEN'    FIELD _nametab-len
                                  ID 'OWNER'  FIELD _nametab-owner
                                  ID 'MTIME'  FIELD _nametab-mtime
                                  ID 'MODE'   FIELD _nametab-mode
                                  ID 'ERRNO'  FIELD _nametab-errno
                                  ID 'ERRMSG' FIELD _nametab-errmsg.
          _nametab-dirname = _dirname.
          MOVE sy-subrc TO _nametab-subrc.
          CASE sy-subrc.
            WHEN 0.
              IF _nametab-name+0(1) = '.'.
              ELSE.
                APPEND _nametab.
              ENDIF.
            WHEN 1.
              EXIT.
            WHEN OTHERS.                     " SY-SUBRC >= 2
              EXIT.
          ENDCASE.
        ENDDO.
        CALL 'C_DIR_READ_FINISH'             " just to be sure
                               ID 'ERRNO'  FIELD rov-errno
                               ID 'ERRMSG' FIELD rov-errmsg.
      ENDFORM.                    " get_filename-of-server
    *&      Form  help_values_get_with_table_ext
          text
         -->P_ITAB_FILENAME  text
         -->P_ROV_CURR_DIR  text
         -->P_PO_IFILE  text
      FORM help_values_get_with_table_ext  TABLES _filename
                                                 STRUCTURE itab_filename
                                          USING  _currdir
                                                _selfile.
        TYPES: BEGIN OF f4typ_head_struc,
                 tabname LIKE help_info-tabname,
                 fieldname LIKE help_info-fieldname,
                 head_text LIKE shstruc-keyword,
               END OF f4typ_head_struc.
       DATA itab_fields    LIKE TABLE OF help_value        WITH HEADER LINE.
       DATA itab_selvals   LIKE TABLE OF help_vtab         WITH HEADER LINE.
       DATA itab_values    LIKE TABLE OF rlgrap-filename   WITH HEADER LINE.
       DATA itab_header    TYPE TABLE OF f4typ_head_struc  WITH HEADER LINE.
        REFRESH itab_fields.
        REFRESH itab_selvals.
        REFRESH itab_values.
        REFRESH itab_header.
        itab_fields-tabname    = 'PS0192'.
        itab_fields-fieldname  = 'BAA01'.
        itab_fields-selectflag = ' '.
        APPEND itab_fields.
        itab_fields-tabname    = 'RLGRAP'.
        itab_fields-fieldname  = 'FILENAME'.
        itab_fields-selectflag = 'X'.
        APPEND itab_fields.
        LOOP AT _filename.
          itab_values = itab_filename-type.
          APPEND itab_values.
          itab_values = itab_filename-name.
          APPEND itab_values.
        ENDLOOP.
        CALL FUNCTION 'HELP_VALUES_GET_WITH_TABLE_EXT'
           EXPORTING
            CUCOL                         = 0
            CUROW                         = 0
            DISPLAY                       = ' '
            FIELDNAME                     = ' '
            TABNAME                       = ' '
            TITLE_IN_VALUES_LIST          = ' '
            SHOW_ALL_VALUES_AT_FIRST_TIME = ' '
            USE_USER_SHRINKING            = ' '
                titel                         = _currdir
            NO_SCROLL                     = ' '
            NO_CONVERSION                 = ' '
            NO_MARKING_OF_CHECKVALUE      = ' '
           IMPORTING
                index                         = rov-index
                select_value                  = rov-selvalue
             TABLES
                  fields                        = itab_fields
                  select_values                 = itab_selvals
                  valuetab                      = itab_values
            HEADING_TABLE                 =
             EXCEPTIONS
                  field_not_in_ddic             = 1
                  more_then_one_selectfield     = 2
                  no_selectfield                = 3
                  OTHERS                        = 4.
        IF sy-subrc = 0.
          CLEAR itab_filename.
          READ TABLE itab_filename INDEX rov-index.
          IF itab_filename-type+0(3) = 'dir'.
            CONCATENATE _currdir rov-delchar rov-selvalue  rov-delchar
                                                          INTO _selfile.
          ELSE.
            CONCATENATE _currdir rov-delchar rov-selvalue INTO _selfile.
          ENDIF.
        ENDIF.
      ENDFORM.                    " help_values_get_with_table_ext
    Best regards,
    Prashant

  • Unable to read file from application server

    Hi guys,
    I am reading file(could be any extension) from application server,but some time i am successfuly able to read file and sometime unable to read,why its happening .
    my code is here
    OPEN DATASET E_FILE FOR INPUT IN  BINARY MODE . "
      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.
    Thanks
    Ankur Sharma

    Hi,
    What actually happens?  Do you get a short dump?  Do you get a return code ne 0?  Does it run fine but you get no data in your table?
    We aren't mind-readers and can't help much without more information.
    Try using transaction AL11 to see if you access the files you are trying to open.
    Gareth.

  • Problem while uploading file from application server to internal tab in BG

    Hi all,
    When i see the file  in application server.data is like this
    #################00\);_(#####}#-#}###############################00\);_(#####}#-#}###############################00\);_(*#####}#-#}#########
    ###################}###}#############A#############???#00\);_(*#################;_(@_)  ########???#        ########???#        ########???###
    #######???#########}###}#############)##############}##00\);_(*#################;_(@_)  ############        ############        ##############
    ###################}#A#}#############:##############}##00\);_(#################;_(@_)  }###}##############################00\);_(*##########
    #######???#########}#-#}#############F#################00\);_(#####}###}#############@#################00\);_(#################;_(@_)  #####
    ###################}#-#}#############3#################00\);_(#####}#U#}#############E#################00\);_(#################;_(@_)  #####
    Because the csv which is uploaded has dropdowns and some formattings.
    when download from tcode cg3y i am getting correct file
    When try to use open(binary mode) and read dataset i getting data as it is (junk).
    i need to process in background.
    Any help.
    Rhea.

    upload file to string format
    begin of ty_tab,
    string type char200,
    end of ty_tab.
    loop at ty_tab into string
    use statement replace string into tab deliminated fromat(particular occurance in string)
    now call class to break string at tab into fields
    endloop.
    DATA : BEGIN OF i_data OCCURS 0,
            data(200)    TYPE c,       "To hold Upload file data
           END OF i_data.
    OPEN DATASET v_str FOR INPUT
                              IN TEXT MODE
                              ENCODING DEFAULT IGNORING CONVERSION ERRORS.
        IF sy-subrc EQ 0.
          DO.
    *Read a line from input file
            READ DATASET v_str INTO i_data-data.
            IF sy-subrc NE 0.
              EXIT.
            ENDIF.
    *Append record to an internal table
            APPEND i_data.
            CLEAR: i_data.
          ENDDO.
    *Close the file
          CLOSE DATASET v_str.
    *---Start of inserti
    LOOP AT i_data.
            REPLACE ALL OCCURRENCES OF '"' IN i_data WITH '#'.
            SPLIT i_data AT cl_abap_char_utilities=>horizontal_tab
                                INTO i_doc-pvaudt
                                     i_doc-pvpate
                                     i_doc-vecatc
                                     i_doc-vhvend
                                     i_doc-vhidt8
                                     i_doc-vhinvn
                                     i_doc-vhhexp
                                     i_doc-vhiref.

  • Problem to read data from application server.

    read dataset reads data only up tp 255 char.
    her i want to read more data .
    and i am executing that in background so i can not use gui_upload then what is the solution.

    Read datasets should be able to read any length. Are you sure it is not your program that is truncating it?
    GUI_UPLOAD is a FM to read files from the presentation server  (your PC), at the end, it performs READ DATASET anyways.
    Please provide code example.
    Leonardo De Araujo

  • Problem in Downloading File from Application Server

    Hi All,
    We have an Requirement that, iam putting the Flat File
    ( Output Of a Report ) in to the
    Application Server(AL11) By using the OpendataSet, Transer , Close DataSet.
    When iam trying to Downloading the Flat File through the FM, GUI_DOWNLOAD, the Data is coming Correctly.
    But the Problem is , when trying to Downloading through AL11 i.e System -> List -> Local File  it is not coming Correctly.
    ( Java People is going to Connect with the Application Server for the Flat File )
    Kindly Clarify the Problem.
    Points will be Rewarded.
    Regards,
    Kiran.I

    Hi nl,
    1. this program will display
       selection screen
      and ask two things :
    a) application server filename
    b) local file name
    2. then it will download the file
    (the file name is CASE Sensitivie)
    3.  just try it (just copy paste )
    *& Report  YBCR_FILEDOWNLOAD                                           *
    REPORT  ybcr_filedownload                       .
    DATA
    DATA : file_name TYPE string.
    DATA : BEGIN OF itab OCCURS 0,
           ln(255) TYPE c,
           END OF itab.
    SCREEN
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    PARAMETERS : appfn(150) TYPE c LOWER CASE OBLIGATORY.
    PARAMETERS : p_file LIKE rlgrap-filename OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK b1.
    AT SELECTION SCREEN
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
      CLEAR p_file.
      CALL FUNCTION 'F4_FILENAME'
        IMPORTING
          file_name = p_file.
      file_name = p_file.
    START-OF-SELECTION
    START-OF-SELECTION.
      OPEN DATASET appfn FOR INPUT IN TEXT MODE  ENCODING DEFAULT .
      IF sy-subrc <> 0.
        MESSAGE s999(yhr) WITH 'COULD NOT OPEN FILE ON APP SERVER'.
        LEAVE LIST-PROCESSING.
      ENDIF.
      DO.
        READ DATASET appfn INTO itab.
        IF sy-subrc = 0.
          APPEND itab.
        ELSE.
          EXIT.
        ENDIF.
      ENDDO.
      file_name = p_file.
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
      BIN_FILESIZE                    =
          filename                        = file_name
      FILETYPE                        = 'ASC'
      APPEND                          = ' '
      WRITE_FIELD_SEPARATOR           = ' '
      HEADER                          = '00'
      TRUNC_TRAILING_BLANKS           = ' '
      WRITE_LF                        = 'X'
      COL_SELECT                      = ' '
      COL_SELECT_MASK                 = ' '
      DAT_MODE                        = ' '
      CONFIRM_OVERWRITE               = ' '
      NO_AUTH_CHECK                   = ' '
      CODEPAGE                        = ' '
      IGNORE_CERR                     = ABAP_TRUE
      REPLACEMENT                     = '#'
      WRITE_BOM                       = ' '
      TRUNC_TRAILING_BLANKS_EOL       = 'X'
      WK1_N_FORMAT                    = ' '
      WK1_N_SIZE                      = ' '
      WK1_T_FORMAT                    = ' '
      WK1_T_SIZE                      = ' '
    IMPORTING
      FILELENGTH                      =
        TABLES
          data_tab                        = itab
      FIELDNAMES                      =
    EXCEPTIONS
      FILE_WRITE_ERROR                = 1
      NO_BATCH                        = 2
      GUI_REFUSE_FILETRANSFER         = 3
      INVALID_TYPE                    = 4
      NO_AUTHORITY                    = 5
      UNKNOWN_ERROR                   = 6
      HEADER_NOT_ALLOWED              = 7
      SEPARATOR_NOT_ALLOWED           = 8
      FILESIZE_NOT_ALLOWED            = 9
      HEADER_TOO_LONG                 = 10
      DP_ERROR_CREATE                 = 11
      DP_ERROR_SEND                   = 12
      DP_ERROR_WRITE                  = 13
      UNKNOWN_DP_ERROR                = 14
      ACCESS_DENIED                   = 15
      DP_OUT_OF_MEMORY                = 16
      DISK_FULL                       = 17
      DP_TIMEOUT                      = 18
      FILE_NOT_FOUND                  = 19
      DATAPROVIDER_EXCEPTION          = 20
      CONTROL_FLUSH_ERROR             = 21
      OTHERS                          = 22
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    regards,
    amit m.

  • # 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>

  • 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

  • How to transfer file from application server to presentation server in background?

    Hi Experts,
    How to transfer file from application server to presentation server in background?
    Thanks in advance
    Namita

    Thanks Raman and Challa,
    We want to move file from application server to Shared folder, not on local machine. We checked FM which you guys have provided but those are not able to read file from application server.
    We need this program to run in background so that we can use this in daily process chain.
    Appreciate your inputs on this.
    Thanks,
    Namita

  • How to display a file from Application server without downloading it to local drive

    I want to dispaly a file from Application server without downloading it to my local system.
    i tried the below method but it didn't work.
         CALL METHOD CL_GUI_FRONTEND_SERVICES=>EXECUTE
          EXPORTING
            APPLICATION            = L_FILE
            DEFAULT_DIRECTORY      = L_DIR

    Hi,
    Use open dataset to read file from application server.
    try like this sample code:
    data : p_file like ibipparms-path.
    data : rec(350) type c.
    data:  g_delimiter(1) type c value ','.
    maintain the file path in p_file. then
    open dataset p_file for input in text mode encoding default.
       IF SY-SUBRC = 0.
    do n times.
    READ dataset p_file into rec.
    split rec at g_delimiter into your internal table fields like it-id it-name it-age.
    append it.
    clear it.
    enddo.
    close dataset p_file.
    Now you have the data in internal table it.

  • File from application server -Read and process and delete the file .

    Hi All,
             I writing a ZEE program which will read the file from application server(file will be in text delimat format) and moving the data to internal table and uploadind data base.The part which iam facing problem is -
    > I hve read the file from application server like below ,
    OPEN DATASET ld_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.
    IF sy-subrc NE 0.
    EXIT.
    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.
    Spliting part i having problem .i need to seperate each field which is seperate from tab delimite and pass it into respective fields of internal table .
    Second if another file come to the appicaltion server , wether my first file will be there ? or should i need to delete the first file after redaing how should i proceed further ?.
    Regards
    SRIRAM...
    THANKS In ADVANCE

    HI,
    1.
    OPEN DATASET ld_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.
    IF sy-subrc NE 0.
    EXIT.
    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 cl_abap_char_utilities=>horizontal_tab INTO wa_uploadtxt-name1
    wa_uploadtxt-name2
    wa_uploadtxt-age.
    APPEND  wa_uploadtxt TO itab.
    ENDDO.
    CLOSE DATASET ld_file.
    ENDIF.
    2. If the another file get's generated in the application server with same file name then the data in old file get's over written with the new data. You are not required to delete the file.

Maybe you are looking for