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.

Similar Messages

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

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

  • 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

  • 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

  • Move file to application server  or delete a file from application server

    Hi all
    I have one application in which if succeful uploading  of BMP file  from application server is not  done , File has to move to another folder like 'ERROR' Folder
    but i am unable to do that.
    here is the code:
    CONDENSE g_t_ws_move.
    CALL 'SYSTEM' ID 'COMMAND' FIELD g_t_ws_move
      ID 'TAB'     FIELD g_t_ws_command_line[].
    where
    <b>G_T_WS_MOVE= 'MOVE /Y /sapin/XVZ/journeyplan/0000000.BMP /tmp/0000000.BMP'
    means  i have to move 000000.bmp file from XVZ to tmp directory ,</b>

    Hello Neetu
    Alternatively you could use a combination of the following function modules:
    - EPS_FTP_PUT
    - EPS_DELETE_FILE
    Regards
      Uwe

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

  • What are the commands available to read a file from application server and

    What are the commands available to read a file from application server and store the file into an internal table?

    Hi,
    To read a file from an Application Server to an Object there is a command in ABAP called <b>READ DATASET</b>. After that file is transported to that object you have to do a loop and put that data in an Internal Table.
    This statement exports data from the file specified in dset into the data object dobj. For dobj, variables with elementary data types and flat structures can be specified. In Unicode programs, dobj must be character-type if the file was opened as a text file.
    For dset, a character-type data object is expected - that is, an object that contains the platform-specific name of the file. The content is read from the file starting from the current file pointer. After the data transfer, the file pointer is positioned after the section that was read. Using the MAXIMUM LENGTH addition, the number of characters or bytes to be read from the file can be limited. Using ACTUAL LENGTH, the number of characters or bytes actually used can be determined.
    In a Unicode program, the file must be opened with an arbitrary access type; otherwise, an exception that cannot be handled will be triggered.
    If the file has not yet been opened in anon-Unicode program, it will be implicitly opened as a binary file for read access using the statement
    OPEN DATASET dset FOR INPUT IN BINARY MODE.
    . If a non-existing file is accessed, an exception that can be handled can be triggered.
    Influence of Access Type
    Files can be read independently of the access type. Whether data can be read or not depends solely on the position of the file pointer. If the latter is at the end of the file or after the file, no data can be read and sy-subrc will be set to 4.
    Influence of the Storage Type
    The import function will take place irrespective of the storage type in which the file was opened with the statement OPEN DATASET.
    If the file was opened as a text file or as a legacy text file, the data is normally read from the current position of the file pointer to the next end-of-line marking, and the file pointer is positioned after the end-of-line marking. If the data object dobj is too short for the number of read characters, the superfluous characters and bytes are cut off. If it is longer, it will be filled with blanks to the right.
    If the file was opened as a binary file or as a legacy-binary file, as much data is read that fits into the data object dobj. If the data object dobj is longer than the number of exported characters, it is filled with hexadecimal 0 on the right.
    If the specified storage type makes conversion necessary, this is executed before the assignment to the data object dobj. Afterwards, the read data is placed, byte by byte, into the data object.
    System Fields
    sy-subrc Meaning
    0 Data was read without reaching end of file.
    4 Data was read and the end of the file was reached or there was an attempt to read after the end of the file.
    Thanks,
    Samantak.
    <b>Rewards points for useful answers.</b>

  • Reading XML file from application server and  put into internal table-4.6C

    Dear All,
    Is there any way of reading XML file from application server to SAP? I am using 4.6C. Function module SCMS_STRING_TO_XSTRING function module is not available. Please suggest.
    Thanks and regards,
    Atanu

    Hi Atanu!
    Simply use the XSLT transformation 'ID'.
    FIELD-SYMBOLS <ls_result> TYPE ANY.
    CREATE DATA lref_data TYPE (your_structure).
    ASSIGN lref_data->* TO <ls_result>.
    CALL TRANSFORMATION id
                        SOURCE XML xmlstr
                        RESULT result = <ls_result>.
    "xmlstr" contains your XML file. Just read it into it via standard I/O operations. "<ls_result>" will contain your DDIC formatted content.
    Best regards
    Torsten

  • Regarding uploading the file from Application Server

    I am trying to upload a .csv file to Application Server through CG3Z tcode.
    But i am getting dump ad below..
    What happened?
        While a text was being converted from code page '4102' to '1100', one
        the following occurred:
        - an character was discovered that could not be represented in one of
        the two code pages;
        - the system established that this conversion is not supported.
        The running ABAP program, 'SAPLC13Z' had to be terminated, since the
        conversion could cause incorrect data to be generated.
        1 characters could not be represented (and thus could not converted).
        If 1 = 0, a second or a different error has occurred.
    Please let me know..how can i resolve this??
    Thanks
    Priyanka

    Check if your CSV file is UNICODE encoding.
    If CG3Z steel not works you can check on OSS SUPPORT if a note solve your problem.

  • 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

  • FM to read XML files from Application server in ECC5.0

    Hi All,
    We need to pick up an XML file from Application server/FTP server. The requirement is to parse the XML file and process it to create material master. SAP provides standard function modules to read XML files.
    Now we need to read the XML file contents of MM01 and upload into SAP Data Base through BAPI
    I need to know about the Function modules to read XML files from Application Server and also about the FM's that will update the Date base tables with the data obtained form XML files.
    Regards
    Prathima

    Parsing XML data:
    http://help.sap.com/saphelp_nw04/helpdata/en/86/8280ba12d511d5991b00508b6b8b11/frameset.htm
    or alternatively check out ABAP online help for "CALL TRANSFORMATION".
    For creating the material master look at BAPI_STANDARDMATERIAL_CREATE.
    Thomas

Maybe you are looking for