Skip to Content
avatar image
Former Member

Upload CSV file from PC to Application server

Hi,

I'm not a abaper so need help from ABAP gurus.

We have a simple requirement, and need two abap programs for these requirements:

1. First program should upload a .CSV file from PC to Application server. No data transformation/modification is required. The .CSV file should be uploaded as it is. Also Users should be able to provide PC and Application server path at run time.

2. Once file has been uploaded, we want it to be renamed by appending current date.

Any idea, how can I achieve it. I know there exist GUI_UPLOAD function module but not sure how to use it.

Regards,

Vikrant.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • avatar image
    Former Member
    Jul 03, 2006 at 06:42 AM

    Vikrant,

    If its a one time activity you can use the transactions CG3Y and CG3Z transactions.

    If NOT, then you will have to do this.

    1. Call the method GUI_UPLOAD METHOD of the class, CL_GUI_FRONTEND_SERVICES. This will prompt the user to enter the file path and name.

    2. Once the data is uploaded to a internal table, use the OPEN DATASET, TRANSFER, CLOSE DATASET commands to save the data to a file on the app server.

    Regards,

    Ravi

    Note :Please mark the helpful answers

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jul 03, 2006 at 06:42 AM

    You can try the tcode CG3Z to upload your file into application server from your PC

    Regards,

    Manohar

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hello kishan,

      You forgot to include the encoding addition in the OPEN DATASET command.

      Setting encoding to DEFAULT or UTF-8 works fine.

      Anyways, niche way to read .csv files from the presentation server.

  • avatar image
    Former Member
    Jul 03, 2006 at 06:53 AM

    Hi USE FM GUI_DOWNLOAD to transfer your .CSV file to an internal table itab.

    after that use the code to create a file on the application server and transfer the internal table data to the application server file.

    OPEN DATASET p_ofile_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.

    OPEN DATASET p_ofile_file1 FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.

    IF sy-subrc = 0.

    CLEAR: wa_local.

    LOOP AT p_local_table INTO wa_local.

    TRANSFER wa_local TO p_ofile_file.

    CLEAR: wa_local.

    ENDLOOP.

    append p_ofile_file sy-datum to p_ofile_file1

    CLOSE DATASET p_ofile_file.

    CLOSE DATASET p_ofile_file1..

    Add comment
    10|10000 characters needed characters exceeded

  • Jul 03, 2006 at 07:03 AM

    Hi Vikrant,

    have a look here:

    fm-to-rename-files-in-abap

    Andreas

    Add comment
    10|10000 characters needed characters exceeded