Save on application server

hi.......
Can u any one explain how to transfer data to application server.......

Here is an example.
report zrich_0001.
parameters: d1 type localfile default '/usr/sap/TST/SYS/Test.txt'.
data: begin of itab occurs 0,
      field1(20) type c,
      field2(20) type c,
      field3(20) type c,
      end of itab.
data: str type string.
constants: con_tab type x value '09'.
* if you have a newer version, then you can use this instead.
*constants:
*    con_tab  type c value cl_abap_char_utilities=>HORIZONTAL_TAB.
start-of-selection.
itab-field1 = 'ABC'.
itab-field2 = 'DEF'.
itab-field3 = 'GHI'.
append itab.
itab-field1 = '123'.
itab-field2 = '456'.
itab-field3 = '789'.
append itab.
  open dataset d1 for output in text mode.
  loop at itab.
    concatenate itab-field1 itab-field2 itab-field2 into str
                  separated by con_tab.
    transfer str to d1.
  endloop.
  close dataset d1.
Regards,
Rich Heilman

Similar Messages

  • Sap query output to save on application server

    Hi All,
    I have one requirement, want to save the output of sap query on application server as a text file?
    Is there any work around?
    Regards
    Vasumathi
    Edited by: komma vasumathi on Nov 5, 2009 10:32 AM

    Hi Vasumathi,
    Application server path cannot be accessed unless otherwise using OPEN DATASET. More over, Infoset cannot be executed directly. It can be accessed through SAP Query only.
    Writing Logic for 2 or 3 tables with Inner Join will not be a big deal. Writing Abap program will be optimum for you FTP requirement.
    1. create a folder in AL11 as \sap\common\
    2.  create z program and Declare sel-screen parameters : selopt1, selopt2
    3. Query : Select Afield1 Afield2 Bfield1 Bfield2 from table1 as A inner join table2 as  B on Afield1 eq Bfield1 where Afield1 in selopt1 and Afield2 in selopt2  into corresponding fields of table itab.
    4. creating file  at application sever
          w_fileloc = '\sap\common\file.txt'
         OPEN DATASET w_fileloc FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
        . Loop itab into wa_itab.
          Transfer wa_itab to w_fileloc.
         clear w_fileloc.
        endloop.
    5. goto AL11 and check the file file.txt in  folder \sap\common
    Please let me know if you need more information or close this thread by offiering the points( If you are satisfied).
    Regards,
    Sakthivel N

  • How to move PDF file from Spool to Application Server?

    How to move PDF file from Spool to Application Server?
    Cannot use RSTXPDFT4 because that converts OTF to PDF and the file is already PDF.
    RSTXPDFT5 doesn't work. It picks the file up and assigns it a 'text' type and outputs a 1 line txt (1kb in size) on the server with the spool number in it!
    The program which outputs the file to the spool, in the first place, uses adobe forms and outputs to a printer of type PDF.

    Hi Gemini ,
    Please refer the below links.
    [http://sap.ittoolbox.com/groups/technical-functional/sap-hr/convert-a-spool-to-pdf-and-save-on-application-server-in-background-720959]
    [http://www.sapfans.com/forums/viewtopic.php?f=13&t=325628&start=15]
    Edited by: Prasath Arivazhagan on Apr 13, 2010 4:48 PM

  • Function Module for creating file name in Application Server

    Hi Guys,
    Can you suggest me a function module to generate a file name for a flat file to be save on application server using DATASET. 
    Required filename format : <table name >.<times tamp>.TXT
    Thanks in advance.

    Hi,
    Please try this ...
    DATA: BEGIN OF FILE1,
            CONST1(01) TYPE C VALUE '_',
            FIELD1     LIKE SY-DATUM,
            CONST2(01) TYPE C VALUE '_',
            FIELD2     LIKE SY-UZEIT,
          END OF FILE1.
    DATA: FILENAME LIKE EDI_PATH-PTHNAM.
    MOVE SY-DATUM  TO FILE1-FIELD1.
    MOVE SY-UZEIT  TO FILE1-FIELD2.
    CONCATENATE <table name> FILE1 INTO FILENAME.
    Regards,
    Ferry Lianto

  • How to save 4 versions of a file in the application server

    Hi,
       I have to write a program which will extract few data from SAP and write it in a file in the SAP application server. This program will be run once every month.
    I need to save 4 versions of the files, current and 3 prior.  These versions should cycle off the oldest once a new version has been created.
    Could anyone help me how to do this?
    Thank you!
    Regards,
    Sunitha.

    Hi Sunitha,
    The best way is to write a unix script in the unix server to do the job for you. Once The file is written in the server then leave the job from the unix side to get this done.
    This is the best option i think. Writing a script is not a big task. You can call the script from ABAP or from an external daemon in the unix server. We have many such programs in our org.
    Hope this helps
    Cheers
    VJ

  • How to save CSV file in application server while making infospoke

    How to save CSV file in application server to be used as destination while making infospoke.
    Please give the steps.........

    Hi
    If you want to load your flatfile from Application server,then you need to trasfer your file from your desktop(Computer) to Application server by using FTP.
    Try using ARCHIVFILE_CLIENT_TO_SERVER Function module.
    You Just need to give thesource path and the target path
    goto SE37 t-code , which is Function module screen, give the function name ARCHIVFILE_CLIENT_TO_SERVER, on click F8 Execute button.
    for path variable give the file path where it resides like C:\users\xxx\desktop\test.csv
    for target path give the directory path on Application server: /data/bi_data
    remember the directory in Server starts with /.
    U have to where to place the file.
    Otherwise use 3rd party tools to connect to ur appl server like : Core FTP and Absolute FTP in google.
    Otherwise...
    Goto the T.code AL11. From there, you can find the directories available in the Application Server.
    For example, if you wanna save the file in the directory "DIR_HOME", then you can find the path of the directories in the nearby column. With the help of this, you can specify the target path. Specify the target path with directory name followed by the filename with .CSV extension.
    Hope this helps
    regards
    gaurav

  • Save filename in application server

    i am uploading multiples files from desktop to application server and its working good. But user can upload same file name more than 4 or 5 times together.And i have to write the file on server by appending _2 _2 _2 for every new file. Right now i am able to do for one file name(.i.e. the file if already exsist its appending _2 with the new file name). but if i am uploading the same file third or fourth time its not writting the file on server. I have to just append _2 _2 with file that already exsist.
    here is the code that i had built up...
    DATA: BEGIN OF t_itab OCCURS 0,
    soldto(10) TYPE c,
    enumber(10) TYPE c,
    ename(35) TYPE c,
    land1(35) TYPE c,
    name2(35) TYPE c,
    matnr(18) TYPE c,
    quantity(13) TYPE c,
    shipdate like sy-datum,
    invoiceno(35) TYPE c,
    scost(13) TYPE c,"DECIMALS 2,
    ucost(13) TYPE c,"DECIMALS 2,
    dlno(10) TYPE c,
    END OF t_itab.
    DATA DECLARATION *
    DATA :file TYPE string.
    DATA :in_file(150) TYPE c.
    DATA: stripped TYPE rlgrap-filename.
    DATA: file_path TYPE rlgrap-filename.
    DATA: new_file_name TYPE rlgrap-filename.
    DATA :l_date(10) TYPE c,
    x_date TYPE d.
    DATA: xtitle1(132),
    xtitle2 LIKE xtitle1,
    xtitle3 LIKE xtitle1,
    xtitle4 LIKE xtitle1.
    CONSTANTS:EMAIL_KEY(20) TYPE c VALUE 'DISTY_POS_ERRORS'.
    P A R A M E T E R S *
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS s_uload FOR rlgrap-filename VISIBLE LENGTH 128
    NO INTERVALS.
    SELECTION-SCREEN END OF BLOCK b1.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_uload-low.
    CALL FUNCTION 'F4_FILENAME'
    EXPORTING
    program_name = 'ZSR00340'
    dynpro_number = syst-dynnr
    field_name = ' '
    IMPORTING
    file_name = s_uload-low.
    AT SELECTION-SCREEN ON BLOCK b1.
    IF s_uload IS INITIAL.
    MESSAGE e000(0k) WITH 'Please enter the file path'.
    ENDIF.
    TOP-OF-PAGE.
    CALL FUNCTION 'Z_REPORT_HEADERS'
    EXPORTING
    columns = 140
    period = space
    rpt_name = 'ZSR00340'
    rpt_title1 = sy-title
    RPT_TITLE2 =
    RPT_TITLE3 =
    COMP_CODE =
    IMPORTING
    text01 = xtitle1
    text02 = xtitle2
    text03 = xtitle3
    text04 = xtitle4.
    WRITE: / xtitle1,
    / xtitle2,
    / xtitle3.
    IF NOT xtitle4 = space.
    WRITE: / xtitle4.
    ENDIF.
    ULINE.
    FORMAT COLOR COL_HEADING ON INTENSIFIED OFF .
    START-OF-SELECTION *
    START-OF-SELECTION.
    LOOP AT s_uload.
    CALL FUNCTION 'WS_UPLOAD'
    EXPORTING
    filename = s_uload-low
    filetype = 'DAT'
    HEADLEN = ' '
    LINE_EXIT = ' '
    TRUNCLEN = ' '
    USER_FORM = ' '
    USER_PROG = ' '
    DAT_D_FORMAT = ' '
    IMPORTING
    FILELENGTH =
    TABLES
    data_tab = t_itab
    EXCEPTIONS
    conversion_error = 1
    file_open_error = 2
    file_read_error = 3
    invalid_type = 4
    no_batch = 5
    unknown_error = 6
    invalid_table_width = 7
    gui_refuse_filetransfer = 8
    customer_error = 9
    no_authority = 10
    OTHERS = 11
    IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    PERFORM sub_send_mail." using g_text.
    EXIT.
    ENDIF.
    *function to get customer name as ten digit
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
    EXPORTING
    input = t_itab-soldto
    IMPORTING
    output = t_itab-soldto.
    Function to prefix the Filename
    CALL FUNCTION 'SO_SPLIT_FILE_AND_PATH'
    EXPORTING
    full_name = s_uload-low
    IMPORTING
    stripped_name = stripped
    file_path = file_path.
    *format date as mmddyyyy from yyyymmdd
    x_date = sy-datum.
    CONCATENATE x_date4(2) x_date6(2) x_date+0(4) INTO l_date.
    CLEAR new_file_name.
    *conactenated the directory with system and with the path name
    CONCATENATE '/xapp' sy-sysid 'disti/pos/' INTO in_file
    SEPARATED BY '/'.
    CONCATENATE in_file 'POS' l_date t_itab-soldto
    INTO new_file_name SEPARATED BY '_'.
    REPLACE FIRST OCCURRENCE OF '_' IN new_file_name WITH ''.
    *check for exsistency of file
    OPEN DATASET new_file_name FOR UPDATE IN LEGACY TEXT MODE.
    IF sy-subrc = 0.
    *if exists then append '2' again with the new filename
    CONCATENATE new_file_name '2' INTO new_file_name
    SEPARATED BY '_'.
    CLOSE DATASET new_file_name.
    ENDIF.
    *to write data on server
    OPEN DATASET new_file_name FOR OUTPUT IN LEGACY TEXT MODE.
    *looping on Internal table to write all data
    LOOP AT t_itab.
    TRANSFER t_itab TO new_file_name .
    ENDLOOP.
    *if successfully uploaded then success message
    IF sy-subrc EQ 0.
    WRITE:/ 'Files are uploaded'.
    ENDIF.
    CLOSE DATASET new_file_name.
    so cananyone plz suggest what should i do for appending _2 with the file that is already there on server...

    Hi
    I don't understand your problem well:
    If there is a file on server: should you insert a new file with the data of old file and new data?
    if it's so:
    DATA: WA(1000),
          last_file(100).
    CLEAR LAST_FILE.
    DO.
    OPEN DATASET new_file_name FOR UPDATE IN LEGACY TEXT MODE.
    IF sy-subrc = 0.
    Save the name of last file:
    last_file = new_file_name.
      CLOSE DATASET new_file_name.
    ELSE.
    EXIT.
    ENDIF.
    CONCATENATE new_file_name '2' INTO new_file_name
    SEPARATED BY '_'.
    ENDDO.
    Now before downloading new data, you should transfer old data:
    OPEN DATASET new_file_name FOR OUTPUT IN LEGACY TEXT MODE.
    IF NOT LAST_FILE IS INITIAL.
    OPEN DATASET LAST_FILE FOR UPDATE IN LEGACY TEXT MODE.
    DO.
    READ DATASET LAST_FILE INTO WA.
    IF SY-SUBRC <> 0. EXIT. ENDIF.
    TRANSFER WA TO new_file_name.
    ENDDO.
    CLOSE DATASET LAST_FILE.
    ENDIF.
    *looping on Internal table to write all data
    LOOP AT t_itab.
    TRANSFER t_itab TO new_file_name .
    ENDLOOP.
    *if successfully uploaded then success message
    IF sy-subrc EQ 0.
    WRITE:/ 'Files are uploaded'.
    ENDIF.
    CLOSE DATASET new_file_name.
    Max
    Message was edited by: max bianchi
    Message was edited by: max bianchi

  • Save the image in the application server directly

    Hi,
          I have developed a report which displays piechart as the output and saves the image on the presentation server. For that i have used the following code.
       when 'SAVE'.
    DATA : D TYPE GFW_EXP_DATA,
    R TYPE SYMSGNO.
    DATA: S TYPE STRING,
    N TYPE I.
    CALL METHOD GP_INST->IF_GRAPHIC_PROXY~EXPORT
    EXPORTING
    FORMAT =
    IF_GRAPHIC_PROXY=>co_format_bmp
    WIDTH = 50
    HEIGHT = 200
    name = 'C:\Documents and Settings.........'
    IMPORTING
    CONTENT_TYPE = S
    CONTENT_LENGTH = N
    CONTENT = D
    RETVAL = R
    I have a requirement where i have to save the output of the screen(piechart)  in the application server directly with out using the presentaion server.
    Is there any method to do so.
    Thanks and regards,
    Parvatha Reddy

    Hi parvatha ,
    your question is really good.
    Well i really haven't come across your scenario i many years . But my suggestion is to  can use java code to achieve the same .
    Or try to use hexadecimal type in your normal class to read the pie-chart and use transfer with same type .

  • Need to save a file on Application server, receiving error.

    Hello,
    I want to save a file on Application server.
    I have data in the final output table gt_out_chng.
    I want to write a file in the application server and this is the
    code that written,
    data : MY_NEW_FILE type file.
            MY_NEW_FILE = '/tmp/test.txt'.
    data: gv_output(255) type c,
          P_FILE TYPE rlgrap-filename.
       p_file = 'F:\USR\SAP\PUT'.
    CONCATENATE p_file '\' sy-datum sy-uzeit '.txt'
                                 INTO p_file.
    OPEN DATASET 'P_FILE' IN TEXT MODE FOR OUTPUT
                                      ENCODING DEFAULT.
    IF SY-SUBRC = 0.
    LOOP AT GT_OUT_CHNG INTO WA_OUTPUT_TAB.
    TRANSFER WA_OUTPUT_TAB TO 'P_FILE'.
    CLEAR  WA_OUTPUT_TAB.
    ENDLOOP.
    ENDIF.
    CLOSE DATASET 'P_FILE'.
    i am receiving an error message as follows :
    "WA_OUTPUT_TAB" cannot be a table, a reference,
    a string, or contain any of these objects.
    Please correct the code if found any errors..
    Any suggestions will be apprecaited!
    Regards,
    Kittu
    Edited by: Kittu on May 15, 2009 10:27 AM

    Hello,
    Instead of using the following,
    OPEN DATASET 'P_FILE' IN TEXT MODE FOR OUTPUT ENCODING DEFAULT.
    use this,
    OPEN DATASET P_FILE IN TEXT MODE FOR OUTPUT ENCODING DEFAULT.
    P_FILE is your variable, do not put it in quotes
    Edit: The same thing applies for your transfer and close statements
    Edited by: Kris Donald on May 15, 2009 2:05 PM

  • In what tables does Data in Application Server save ?

    Dear Gurus,
    In what tables does Data in Application Server save ?
    Does the code we write is saved in some tables (or) saved in
    repository ??
    what is a repository ???
    what are the tables where repository data is saved ????

    >
    Srikar M wrote:
    > Dear Gurus,
    >
    > In what tables does Data in Application Server save ?
    All of them
    >
    Srikar M wrote:
    > Does the code we write is saved in some tables (or) saved in
    > repository ??
    Both
    >
    Srikar M wrote:
    > what is a repository ???
    >
    The place where workbench objects are saved
    >
    Srikar M wrote:
    > what are the tables where repository data is saved ????
    Many and various.  Some not accessible via ABAP.

  • Save PDF-file on the application server

    Hello experts,
    I convert my Smartform to a PDF-File. I copied the code from  Suresh Kumar Parvathaneni (REPORT zsuresh_test). At first, thank you Suresh Kumar for that!
    Now, I would like to save the PDF-File on the application server and not local.
    Could you tell me how to do this. Especially, where do I have to put the abap-code in the given code from Suresh Kumar.
    I thank you very much for your help in advance.
    With kind regards.
    gokselin

    Hi,
    You can use the OPEN DATASET statment.
    Probably you must be having an output table which you are downloading to the local machine.You can use the same and loop at it. and if the OPEN dataset returned sy-subrc 0, use the TRANSFER statment.
    Remember the data will be binary for pdf. So you have to open the dataset in binary mode.
    regards,
    Advait

  • Save the o/p of the query in Application Server, Filename with Timestamp

    Dear Experts,
    I have a scenario that on 1st of every month, a query needs to execute and save the output of that query in Application Server, Filename along with Timestamp.
    For ex: Production_19/09/2011
    So, I Created a Query Extract in RSCRM_REPORT and gave the path name and scheduled. The output of the query is saved successfully in Application Server.
    But I need Timestamp along with Filename.
    Please help me out with the timestamp issues, how could I include Timestamp with Filename (Query Name).
    Thanks,
    SAP BI

    Hi chaith,
    You can achieve the result with out any code. You have to use the APD concept to extract the query to a file.
    check the following link which help you to create a logical path
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/60e86545-9940-2d10-9f89-eb5bce1f9228?quicklink=index&overridelayout=true
    you can use the path in the APD.
    Regards,
    Ranganath

  • Save string data type text in the application server file opened in binary

    Hi All,
    My requirement is to save the string "abcd    23432423   asdada" to the text file in the application server.
    I have written like this. but its not getting saved properly in the text file. Please help.
      constants X_LINESIZE type I value 128.
      types X_LINETYPE type X length X_LINESIZE.
    data: WA_TAB_X type X_LINETYPE.
      data: str1(64) type C.
      data: WA_TAB_X_HDR1 type xstring.
      str1 = 'abcd    23432423   asdada'.
      CONVERT TEXT STR1 INTO SORTABLE CODE WA_TAB_X_HDR1.
      concatenate F_FILENAME1 SY-SYSID F_FILENAME2 '/' TAB_REGUT-TSNAM '.TXT' into F_FILENAME1.
      open dataset F_FILENAME1 for output in binary mode .
      if SY-SUBRC = 0.
        transfer WA_TAB_X_HDR to F_FILENAME1.
        loop at TAB_X into WA_TAB_X.
          transfer WA_TAB_X to F_FILENAME1.
        endloop.
      endif.
      close dataset F_FILENAME1.
    Edited by: madhuri sonawane on Jun 2, 2009 4:05 PM

    HI,
    constants X_LINESIZE type I value 128.
      types X_LINETYPE type X length X_LINESIZE.
    data: WA_TAB_X type X_LINETYPE.
      data: str1(64) type C.
      data: WA_TAB_X_HDR1 type xstring.
    data : file (1000) type c.
      str1 = 'abcd    23432423   asdada'.
      CONVERT TEXT STR1 INTO SORTABLE CODE WA_TAB_X_HDR1.
      concatenate F_FILENAME1 SY-SYSID F_FILENAME2 '/' TAB_REGUT-TSNAM '.TXT' into F_FILENAME1.
      open dataset file for output in binary mode .
      if SY-SUBRC = 0.
        transfer WA_TAB_X_HDR to file.
        loop at TAB_X into WA_TAB_X.
          transfer WA_TAB_X to file
        endloop.
      endif.
      close dataset file.
    regards,
    Munibabu.k

  • Web DynPro - Save Adobe Form on Application Server

    Hello Seniors,
    We are working on a WebDynPro ABAP Application where in we need to display an Adobe from in a browser and the upload it to the Application Server automatically. We are able to display the form in the browser but are stuck up on how to upload the Adobe Form to the application server. Could you please let me know if there is a way on how to upload the Adobe form to the application server automatically. Your help is highly appreciated..
    Thank you,
    Srini M.

    Hi,
    Duplicate Post,
    Upload Adobe Form to Aplication Server from WebDynPro automatically
    Cheers,
    Kris.

  • BDS: How do I save an attachement to the application server?

    Dear all
    I have following problem:
    We have certain attachements to an object in this case an XML file.  These attachements are viewable via the Business Document Navigator and can be exported manually in foreground from there.
    But how do I export (copy) it in background towards a directory on the application server?  I don't seem to find any function capable of doing that.
    So currently I'm thinking of reading the contents (via BDS_BUSINESSDOCUMENT_GET_TAB) and storing it myself via OPEN DATASET on the application server...  but if there would be a more general approach I would rather use that.
    Please advice!
    Thanks in advance!

    Hi,
    Please see below code:-
    [http://wiki.sdn.sap.com/wiki/display/HOME/Objectservicefilestoe-mail-(Canbeusedforcustomportal,workflow+applications)]
    Hope it helps you.
    Regards
    Abhii...

Maybe you are looking for

  • Voice over tool & built-in audio

    When I open FCE, I routinely get a message "unable to locate built-in audio." I ignore it and continue, so far as I know without any bad consequences for my projects. Sound input and output seems fine, except when I try to use the voiceover tool. My

  • Document Types for PR created in R/3

    WE are implementing SRM classic scenario and in version 4.0. WE are creating the Purchase requisition in R/3 systems. Now in R/3 we have 2 document types PR01 for Materials and PR02  for services. There is a badi BBP_SC_TRansfer_BE with method Group_

  • PowerMac G5 hangs after going into screen saver power save mode

    I have a PowerMac G5 and it's been working fine, but as of late has been hanging. I had a couple of external disks on the machine ( Maxtor OneTouch II and a OneTouch III). I recently added two more OneTouch III and stripped the three OneTouch III's t

  • Error : Receiver agreement not found

    Hi all, My scenario is RFC to JDBC. Its showing the below error, when 'I try to send data through test configuration after configuring ESR and ID part. Receiver Agreement Runtime error Problem occurred in receiver agreement for sender -SAP_BL_ISU to

  • Balance sheet reports - YTD or Periodic

    Hello Experts, Had a question about how and what data needs to be loaded from BW to BPC NW version so that I can create balance sheet reports in BPC. Currently I am loading the periodic debit-credit activity to my planning application for all the acc