Split tab delimited file coming from application server.

Hi,
i have received a tab delimited file from the application server.it contains # instead of tab at the application server.
i want to know how to split it.
i tried decalring constant as:
c_tab type x value'09'.
but it gives an error saying only c,n,d and t types are allowed.
please gelp.
Thanks,
Anand.

Hi,
Do like this
*--Local Variables
  DATA : l_file TYPE string,
         l_line TYPE string.
*--Clear
  CLEAR : l_file.
  l_file = p_ipfile.
*--Read the data from application server file.
  OPEN DATASET l_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.
  IF sy-subrc NE 0.
*--Error in opening file
    MESSAGE i368(00) WITH text-005.
  ENDIF.
*--Get all the records from the specified location.
  DO.
    READ DATASET l_file INTO l_line.
    IF sy-subrc NE 0.
      EXIT.
    ELSE.
      SPLIT l_line AT cl_abap_char_utilities=>horizontal_tab
                      INTO st_ipfile-vbeln
                           st_ipfile-posnr
                           st_ipfile-edatu
                           st_ipfile-wmeng.
      APPEND st_ipfile TO it_ipfile.
    ENDIF.
  ENDDO.
*--Close dataset
  CLOSE DATASET l_file.
Regards,
Prashant

Similar Messages

  • Splitting tab delimited file?

    how to split a tab delimited file?

    Hi,
    Do like this
    *--Local Variables
      DATA : l_file       TYPE string,
             l_line(1000) TYPE c.
    *--Clear
      CLEAR : l_file.
      l_file = p_aifile.
    *--Read the data from application server file.
      OPEN DATASET l_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.
      IF sy-subrc NE c_ok.
        MESSAGE i368(00) WITH text-014.
      ENDIF.
    *--Get all the records from the specified location.
      DO.
        READ DATASET l_file INTO l_line.
        IF sy-subrc NE c_ok.
          EXIT.
        ELSE.
          SPLIT l_line AT cl_abap_char_utilities=>horizontal_tab
                          INTO st_ipfile-anlkl
                               st_ipfile-txt50
                               st_ipfile-txa50
                               st_ipfile-anlhtx
                               st_ipfile-sernr
                               st_ipfile-invnr
                               st_ipfile-aktiv
                               st_ipfile-invzu
                               st_ipfile-kostl
                               st_ipfile-raumn
                               st_ipfile-ord41
                               st_ipfile-gdlgrp
                               st_ipfile-herst
                               st_ipfile-typbz
                               st_ipfile-afabe
                               st_ipfile-afasl
                               st_ipfile-ndjar
                               st_ipfile-ndper
                               st_ipfile-tafabe
                               st_ipfile-tafasl
                               st_ipfile-tndjar
                               st_ipfile-tndper
                               st_ipfile-anbtr01
                               st_ipfile-anbtr02
                               st_ipfile-anbtr03
                               st_ipfile-anbtr04.
          APPEND st_ipfile TO it_ipfile.
        ENDIF.
      ENDDO.
    *--Close dataset
      CLOSE DATASET l_file.
    Regards,
    Prashant
    Edited by: Prashant Patil on Mar 5, 2008 4:11 PM

  • File download from application server to presentation server

    Hi,
         We have requirment to upload a file to application server in .dbf format and then download it to presentation server.  while downloading the file to presentation server some of the fields  getting junk values.  we are downloading file to excel sheet.  some of the fields values are Russian texts.  Those fields only getting junk values, all other fields are getting correct values.
    Please advice.
    Regards,
    chandra.

    hi
    sample code below should help you......
    <u>Download to presentation server</u>
    This program can be used to download files from Application server to presentaion server.
    1)Maximum length of each field is considered to be 40 characters.
    2)Maximum length of the field can be changed by specifying the length in selection screen parameter
    3)First line of the Application server file should contain the description of each field.
    4)Each field should be delimited by #.
    *& Report ZDOWNLOADFILE *
    REPORT ZDOWNLOADFILE
    MESSAGE-ID B1 .
    INCLUDES *
    INCLUDE ZDOWNLOADFILE_TOP.
    INCLUDE ZDOWNLOADFILE_FORM.
    EVENT-AT SELECTION-SCREEN *
    AT SELECTION-SCREEN ON pa_appl.
    PERFORM check_file_exists USING pa_appl.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR pa_appl.
    PERFORM f4_dxfilename USING pa_appl.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR pa_pres.
    PERFORM f4_filename USING pa_pres.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR pa_del.
    PERFORM f4_dxfilename USING pa_del.
    EVENT INITIALIZATION *
    INITIALIZATION.
    PERFORM initialization.
    EVENT START-OF-SELECTION *
    START-OF-SELECTION.
    PERFORM determine_fields. "Determine number of columns
    PERFORM build_itab. "Create internal table based on number
    "of columns
    PERFORM build_header. "To prepare header for the file
    PERFORM download_data. "Download data to presentation server
    PERFORM delete_files. "Delete files from application server
    *& Include ZDOWNLOADFILE_TOP *
    TYPES: BEGIN OF ty_header,
    text(100) TYPE c,
    END OF ty_header.
    DATA: c_fnh_mask type dxfields-filemask value '.',
    search_dir type dxfields-longpath value '/sapglobal/users'.
    CLASS cl_abap_char_utilities DEFINITION LOAD.
    Internal tables *
    DATA: gt_header TYPE STANDARD TABLE OF ty_header,
    gt_fieldcat TYPE lvc_t_fcat.
    Work areas *
    DATA: gs_header TYPE ty_header,
    gs_fieldcat TYPE lvc_s_fcat.
    DATA: wa_filename TYPE string.
    DATA: wa_count(2) TYPE N,
    wa_start(3) TYPE N,
    wa_end(3) TYPE N,
    wa_len(3) TYPE N.
    DATA: wa_data(12000) TYPE c,
    wa_off TYPE I,
    itab_appl TYPE REF TO DATA,
    itab_line TYPE REF TO DATA,
    col(2) TYPE c.
    DATA: wa_field(30) TYPE c.
    DATA: lv_index TYPE sy-tabix.
    DATA: gs_adrp type adrp,
    gs_usr02 type usr02,
    gs_usr21 type usr21,
    gs_char50(50).
    CONSTANTS: co_slash(1) value '/'.
    FIELD-SYMBOLS: <itab> TYPE STANDARD TABLE,
    <wa>,
    <fs_line>,
    <wa_line>.
    SELECTION SCREEN *
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE text-f01.
    PARAMETERS: pa_appl LIKE rlgrap-filename OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK B1.
    SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE text-f02.
    PARAMETERS: pa_pres LIKE rlgrap-filename OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK B2.
    SELECTION-SCREEN BEGIN OF BLOCK B3 WITH FRAME TITLE text-f03.
    PARAMETERS: pa_del LIKE rlgrap-filename .
    PARAMETERS: pa_deld AS CHECKBOX.
    SELECTION-SCREEN END OF BLOCK B3.
    SELECTION-SCREEN BEGIN OF BLOCK B4 WITH FRAME TITLE text-f04.
    PARAMETERS: pa_len(3) TYPE c.
    SELECTION-SCREEN END OF BLOCK B4.
    *& Include ZDOWNLOADFILE_FORM *
    *& Form f4_dxfilename
    text
    -->P_pa_appl text
    form f4_dxfilename using p_file.
    DATA: wa_file LIKE dxfields-longpath.
    CLEAR: wa_file.
    call function 'F4_DXFILENAME_TOPRECURSION'
    exporting
    i_location_flag = 'A'
    i_server = ' '
    i_path = search_dir
    filemask = c_fnh_mask
    fileoperation = 'R'
    importing
    o_path = wa_file
    exceptions
    rfc_error = 1
    error_with_gui = 2
    others = 3
    if sy-subrc <> 0.
    message id sy-msgid type sy-msgty number sy-msgno
    with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    else.
    p_file = wa_file.
    endif.
    endform. " f4_dxfilename
    *& Form f4_filename
    text
    -->P_pa_pres text
    form f4_filename using p_data.
    CALL FUNCTION 'F4_FILENAME'
    EXPORTING
    PROGRAM_NAME = SYST-CPROG
    DYNPRO_NUMBER = SYST-DYNNR
    IMPORTING
    FILE_NAME = p_data
    endform. " f4_filename
    *& Form check_file_exists
    text
    -->P_pa_appl text
    form check_file_exists using p_file.
    DATA: wa_file LIKE rlgrap-filename.
    wa_file = p_file.
    OPEN DATASET wa_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.
    IF sy-subrc = 8.
    MESSAGE E714
    WITH text-m01 p_file text-m02.
    ELSE.
    CLOSE DATASET p_file.
    ENDIF.
    endform. " check_file_exists
    *& Form build_header
    text
    --> p1 text
    <-- p2 text
    form build_header .
    *Select user details
    clear gs_usr21-persnumber.
    select single persnumber
    into (gs_usr21-persnumber)
    from usr21
    where bname = sy-uname.
    concatenate sy-uname
    co_slash
    gs_adrp-name_text(36)
    co_slash
    into gs_char50.
    condense gs_char50.
    clear gs_usr02-class.
    select single class
    into (gs_usr02-class)
    from usr02
    where bname = sy-uname.
    concatenate gs_char50
    gs_usr02-class
    into gs_char50.
    condense gs_char50.
    Write report technical name
    write 'Name: ' TO gs_header+0(10).
    gs_header+11(*) = sy-repid.
    APPEND gs_header TO gt_header.
    CLEAR: gs_header.
    Write user data
    write 'User: ' TO gs_header+0(10).
    gs_header+11(*) = gs_char50.
    CONCATENATE gs_header gs_char50 INTO
    gs_header SEPARATED BY SPACE.
    APPEND gs_header TO gt_header.
    CLEAR: gs_header.
    Write System data
    write 'System: ' TO gs_header+0(10).
    write: sy-sysid to gs_header+11(3).
    write: co_slash to gs_header+14(1).
    write: sy-mandt to gs_header+15(3).
    APPEND gs_header TO gt_header.
    CLEAR: gs_header.
    Write System date and time
    write 'System: ' TO gs_header+0(10).
    write sy-datum to gs_header+11(10).
    write sy-uzeit to gs_header+22(8).
    APPEND gs_header TO gt_header.
    CLEAR: gs_header.
    Write Local date and time
    write 'Local: ' TO gs_header+0(10).
    write sy-datlo to gs_header+11(10).
    write sy-timlo to gs_header+22(8).
    APPEND gs_header TO gt_header.
    CLEAR: gs_header.
    APPEND gs_header TO gt_header.
    endform. " build_header
    *& Form determine_fields
    text
    --> p1 text
    <-- p2 text
    form determine_fields .
    DATA: wa_data(600) TYPE c.
    CLEAR: wa_count,wa_start,wa_end,wa_data.
    wa_start = 0.
    wa_end = 1.
    OPEN DATASET pa_appl FOR INPUT IN TEXT MODE ENCODING DEFAULT.
    READ DATASET pa_appl INTO wa_data.
    wa_len = STRLEN( wa_data ).
    DO wa_len TIMES.
    IF wa_data+wa_start(wa_end) EQ
    cl_abap_char_utilities=>horizontal_tab.
    wa_count = wa_count + 1.
    ENDIF.
    wa_start = wa_start + 1.
    ENDDO.
    CLOSE DATASET pa_appl.
    wa_count = wa_count + 1.
    endform. " determine_fields
    *& Form build_itab
    text
    --> p1 text
    <-- p2 text
    form build_itab .
    DATA: wa_len(4) TYPE c.
    CLEAR: wa_len.
    IF pa_len IS INITIAL.
    wa_len = 40.
    ELSE.
    wa_len = pa_len.
    ENDIF.
    col = 1.
    DO wa_count TIMES.
    CONCATENATE 'FIELD' col INTO wa_field.
    gs_fieldcat-fieldname = wa_field.
    gs_fieldcat-outputlen = wa_len.
    gs_fieldcat-datatype = 'CHAR'.
    gs_fieldcat-col_pos = col.
    col = col + 1.
    APPEND gs_fieldcat TO gt_fieldcat.
    CLEAR: wa_field.
    ENDDO.
    *Create the internal table dynamically based on the file structure,
    *this table will be used to download data through GUI_DOWNLOAD fm
    CALL METHOD cl_alv_table_create=>create_dynamic_table
    EXPORTING
    it_fieldcatalog = gt_fieldcat
    IMPORTING
    EP_TABLE = itab_appl
    *Assign the pointer to the field symbol
    ASSIGN itab_appl->* TO <itab>.
    CREATE DATA itab_line LIKE LINE OF <itab>.
    *Create a work area for the dynamic internal table
    ASSIGN itab_line->* TO <wa_line>.
    col = 1.
    OPEN DATASET pa_appl FOR INPUT IN TEXT MODE ENCODING DEFAULT.
    DO.
    READ DATASET pa_appl INTO wa_data.
    IF sy-subrc <> 0.
    CLOSE DATASET pa_appl.
    RETURN.
    ELSE.
    wa_start = 0.
    lv_index = 1.
    DO wa_count TIMES.
    ASSIGN COMPONENT lv_index OF STRUCTURE <wa_line> TO <fs_line>.
    FIND cl_abap_char_utilities=>horizontal_tab
    IN wa_data+wa_start(*) MATCH OFFSET wa_off.
    IF sy-subrc = 0.
    IF wa_off NE 0.
    <fs_line> = wa_data+wa_start(wa_off).
    ENDIF.
    wa_start = wa_start + wa_off + 1.
    lv_index = lv_index + 1.
    ELSE.
    <fs_line> = wa_data+wa_start(*).
    ENDIF.
    ENDDO.
    APPEND <wa_line> TO <itab>.
    CLEAR: <wa_line>,<fs_line>.
    ENDIF.
    ENDDO.
    endform. " build_itab
    *& Form download_data
    text
    --> p1 text
    <-- p2 text
    form download_data .
    clear: wa_filename.
    wa_filename = pa_pres.
    call function 'GUI_DOWNLOAD'
    exporting
    filename = wa_filename
    filetype = 'DAT'
    tables
    data_tab = gt_header
    exceptions
    access_denied = 15
    call function 'GUI_DOWNLOAD'
    exporting
    filename = wa_filename
    filetype = 'DAT'
    append = 'X'
    tables
    data_tab = <itab>
    exceptions
    access_denied = 15
    endform. " download_data
    *& Form initialization
    text
    --> p1 text
    <-- p2 text
    form initialization .
    REFRESH: gt_header,gt_fieldcat,gt_header.
    endform. " initialization
    *& Form delete_files
    text
    --> p1 text
    <-- p2 text
    form delete_files .
    IF pa_deld EQ 'X'.
    DELETE DATASET pa_appl.
    ENDIF.
    IF pa_del IS NOT INITIAL.
    DELETE DATASET pa_del.
    ENDIF.
    endform. " delete_files
    <b>reward points if helpful.</b>
    thanks
    vijay

  • Split tab delimited file

    Hiall,
    I filled an internal table with the data from a tab delimited file (trought the FM FTP_TOR3).
    All my date is in the internal table, but I want to split it now. I tried with the '#' (as ALT + 3), but he doesn 't split the line.
    I'm on 4.6, so I cannot use the horizontal_tab as splitter

    While I was searching on this forum on unicode-characters (had a feeling it was something like this), I found  a post with practicly the same problem (but with a somewhat bizarre title ), there they told me to use this :
    data : c_tab type x value '09'.
    as splitter. Apparently, it has something to do with Unix unicode, and the windows # differs from the Unix #.
    Problem solved, thanks for the help
    (awarded you 10 points for the help )
    kr
    Björn

  • Class to Get File List from Application Server

    Hi all
    I've to obtain the file list of a directory from application server, I can use a FM too but It's possible the lenght of file name is upper then 40 characters so I can't use FM EPS_GET_DIRECTORY_LISTING.
    Thanks
    Edited by: Aristoteles92 on Apr 20, 2010 3:27 PM

    Try using the function  RZL_READ_DIR_LOCAL.  Here is an example program using this function.
    data: begin of itab occurs 0,
          rec(1000) type c,
          end of itab.
    data: wa(1000) type c.
    data: p_file type localfile.
    data: ifile type table of  salfldir with header line.
    parameters: p_path type salfile-longname
                        default '/usr/sap/TST/DVEBMGS01/data/'.
    call function 'RZL_READ_DIR_LOCAL'
         exporting
              name           = p_path
         tables
              file_tbl       = ifile
         exceptions
              argument_error = 1
              not_found      = 2
              others         = 3.
    loop at ifile.
      format hotspot on.
      write:/ ifile-name.
      hide ifile-name.
      format hotspot off.
    endloop.
    at line-selection.
      concatenate p_path ifile-name into p_file.
      clear itab.  refresh itab.
      open dataset p_file for input in text mode.
      if sy-subrc = 0.
        do.
          read dataset p_file into wa.
          if sy-subrc <> 0.
            exit.
          endif.
          itab-rec = wa.
          append itab.
        enddo.
      endif.
      close dataset p_file.
      loop at itab.
        write:/ itab.
      endloop.
    Regards,
    Rich Heilman

  • Delete file data from Application Server

    Hello,
    How do we delete data from the file on application Server.
    For deleting the file, we use DELETE DATASET <filename>.
    If we want to delete only the data and not the file, how to address it?
    Please let me know.

    Hi , please check the following links, maybe using the truncate dataset can be helpful.
    http://help.sap.com/saphelp_nw70/helpdata/EN/fc/eb3c7f358411d1829f0000e829fbfe/frameset.htm
    http://help.sap.com/saphelp_nw70/helpdata/EN/d5/c3f58e9f3b11d2960000a0c9308b1f/frameset.htm
    Another way could be get the file name and store in a var , then delete the file and afterwards
    create a new one with the same name as stored in the var.
    Thanks,
    Walter Oliveira.

  • Excel File downloaded from application server is also opening in notepad

    Hi Friends,
    While downlaoding an excel file from the application server,we are able to open in notepad also.But this does not conatin the excel properties and hence happening.File should only oopen with excel and no other file type
    Can any open help on this
        ld_file =  '/usr/sap/trans/abap/HR_DATA.xls'.
        OPEN DATASET ld_file FOR OUTPUT in text mode ENCODING DEFAULT .
        IF sy-subrc = 0.
          LOOP AT int_final.
            CLEAR wa_string.
            CONCATENATE int_final-employee_sno int_final-employee_code INTO wa_string SEPARATED BY con_tab.
            CONCATENATE wa_string int_final-first_name         INTO wa_string SEPARATED BY con_tab.
    please help...
    Edited by: Neliea on Oct 29, 2009 1:11 PM

    Hi,
    Please refer to these links.
    [url]Re: Internal table to excel download?;url]
    [url]Re: Transfer from Internal Table to EXCEL file...;url]
    Regards,
    Aditya

  • Logic to fetch the file name from Application Server

    Hi Friends
    I have a requirement that : By giving the Directory name (eg:/tmp),I have to get the all file names stored under that Directory name.
    Can anyone please provide me the logic / function modules related to this requirement.
    Points are assured for useful answers.
    Regards,
    Sree

    Hi,
    use these:
    function module "EPS_GET_DIRECTORY_LISTING"
    FM RZL_DIR_READ instead. its easy and effective to use.
    Or
    FILE_GET_NAME_USING_PATH,
    EPS_GET_DIRECTORY_LISTING
    /SAPDMC/LSM_F4_FRONTEND_FILE
    OPEN DATASET <Path / filename> FOR INPUT IN TEXT MODE...
    if sy-subrc eq 8, then the file does not exist on the application server.
    Reward Points if found helpfull..
    Cheers,
    Chandra Sekhar.

  • Dynamic selection of file in infopackage from application server

    Hi,
    We have a infopackage in Process chain which runs daily. In the infopackage 'EXTRACTION' tab , input file is from application server. The file we get daily is not unique.
    As an example file name is not like 'UNIQUE.CSV' . It varies daily and carries a date and time stamp like UNIQUE_DATE_TIME.CSV
    I think we can have a routine to handle this. can someone help me with the routine/code?
    Thank you all.

    Hi,
    1. Create Two Floders in AL11 i.e. in Apllication Server. Eg Name it F1 and F2.
    2. First dump the .csv files into Folder F1 using some Programs or Manualy (Name xyz.csv).
    3. Then load the data using InfoPackage (here IN infoPackage, Extraction Tab you need to select Adapter = Load Text File from Application Server and then give the correct path from Folder F1), through PC.
    4. At the end of the load, attach a simple Program to Move the xyz.csv file from Folder F1 to Folder F2.
    5. So next day the file will come to Folder F1 and the it will loaded to Cube/DSO and at the end it will move to Folder F2.
    Else you can use simple one or two lines of UNIX/WINDOWS (depends on your OS) script to move the file from Folder F1 to Folder F2 , once you load is over.
    While moving the file from Folder F1 to Folder F2 you can append the date at the end of the file and then move to Folder F2, it is use full for future reference.
    See Blogs and Article, similar logic...
    https://wiki.sdn.sap.com/wiki/display/profile/Surendra+Reddy
    How to transfer the Data from SAP-System to Non-SAP system without additional Cost/License
    /people/surendrakumarreddy.koduru/blog/2009/03/11/how-to-transfer-the-data-from-sap-system-to-non-sap-system-without-additional-costlicense
    To Check the Files/Reports in Application Server and Trigger Mail Alerts.
    http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/4096bf2d-bcea-2b10-4ab4-e0683830d9b2&overridelayout=true
    1. Create Three Floders in AL11 i.e. in Apllication Server. Eg Name it F1, F2 and F3.
    2. First dump the .csv files into F1. (Name xyz.csv).
    3. Then using UNIX/WINDOWS (depends on your OS) script , first check the file is there are not in F1, if yes then rename the file with date and time or date and transfer the files from F1 to F2 i.e xyz06032010.csv.
    4. Then Create a small ABAP program to check the file in F2, if it is there then Trigger the Event, and using that event you execute teh PC.
    5. Then using UNIX/WINDOWS (depends on your OS) script , transfer the files from F2 to F3 i.e xyz06032010.csv.
    6. Next day morning F1 and F2 are empty and F3 is having the backup files.
    So use this method, I used the similar logic and it is working fine.
    Timinings are importent i.e what time you need to dump the fule in F1 and what time you need to run UNIX/WINDOWS (depends on your OS) script , transfer the files from F1 to F2 and what time UNIX/WINDOWS (depends on your OS) script , transfer the files from F2 to F3.
    Thanks
    Reddy

  • 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

  • Download file from application server to internal table in background

    hi all,
    i want to download a file from appliaction server into my internal table but in background.
    i had tryed CG3Z and CG3Y t-code but screen that is coming is asking for the parameters, and i want that screen should not appear and file should be saved in the predefined path by me.
    if there any way to do so,
    Points will be rewarded as per the Aswers.
    thaks in advance.

    Hi Sudeep,
       Use this code to get file data from application server.
    REPORT  ZE0232_BDC_APPLSERVER.
    DATA: FILE_PATH TYPE STRING.
    FILE_PATH = 'c:\bdc_mat.prn'.
    DATA: BEGIN OF ITAB OCCURS 0,
                END OF ITAB.
    OPEN DATASET FILE_PATH FOR INPUT IN TEXT MODE ENCODING DEFAULT.
      IF SY-SUBRC = 0.
    DO.
    READ DATASET FILE_PATH INTO ITAB.
    IF ITAB-RESNO NE SPACE.
       APPEND ITAB.
    ELSE.
    EXIT.
    ENDIF.
    ENDDO.
    ENDIF.
    CLOSE DATASET FILE_PATH.
    LOOP AT ITAB.
    WRITE:/ ITAB.
    ENDLOOP.
    FILE PATH IS  application server path.
    IF USEFULL REWARD

  • 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

  • How to delete file from application server(Unix)

    Hi All,
    Using the below code downloading a file from application server(Unix) to client machine. I want to delete the file from application server once it is downloaded to client
    We work on Forms 11.1.1.4.0 and Oracle DB 10g. Client machine are Windows 7.
    BEGIN
      IF webutil_file_transfer.AS_to_Client
      (clientFile => Name_In('global.g_file_name')
      ,serverFile => ls_AppServer_Loc)THEN
      message('Data exported Successfully');
      ELSE
       message('File download from Application Server failed');
      END IF;
    EXCEPTION
      WHEN OTHERS THEN
      message('File download failed: '||SUBSTR(sqlerrm,1,200));
      END;
    I have search for solution on OTN. Few suggested to use HOST.
    Can any one help me how to use Host() built_in to delete the file.
    Thanks,
    Maddy

    Can any one help me how to use Host() built_in to delete the file.
    Host('/bin/rm <complete file path>');

  • How to upload a file from application server?

    Hi experts,
    I am going to create a conversion program using call function 'HR_INFOTYPE_OPERATION'.In my conversion I am going to upload per_area,emp_subgroup,payroll_area,work contract and orgn_key for the infotype IT0001 and the input file is from application server.I am using check boxes for these 5 fields and  for the fields I am selecting the checkbox.I want to upload the datas in the IT0001 using HR_INFOTYPE_OPERATION.That is using the call transaction function.Its urgent give me some ideas or codings for that infotype updating.
    Thanks,
    Sakthi.C

    Hi
    you can use <b>open dataset for input</b>,<b>Read dataset</b> for uploading data from a application server.
    Message was edited by:
            Raghu Reddy

  • 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

Maybe you are looking for