ABAP code for wrting a file to application server

<Moderator Message: We are not here to do your job for you>
Hi All,
i have a requirement to get the data from some other ABAP program and this data has to be written in one of the files present in application server.
please provide me the exact ABAP code for this...
Edited by: Siegfried Szameitat on Dec 17, 2008 10:40 AM

this has to be done using a process chain

Similar Messages

  • Is there any way to upload Tariff Code (with multiple XML files) from application server?

    Hi All,
    Is there any way to upload Tariff Code (with multiple XML files) from application server?. Its urgent.
    Regards,
    Jatin

    Hi Jatin,
    Yes, of course you can upload multiple files for tariff codes.
    This can be done by the below path:-
    SAP GTS Cockpit(tcode-/sapsll/menu_legal)-->Customs Management-->Classification-->Classification Master Data-->Upload Tariff Code Numbers from XML file(tocde- /SAPSLL/LLNS_UPL101).
    In the above area after browsing and choosing the first file, please select multiple check box to choose more files as well. Then you can further select your application server and upload all those files in one go.
    PS:- Although, we have an option to upload multiple such files but actually we should avoid multiple file uploads due to various reasons. Hence, please take utmost care during such procedure.
    Regards,
    Aman

  • Open data set for reading excel file on application server in back ground

    open data set for reading excel file on application server in back ground

    hi Vijay,
    I am afraid you won't be able to read from Excel file on Appl. Server.
    ec

  • Function Module for putting Flat File into Application Server

    Hi Pals,
         what is the   Function module for putting my flatfile into application server..
    because i dont have  authorizations to  put my flatfile  into application server directly..
    I know one function mudule is there for that ...so,  can you suggest me.. what is the function module... for that..
    thanks.. and points will be assigned..
    chitti

    Hi,
    well normally you use the method GUI_UPLOAD of class CL_GUI_FRONTEND_SERVICES to upload a file from your client pc. Then you use the abap statements open dataset, transfer and close dataset to put the file to the app-server.
    kind regards
    Siggi

  • Creating a new file in application server

    hai,
      please rectify this, how to create a file in application server ?
       can any one forward a sample code for creating a file in application server.
                           hazam

    Hi Hazam,
      Please check the below code.
    Data :   P_UFILE(60)                   " Unix File name
             TYPE C
             value '/emn_R3/hr/ben_age25_dep'.
        CLEAR GD_SUBRC.
        <b>OPEN DATASET</b> GD_FILE FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
        IF SY-SUBRC <> 0.
          GD_SUBRC = SY-SUBRC.
          gs_error-pernr = gs_0021-pernr.
          gs_error-ename = gd_ename.
          gs_error-mess
               = 'Can not open File:'(017) + gd_file.
          append gs_error to gt_error.
          clear gs_error.
    *      CLEAR GD_MSG1.
    *      CONCATENATE 'Can not open File:'(017)
    *                   GD_FILE
    *        INTO GD_MSG1.
    *      WRITE : / GD_MSG1.
        ELSE.
          LOOP AT GT_BODY INTO GS_BODY.
            <b>TRANSFER</b> GS_BODY TO GD_FILE.
          ENDLOOP.
          <b>CLOSE DATASET</b> GD_FILE.
        ENDIF.
    Hope this will help you.
    Thanks&Regards,
    Siri.
    Message was edited by: Srilatha T

  • Urgent : Download file from Application Server via Process Chain.

    Hi Experts,
    My requirement is to download the file from Application Server to local work station using an ABAP Program .
    I want including the above ABAP program in a process chain to execute  the program daily,
    I tried to use ARCHIVFILE_SERVER_TO_CLIENT and GUI_DOWNLOAD but unfortunately both the above FM doesn't support to run through Process chain.
    Can any one of you help me to send the code which selects a file from application server, downloads to local system and deletes it.
    Thank you very much for spending your precious time in this regard.

    Hi Sailekha,
    Regarding your case ..
    I suggest you to create the program where it run this function: WS_DOWNLOAD.
    After it, the program is run by your process chain.
    Hopefully it can help you a lot.
    Regards,
    Niel.
    thanks for the points you choose to assign.

  • Downloading File on Application server

    Hi All,
    I have wriitten a code for Downloading a data on application server.
    I wanted to add Summary details for the same extract .
    I have collected all the summary details in the internal table of type string .
    I am using TRASPORTING for moving Summary deatils to File on application server and then again transporting Extarct .
    But in the summary details ,I am getting last line of that not complete summary.
    I used this table (string type) for Presentation server and its working fine there.
    Please help me out.
    ans will b rewarded.
    Thanks
    Hemant

    Hi,
    Make sure you have the TRANSFER statement with in the internal table loop..
    LOOP AT ITAB.
      TRANSFER ITAB TO '/tmp/test.txt'.
    ENDLOOP.
    Thanks,
    Naren

  • Creating a file on application server that exceeds 10 Million charecters

    Hello All,
    We have custom IDocs which carry Strings of 1062 characters in each of their segments.
    Now the requirement is to create a single string file out of these idocs data.
    It is expected that each of these IDocs can go up to having more than 70,000 segments.
    So, now when this is concatenated into one single string it can go upto 7 Million charecters.
    My questions are:
    1. Can we create a text file with so many charecters in a single line or is there any limitation for this ?
    2. I have found a datatype CHAR30000, using which i'm currently concatnating around 30 segment data and then writing onto the file. Now once I wrote a single line, how can I set the pointer to End of line ?
    3. Is there any limitation in ABAP to create such a long string text file using method mentioned above ?
    Thanks for responding back!!
    -Sri

    No, It should be something like below.. for writing the file onto application server , which aint working though...
    *Writing output data into the file.
      lw_endofline = 30000.
      OPEN DATASET p_fileop FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
      LOOP AT int_output INTO wa_output.
        TRANSFER wa_output-sdata TO p_fileop.
        "SET DATASET p_fileop POSITION lw_endofline.
        SET DATASET p_fileop POSITION lw_endofline.
        lw_endofline = lw_endofline + 30000.
      ENDLOOP.
      CLOSE  DATASET p_fileop.

  • Files on application server

    Hi,
    Can any one tell me what is Tcode for finding files on Application server.

    Hi ,
    This transaction AL11 is SAP directories. But do we have a separate Tcode for knowing the files on Application server only.
    Since AL11 consists of all BDC Program by session will store in this directory.
    I want a Tcode which will only give the files on Application server only.

  • T-code for delete file from application server

    Hi all!
    Please, has any t-code for delete file from application server? For upload exist CG3Z, for download has CG3Y. And for delete? Has anyone?
    I need to delete file from application server in QA system and i don't want to create a program for this because i will need to transport a request from DEV to QA.

    I don't have contact with basis team.
    The FM EPS_DELETE_FILE support directory name with max 60 char. My dir. has more than that. I need a transaction for this.
    Anybody know if this transaction exist?

  • ABAP Code for Backup the entire table data in the application server

    Hello Friends,
    I have to create the table data Backup and Store the entire table data in the application server and also be able to restore the data back if needed.
    this should be dynamic program for any table based on the table name given on the application server.. I have developed a program for this but its having problems with the Quantity, amount. Its not writing it correctly at the application level.
    ANy Suggestions on this.
    Below is the program for this.
    Thanks,
    Ster.
    * Report  YWMM_TABLE_DUMP                                             *
    REPORT ywmm_table_dump .
    TABLES :
            dd03l.
    * Type spool declaration
    TYPE-POOLS:
            abap, slis.
    DATA: i_table_data1  TYPE REF TO data.
    DATA : it_dd03l LIKE dd03l OCCURS 0 WITH HEADER LINE.
    *DATA : gt_fieldcat TYPE lvc_s_fcat.
    DATA : i_fcat      TYPE STANDARD TABLE OF lvc_s_fcat,
           l_dr_line         TYPE   REF TO data,
           l_v_as4vers       TYPE as4vers.
    FIELD-SYMBOLS: <f_table_data1>     TYPE STANDARD TABLE,
                   <f_wa_table_data1>  TYPE ANY.
    SELECTION-SCREEN: BEGIN OF BLOCK bl1 WITH FRAME TITLE text-001.
    PARAMETERS: rb_copy RADIOBUTTON GROUP map DEFAULT 'X',
                rb_rest RADIOBUTTON GROUP map.
    SELECTION-SCREEN: END   OF BLOCK bl1.
    SELECTION-SCREEN: BEGIN OF BLOCK bl2 WITH FRAME TITLE text-002.
    PARAMETERS: p_table  TYPE tabname OBLIGATORY,
                p_plfld TYPE dd03l-fieldname.
    SELECTION-SCREEN SKIP 1.
    PARAMETERS: p_bkfile TYPE localfile OBLIGATORY.
    SELECTION-SCREEN: END   OF BLOCK bl2.
    PERFORM get_data.
    IF rb_copy = 'X'.
      PERFORM backup.
    ELSEIF rb_rest = 'X'.
      PERFORM database_update.
    ENDIF.
    *&      Form  get_data
    FORM get_data.
      CLEAR   i_fcat.
      REFRESH i_fcat.
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
           EXPORTING
                i_structure_name = p_table  " Table Name
           CHANGING
                ct_fieldcat      = i_fcat
           EXCEPTIONS
                OTHERS           = 1.
      CALL METHOD cl_alv_table_create=>create_dynamic_table
      EXPORTING
        it_fieldcatalog = i_fcat
      IMPORTING
        ep_table        = i_table_data1.
      IF sy-subrc = 0.
        ASSIGN i_table_data1->* TO <f_table_data1>.
      ELSE.
        WRITE: 'Error creating internal table'.
      ENDIF.
      IF rb_copy = 'X'.
        SELECT  * FROM (p_table) INTO CORRESPONDING FIELDS OF
                  TABLE <f_table_data1> UP TO 20 ROWS.
      ELSEIF rb_rest = 'X'.
        CREATE DATA l_dr_line LIKE LINE OF <f_table_data1>.
        ASSIGN l_dr_line->* TO <f_wa_table_data1>.
    *Get Data from Application Server
    * Opening the dataset P_BKFILE given in the selection screen
        TRANSLATE p_bkfile TO LOWER CASE.
        OPEN DATASET p_bkfile FOR INPUT IN TEXT MODE." ENCODING DEFAULT.
        IF sy-subrc NE 0.
    *    MESSAGE:
        ELSE.
          DO.
    * Reading the file from application server
            READ DATASET p_bkfile INTO <f_wa_table_data1>.
            IF sy-subrc = 0.
              APPEND <f_wa_table_data1> TO <f_table_data1>.
            ELSE.
              EXIT.
            ENDIF.
          ENDDO.
    * Closing the dataset
          CLOSE DATASET p_bkfile.
        ENDIF.
      ENDIF.
    ENDFORM.                    " get_data
    *&      Form  backup
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM backup.
      TRANSLATE p_bkfile TO LOWER CASE.
      OPEN DATASET p_bkfile FOR OUTPUT IN TEXT MODE.
      IF sy-subrc NE 0.
        WRITE: text-017.
        STOP.
      ELSE.
        LOOP AT <f_table_data1> ASSIGNING <f_wa_table_data1>.
          TRANSFER <f_wa_table_data1> TO p_bkfile.
        ENDLOOP.
      ENDIF.
      CLOSE DATASET p_bkfile.
    ENDFORM.                    " backup
    *&      Form  database_update
    FORM database_update.
      DATA : i_mara_u TYPE STANDARD TABLE OF mara WITH HEADER LINE,
             i_ekpo_u TYPE STANDARD TABLE OF ekpo WITH HEADER LINE,
             i_eban_u TYPE STANDARD TABLE OF eban WITH HEADER LINE,
             i_resb_u TYPE STANDARD TABLE OF resb WITH HEADER LINE,
             i_plpo_u TYPE STANDARD TABLE OF plpo WITH HEADER LINE,
             i_stpo_u TYPE STANDARD TABLE OF stpo WITH HEADER LINE,
             i_vbap_u TYPE STANDARD TABLE OF vbap WITH HEADER LINE,
             i_vbrp_u TYPE STANDARD TABLE OF vbrp WITH HEADER LINE,
             i_lips_u TYPE STANDARD TABLE OF lips WITH HEADER LINE,
             i_afvc_u TYPE STANDARD TABLE OF afvc WITH HEADER LINE,
             i_asmd_u TYPE STANDARD TABLE OF asmd WITH HEADER LINE,
    *           i_cooi_u TYPE STANDARD TABLE OF cooi WITH HEADER LINE,
             i_qmel_u TYPE STANDARD TABLE OF qmel WITH HEADER LINE,
             i_cooi_u TYPE STANDARD TABLE OF cooi WITH HEADER LINE,
             i_esll_u TYPE STANDARD TABLE OF esll WITH HEADER LINE,
             i_t165_u  TYPE STANDARD TABLE OF t165 WITH HEADER LINE,
             i_t165e_u TYPE STANDARD TABLE OF t165e WITH HEADER LINE,
             i_twpko_u TYPE STANDARD TABLE OF twpko WITH HEADER LINE,
             i_tpext_u TYPE STANDARD TABLE OF tpext WITH HEADER LINE,
             i_ce4mxpa_u TYPE STANDARD TABLE OF ce4mxpa WITH HEADER LINE,
             i_ce4mxpa_acct_u TYPE STANDARD TABLE OF ce4mxpa_acct WITH
                                                             HEADER LINE,
             i_zaim_u  TYPE STANDARD TABLE OF zaim WITH HEADER LINE,
             i_s012_d TYPE STANDARD TABLE OF s012 WITH HEADER LINE,
             i_s012_i TYPE STANDARD TABLE OF s012 WITH HEADER LINE,
             i_dummy  TYPE STANDARD TABLE OF mara.
      CASE p_table.
        WHEN 'MARA'.
    *     Non-Key
          PERFORM move_to_table USING   <f_table_data1>
                                CHANGING i_mara_u[]
                                         i_mara_u.
          PERFORM update_table USING i_mara_u[].
      ENDCASE.
    ENDFORM.                    " database_update
    *&      Form  move_to_mara
    FORM move_to_table USING    p_tab_from TYPE STANDARD TABLE
                       CHANGING p_tab_to   TYPE STANDARD TABLE
                                p_w_table.
      DATA:  l_wa_fcat TYPE lvc_s_fcat.
      FIELD-SYMBOLS: <f_field_from> TYPE ANY,
                     <f_field_to>   TYPE ANY.
      LOOP AT p_tab_from ASSIGNING <f_wa_table_data1>.
        LOOP AT i_fcat INTO l_wa_fcat.
          ASSIGN COMPONENT l_wa_fcat-fieldname
         OF STRUCTURE <f_wa_table_data1> TO <f_field_from>.
          ASSIGN COMPONENT l_wa_fcat-fieldname
         OF STRUCTURE p_w_table TO <f_field_to>.
          <f_field_to> = <f_field_from>.
        ENDLOOP.
        APPEND p_w_table TO p_tab_to.
      ENDLOOP.
    ENDFORM.                    " move_to_mara
    *&      Form  update_table
    FORM update_table  USING p_table_update TYPE STANDARD TABLE.
      SELECT SINGLE *
        FROM dd03l
       WHERE fieldname = p_plfld
         AND tabname   = p_table
         AND keyflag   <> 'X'
         AND as4local = 'A'
         AND   as4vers = l_v_as4vers
         AND   ( comptype = 'E' OR comptype = space ).
      IF sy-subrc = 0.
    *   Do update
        IF NOT p_table_update IS INITIAL.
          UPDATE (p_table) FROM TABLE p_table_update.
          IF sy-subrc = 0.
            COMMIT WORK.
          ELSE.
            ROLLBACK WORK.
            WRITE: text-003.
            STOP.
          ENDIF.
        ENDIF.
      ELSE.
    *delete and insert.
        IF NOT p_table_update IS INITIAL.
    *      DELETE (p_table).
          IF sy-subrc = 0.
            INSERT (p_table) FROM TABLE p_table_update.
            IF sy-subrc = 0.
              COMMIT WORK.
            ELSE.
              ROLLBACK WORK.
              WRITE: text-018.
              STOP.
            ENDIF.
          ELSE.
            ROLLBACK WORK.
            WRITE: text-018.
            STOP.
          ENDIF.
        ENDIF.
      ENDIF.
    ENDFORM.                    " update_table
    Edited by: Julius Bussche on Jul 18, 2008 1:43 PM
    Please use a meaningfull subject title!

    ARS,
    I am struggling a bit to get this.
    there is a syntax error,
    Field "FIELDS_INT-TYPE" is unknown. It is neither in one of thespecified tables nor defined by a "DATA" statement.     
    Again you have asked to move to a diffrent table. What is that table and how to build it.
        LOOP AT <f_table_data1> ASSIGNING <f_wa_table_data1>.
          LOOP AT i_fcat INTO l_fcat.
            IF l_fcat-inttype EQ 'P'.
              ASSIGN COMPONENT l_fcat-fieldname
                  OF STRUCTURE <f_wa_table_data1> TO <f_field>
                  TYPE     fields_int-type
                  DECIMALS fields_int-decimals.
            ELSE.
              ASSIGN COMPONENT l_fcat-fieldname
                  OF STRUCTURE <f_wa_table_data1> TO <f_field>
                  TYPE     fields_int-type.
            ENDIF.
            " Move <f_field> to a new table and use this table for download
          ENDLOOP.
          TRANSFER <f_wa_table_data1> TO p_bkfile.
        ENDLOOP.
    Ster

  • ABAP code for Hierarchy Loading from Flat File

    Hi,
    Can anyone give me some idea / ABAP code for generating parent - child relationships (NODEIDS) from a flat file and load into BW.
    Best regards
    Any insight into this development is highly appreciated

    Hi,
    also have a look at this how to to get informations about the file structure:
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/0403a990-0201-0010-38b3-e1fc442848cb
    /manfred

  • Transaction Code for seeing the files in the  Application Server

    Hello All,
      Can anybody please give me the transaction code for seeing the files in the Application Server
    Thanks in Advance,
    Regards,
    LIJO.

    hi
    good
    try with tcode AL11.
    thanks
    mrutyun^

  • Urgent.... Help Needed for Storing file in Application Server

    Hi All,
    I have a requirement where in I have to save a file in Application Server.
    File is of 141 Character Length, so there can be spaces left at the end.
    When I am downloading the file into Application Sever and then downloading the same file from Application Server to Presentation into a notepad then the spaces at the end are truncating.
    I want that the file that is generated should be of 141 character though if there may be spaces at the end.
    It will be great if you can help me out in this.
    Thanks in Advance.
    Jayant Sahu.

    when downloading to App server, you need to specify the LENGTH option on your TRANSFER ststement to keep fixed length.  You must also use a STRING type variable in your transfer.
    From Documentation on Transfer command:
    <b>If the file was opened as a text file or a legacy text file, the trailing blank characters are deleted for all data objects, except for those of data type string. The line end marker defined when the file was opened is then added to the remaining content of the data object or to the result of the conversion, and the final result is written byte-by-byte to the file.</b>
    There also used to be a problem with WS_DOWNLOAD - you had to do the following:
    Maintaining Trailing spaces when downloading to PC
    Before calling DOWNLOAD or WS_DOWNLOAD, do a perform SET_TRAIL_BLANKS(saplgrap) using 'X'
    To set the length of each record including your blanks add this code: perform SET_FIXLEN(saplgrap) using '0' '100'
    Don't think this is needed any more.
    Andrew

  • Program for uploading file on application server...

    Hi,
    I have created a program to upload a file from presentation server (local desktop) to application server. But in this program I have to specify the file length. What should I do in given program so that I can upload file of any length on application server ?
    *& Report  Z_FILE_DOWNLOAD_TO_APP_SERVER                               *
    * This Program can be used to move flat files to application server from presentation server.
    REPORT  Z_FILE_DOWNLOAD_TO_APP_SERVER.
    PARAMETERS: P_FILE       LIKE IBIPPARMS-PATH,
               P_FILE1(20000) default 'E:CONVERSIONFLAT' lower case.
    DATA: WS_FILE TYPE STRING.
    DATA: BEGIN OF T_DATA OCCURS 0,
           RECORD(20000),
         END OF T_DATA.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
    CALL FUNCTION 'F4_FILENAME'
    EXPORTING
      PROGRAM_NAME        = SYST-CPROG
      DYNPRO_NUMBER       = SYST-DYNNR
      FIELD_NAME          = ' '
    IMPORTING
      FILE_NAME           = P_FILE
    START-OF-SELECTION.
    WS_FILE = P_FILE.
    CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
       FILENAME                      = WS_FILE
      FILETYPE                      = 'ASC'
    TABLES
       DATA_TAB                      = T_DATA
    EXCEPTIONS
      FILE_OPEN_ERROR               = 1
      FILE_READ_ERROR               = 2
      NO_BATCH                      = 3
      GUI_REFUSE_FILETRANSFER       = 4
      INVALID_TYPE                  = 5
      NO_AUTHORITY                  = 6
      UNKNOWN_ERROR                 = 7
      BAD_DATA_FORMAT               = 8
      HEADER_NOT_ALLOWED            = 9
      SEPARATOR_NOT_ALLOWED         = 10
      HEADER_TOO_LONG               = 11
      UNKNOWN_DP_ERROR              = 12
      ACCESS_DENIED                 = 13
      DP_OUT_OF_MEMORY              = 14
      DISK_FULL                     = 15
      DP_TIMEOUT                    = 16
      OTHERS                        = 17
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    * Creating the file at Appl server............................
    OPEN DATASET P_FILE1 FOR OUTPUT IN TEXT MODE encoding utf-8.
    if sy-subrc ne 0.
    message e000(--) with 'Error in opening file'.
    endif.
    * Trasfer the records to file.............
    loop at t_data.
    transfer t_data to p_file1.
    endloop.
    close dataset p_file1.
    if sy-subrc eq 0.
    write: / 'Written the files at ', p_file1.
    write:/ 'Goto AL11 Transaction and then click on SAP Directory DIR_SAPUSERS to look for the file'.
    endif.
    Please advice.
    Regards,
    Rajesh

    Try declaring it as TYPE STRING. Not sure though.
    There are two predefined types in ABAP with variable length:
    STRING for character strings
    XSTRING for byte strings
    Thanks,
    SKJ

Maybe you are looking for