Application server file downloading

Hi Experts,
I have very urgent requiremnts for this :
1. The data extract needs to be downloaded on SAP application server ( take whatever path accessible to you).
2. Thereafter for every run, it should check if the file available in the same path and if yes then append data to this file instead of creating new one.
3. If file is not available then create new file.
please suggest me, how to do this.
it's very urgent
Regards
Mohit

hi,
use following logic
Compile the file path
  CONCATENATE text-t10 sy-datum c_txt INTO v_fname_out.
Open the filepath on the application server for writing
  OPEN DATASET v_fname_out FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
Check if the file could be opened
  IF sy-subrc = 0.
  Loop at the internal table and transfer the contents to the file specified at the path
    LOOP AT itab INTO wa.
      TRANSFER wa TO v_fname_out FOR APPENDING.
      CLEAR wa.
    ENDLOOP.
  ENDIF.
Close the dataset
  CLOSE DATASET v_fname_out.
regards,
srilatha

Similar Messages

  • Application Server File Download Error

    Hi Experts,
      i have tried downloading xml in to application server .. follwing the link in sdn.
    XML file creation in application server
    but while scheduling background job it gets cancelled and shows error message ' Error in Control Framewor ' in the log please help me on this..

    Could you please give little more details,like what are the transactions used,if possible please send a copy of the code of your program which you are scheduling as back groud job.
    Kind regards
    Manoj

  • Application server file download

    Hi gurus,
    Iam using a FM F4_DXFILENAME_TOPRECURSION for downloading data to the application server and also using the same FM for retrieving the data from appl. server.
    I have been provided a sample path in "Development server" with the directory name and here it is running fine.
    My problem is that they have mentioned a path for "Testing Server" as J:\MAT and i need to download the data in this path in Testing server.But iam unable to see any such path or directory in AL11 by logging in "Testing server".Even when i test the above FM in SE37 this Path or directory is not visible.
    The BASIS team tells that they have created this path....
    Pls reply ..points will be awarded..waiting for reply

    HI,
    its true but the BASIS says they have created it...anyways thanks
    does AL11 display all the directories(even the one which we dont have permission)??
    regards,
    janak

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

  • Application Server : File writes only 255 characters

    Hi Friends,
    I am trying to writes data to application server file .
    My line size is 1100 charqacters.
    When I use open dataset for output in text mode encoding default
    and transfer contents to file.
    I am only able to write contents upto 255 characters.
    Whatever is beyond that I do not see it in AL11.
    Is there a way to write more than 255 characters.
    I tried CG3Y to view files but it also shows only 255 characters.
    Please help.

    Hi,
    Just find the string length.
    In 4.6C version there is a limit of 1500 characters i. e. U can transfer max of 1500 characters in a single transfer. For that we applied below solution. Check this it may help u.
      l_len = strlen( p_data ).
      DO.
        IF l_len LT 1500.
          TRANSFER p_data+l_offset(l_len) TO p_file.
          MOVE 0 TO l_len.
        ELSE.
          TRANSFER p_data+l_offset(1500) TO p_file.
          SUBTRACT 1500 FROM l_len.
          ADD 1500 TO l_offset.
        ENDIF.
        CHECK l_len EQ 0.
        EXIT.
      ENDDO.
    p_data has the content to be trasfered of around 6000 characters and the length is dynamic.
    Also download the data using CG3Y with BIN to .txt file and see.
    If problem is still there then paste ur code of OPEN DATASET, TRANSFER statements.
    Try to open the file in TEXT MODE.
    eg: OPEN DATASET l_file IN TEXT MODE.
    Thanks,
    Vinod.
    Edited by: Vinod Reddy Vemuru on Jul 25, 2008 12:34 PM

  • Application server file formats.

    Hi,
    I have one query regarding the application server file formats, when we are creating a file we give some extension (.txt, .dat),what is the use of different extensions.
    When we are downloading the file from appl server using CG3Y we have two options(ASC and BIN ) what is the use of these options.
    Thanks in advance.

    Hi,
    A text file is a kind of computer file that is structured as a sequence of lines.
    A .dat  file is a computer file which stores data for use by a computer application or system.
    A character encoding consists of a code that pairs a sequence of characters from a given character set (sometimes referred to as code page) with something else, such as a sequence of natural numbers, octets or electrical pulses, in order to facilitate the storage of text in computers and the transmission of text through telecommunication networks.
    ASCII and BINARY codes are used for internal representation of data.
    The major difference between ASCII and BINARY is that when ASCII mode is used then the READ DATASET stmt starts at new line each time and in case of BINARY it reads character by character ( or some characters).
    Thanks and regards.

  • Erroneous row-lines in application server file

    Hello,
    There are some erroneous row-lines in application server file. Some part of data is repeating on a single line. I could not able to figure out if this is new record or part of same line. I have checked the code. Internal table is correctly written on application server using TRANSFER statement.
    This problem is occurring only in Production environment as per description. So, I am not able to simulate the case in development environment.
    When I downloaded file into notepad I get following text on single line:-
    7411NC00101 GASNW 49223004 ESSENT NETWERK NOORD (GAS) GASNW 49223004 ESSENT NETWERK NOORD (GAS)  871694840014102760
    Correct record should be:-
    7411NC00101 GASNW 49223004 ESSENT NETWERK NOORD (GAS) 871694840014102760
    Can anyone please suggest me possible causes of the problem?
    Thanks in advance,
    Minal

    Hi,
    Just check the code in debugging  where the "GASNW 49223004 ESSENT NETWERK NOORD (GAS)" portion is generated and written to text area. This is happening because of the loop or not refreshing the variables.
    With regards,
    Sunil

  • Application server file path vaidation

    I have written the code for application server file path validation.
      DATA : l_fname TYPE filename-fileintern." type c.
      DATA : l_filpath TYPE filename-fileintern,
             l_filname(40) TYPE c.
    PARAMETER : p_sucfil LIKE rfpdo-rfbifile OBLIGATORY. " rlgrap-filename
    AT SELECTION-SCREEN ON p_sucfil.
    l_fname = p_sucfil.
    CALL FUNCTION 'FILE_GET_NAME'
      EXPORTING
      CLIENT                        = SY-MANDT
        logical_filename              = l_fname
       OPERATING_SYSTEM              = SY-OPSYS
      PARAMETER_1                   = ' '
      PARAMETER_2                   = ' '
      PARAMETER_3                   = ' '
      USE_PRESENTATION_SERVER       = ' '
       WITH_FILE_EXTENSION           = 'X'
      USE_BUFFER                    = ' '
      ELEMINATE_BLANKS              = 'X'
    IMPORTING
      EMERGENCY_FLAG                =
      FILE_FORMAT                   =
       FILE_NAME                     = l_filpath
    EXCEPTIONS
       FILE_NOT_FOUND                = 1
       OTHERS                        = 2
    IF sy-subrc <> 0.
      message 'Invalid file name' type 'E'.
    ENDIF.
    But always i will get Invalid file name.
    Y is it so.
    pls help me.

    Praveen,
    I have checked ur code and I found that if i give a logical file name from
    tran. FILE under folder 'Logical file name definition, cross client' then ur code works. Pl. check.
    Regards,
    Joy.
    DATA : l_fname TYPE filename-fileintern." type c.
    DATA : l_filpath TYPE filename-fileintern,
    l_filname(40) TYPE c.
    PARAMETER : p_sucfil LIKE rfpdo-rfbifile OBLIGATORY. " rlgrap-filename
    AT SELECTION-SCREEN ON p_sucfil.
      l_fname = p_sucfil.
      CALL FUNCTION 'FILE_GET_NAME'
      EXPORTING
      logical_filename = l_fname
    operating_system = sy-opsys
      with_file_extension = 'X'
      IMPORTING
      file_name = l_filpath
      EXCEPTIONS
      file_not_found = 1
      OTHERS = 2
      IF sy-subrc <> 0.
        MESSAGE 'Invalid file name' TYPE 'E'.
      ENDIF.

  • Validate  application server file

    Hi,
      I have to validate the application server file path on selection screen.
    I am using following code :
    form VALID_APP_FILEPATH   using    p_filpath TYPE FILENAME-FILEINTERN.
      data : l_fname(60).
      CALL FUNCTION 'FILE_GET_NAME'
        EXPORTING
          LOGICAL_FILENAME = p_filpath
          OPERATING_SYSTEM = SY-OPSYS
        IMPORTING
          FILE_NAME        = L_FNAME
        EXCEPTIONS
          FILE_NOT_FOUND   = 1
          OTHERS           = 2.
      IF SY-SUBRC ne 0.
          MESSAGE 'Enter the valid file path'(e01) TYPE 'E'.
      ENDIF.
    endform.                    " VALID_APP_FILEPATH
    but if i choose correct file path from F4 help also.
    It displays error message.
    Sy-subrc always equals 1.
    Help me out

    Hi,
    I have implemented the code mentioned by you and am not having any problems even when I use F4 to get the fle name.
    Pls recheck and get back if the error persists.
    Reward if found helpful.
    Warm Regards,
    R Adarsh

  • Error  while accessing the application server file

    Hello,
    When I try to load the data from CSV file to PSA , I am getting following error message
    "Error  while accessing the application server file"
    "Errors in source system"
    I gave the right file path
    I am not sure about this error message.
    Thanks,

    Hi ram,
    if you have more than one application server running in your BI system (see at transaction SM51) be aware that your infopackage will be executed on the right one. Each application server has its own file system and your job need to run on the server your file is stored on.
    Also check if the os user of the SAP system itself (<sid>adm on Unix) has rights to read that file.
    Bye
    Frank

  • Application Server File

    Hi,
    Could any one please answer my question.
    How to archive application server file?.. What is the function module used for that?.
    And my second question..
    How to scan application directory.. after scanning I must be able to know how many files the source directory contians, and the file properties
    Thank you..

    1 . use CG3Z transaction or use OPEN dATASET statement
    2 . use FM EPS_GET_dIRECTORy_LISTING

  • Application server file lentgh

    Hi,
    I am trying to read an application server file using open dataset in Binary Mode..
    I want to find the file length of the file read.(number of bytes transferred as in the GUI_Download FM parameter Filelength)
    How can i achieve it.
    Appreciate ur ideas.
    Rgds.
    stck

    Hello,
    Use the FM EPS_GET_FILE_ATTRIBUTES passing the file name and the directory name and get the file_size.
    Vikranth

  • Application Server file into EXCEL SHEET

    Hi ,
    i want down load the Application Server FILE into EXCEL SHEET directly..
    how to do this one.
    regards,
    venu.

    Hi Srinivas
    I tried using CG3Z to upload excel onto application server but failed to do the same,
    Any pointers regarding the same would be of great help.
    Regards
    Sukumari
    Edited by: Manjeera Chinigiri on Mar 31, 2008 3:08 PM

  • Application Server file to internal table

    Hi,
      How can i read the application server file into the internal table??  Which FM should i use??
    Regards,
    Kit

    Hi,
    Open Dataset is used to read or write on to application server ... other than that i am not sure that there exists any way to do the same ... here is a short description for that
    FILE HANDLING IN SAP
    Introduction
    • Files on application server are sequential files.
    • Files on presentation server / workstation are local files.
    • A sequential file is also called a dataset.
    Handling of Sequential file
    Three steps are involved in sequential file handling
    • OPEN
    • PROCESS
    • CLOSE
    Here processing of file can be READING a file or WRITING on to a file.
    OPEN FILE
    Before data can be processed, a file needs to be opened.
    After processing file is closed.
    Syntax:
    OPEN DATASET <file name> FOR {OUTPUT/INPUT/APPENDING}
    IN {TEXT/BINARY} MODE
    This statement returns SY_SUBRC as 0 for successful opening of file or 8, if unsuccessful.
    OUTPUT: Opens the file for writing. If the dataset already exists, this will place the cursor at the start of the dataset, the old contents get deleted at the end of the program or when the CLOSE DATASET is encountered.
    INPUT: Opens a file for READ and places the cursor at the beginning of the file.
    FOR APPENDING: Opens the file for writing and places the cursor at the end of file. If the file does not exist, it is generated.
    BINARY MODE: The READ or TRANSFER will be character wise. Each time ‘n’’ characters are READ or transferred. The next READ or TRANSFER will start from the next character position and not on the next line.
    IN TEXT MODE: The READ or TRANSFER will start at the beginning of a new line each time. If for READ, the destination is shorter than the source, it gets truncated. If destination is longer, then it is padded with spaces.
    Defaults: If nothing is mentioned, then defaults are FOR INPUT and in BINARY MODE.
    PROCESS FILE:
    Processing a file involves READing the file or Writing on to file TRANSFER.
    TRANSFER Statement
    Syntax:
    TRANSFER <field> TO <file name>.
    <Field> can also be a field string / work area / DDIC structure.
    Each transfer statement writes a statement to the dataset. In binary mode, it writes the length of the field to the dataset. In text mode, it writes one line to the dataset.
    If the file is not already open, TRANSFER tries to OPEN file FOR OUTPUT (IN BINARY MODE) or using the last OPEN DATASET statement for this file.
    IF FILE HANDLING, TRANSFER IS THE ONLY STATEMENT WHICH DOES NOT RETURN SY-SUBRC
    READ Statement
    Syntax:
    READ DATASET <file name> INTO <field>.
    <Field> can also be a field string / work area / DDIC structure.
    Each READ will get one record from the dataset. In binary mode it reads the length of the field and in text mode it reads each line.
    CLOSE FILE:
    The program will close all sequential files, which are open at the end of the program. However, it is a good programming practice to explicitly close all the datasets that were opened.
    Syntax:
    CLOSE DATASET <file name>.
    SY-SUBRC will be set to 0 or 8 depending on whether the CLOSE is successful or not.
    DELETE FILE:
    A dataset can be deleted.
    Syntax:
    DELETE DATASET <file name>.
    SY-SUBRC will be set to 0 or 8 depending on whether the DELETE is successful or not.
    Pseudo logic for processing the sequential files:
    For reading:
    Open dataset for input in a particular mode.
    Start DO loop.
    Read dataset into a field.
    If READ is not successful.
    Exit the loop.
    Endif.
    Do relevant processing for that record.
    End the do loop.
    Close the dataset.
    For writing:
    Open dataset for output / Appending in a particular mode.
    Populate the field that is to be transferred.
    TRANSFER the filed to a dataset.
    Close the dataset.
    chk a sampel
    parameters: p_file like rlgrap-filename obligatory
    default '/usr/sap/upload.xls'.
    types: begin of t_data,
    vbeln like vbap-vbeln,
    posnr like vbap-posnr,
    matnr like vbap-matnr,
    werks like vbap-werks,
    megne like vbap-zmeng,
    end of t_data.
    data: it_data type standard table of t_data,
    wa_data type t_data.
    open dataset p_file for output in text mode encoding default.
    if sy-subrc ne 0.
    write:/ 'Unable to open file:', p_file.
    else.
    do.
    read dataset p_file into wa_data.
    if sy-subrc ne 0.
    exit.
    else.
    append wa_data to it_data.
    endif.
    enddo.
    close dataset p_file.
    endif.
    And if you want to write on the file.
    *--- open UNIX file
    open dataset unixfile for output in text mode message w_msg.
    if sy-subrc ne 0.
    write: / 'Cannot open for writing:', unixfile, w_msg.
    exit.
    endif.
    *--- write UNIX file
    loop at it_file.
    transfer it_file to unixfile.
    endloop.
    *--- close UNIX file
    close dataset unixfile.

  • Application Server file Validity

    Hi Experts,
    I have one query. I wanted to check the validity of file in application server. The scenerio is like in my selection screen I will provide application server file name.
    I wanted to validate whether that file is existing or not. If file is not existing then I need to display an error message.
    Can anybody will suggest me how I can achieve this requirement?
    Thanks,
    Neha

    Hi Neha,
    To access the files on Application server we use DATASET operationsd like open, read, close etc.
    Now in your case use opendataset as:
      open dataset   ds_name for output in text mode encoding default.
      IF sy-subrc NE 0.
         //write your message here.
      ENDIF.
      CLOSE DATASET ds_name.
    Where ds_name = logical path name of your file, or if you want to check for just one file, hard code the path.
    Better practice is to use logical path name.
    Also declare ds_name as
    DATA: ds_name          LIKE rfpdo-rfbifile.   
    Close dataset is used in case file exists you need to close it.
    Revert back if you wantto know abt logical file name.
    Regards,
    Sana.

Maybe you are looking for

  • H.264 playback stutter in Premiere Pro CS4

    Details: Adobe Premiere Pro CS4 Intel Core 2 Quad Q6600 3GB RAM 32 bit Windows Vista SP2 I'm having problems with the playback of H.264 video files in Premiere Pro CS4. The files are 1280x720 60FPS clips, ranging in size from 8MB to 40MB, and they we

  • Email Report List as an attachment

    Hello Experts, I need to write a new program which will run in background and should be able to send its list as an attachement in an email. (I really appreciate if that can send the report's spool (if PDF format) as an attachment). I know that there

  • SAP DB2 Deep Compression

    Hi All I need some help with IBM DB2 version 9.5 to implement deep compression on very large tables compressing all the data in the tables not just from the point of enabling the compression going forward, the problem is these tables are very bit one

  • Abap testing tool

    Is there any abap testing tool........

  • What is lenovo_part O: drive

    Hi, when ı buy this ideapad s10-3 computer, ı cant see this lenovo_part O: drive in my computer section, but when ı try run one key recovery program this lenovo_part O: drive is now be visible, is it normal ? What happened ı dont understand.