Skip to Content
avatar image
Former Member

cg3z t-code

Hi SDNers,

I want to upload an excel file from presentation server to application server using cg3z.

I need step-by-step procedure and i have the following doubts. Please clarify it.

a. Shall i want to do the column width in excel file for the fields which i am going to use in my report.

b. Shall i want to remove the header line (First line) in the excel sheet.

c. In which file format wether ASC/BIN should i want to choose. And also which file will support ASC and which one will support BIN.

d. Where (in which t-code) will i check the uploaded data.

Thanks in advance.

Reward sure for helpful answers.

Senthil kumar

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

4 Answers

  • Best Answer
    Jul 29, 2008 at 09:21 AM

    Hi Senthil,

    I sugest u to upload the file in CSV format.

    Open ur excel=>File=>Save as CSV file.

    Now in CG3Z give presentation and application server file names, Transfer format as ASC and click on enter. Give the application server file extension as .dat for .txt or .csv.

    Now if u want to read the data then use open data set and read data set and close data set statements in ur program.

    a. Shall i want to do the column width in excel file for the fields which i am going to use in my report.
    "Not required
    
    b. Shall i want to remove the header line (First line) in the excel sheet.
    "If u remove the header then u can directly use the internal 
    "table after read dataset. If u upload with header then u have to 
    "delete the first record which is ur header.
    
    c. In which file format wether ASC/BIN should i want to choose. And also which file will support ASC and which one will support BIN.
    "U can use BIN or ASC. Both will work. While downloading 
    "ASC works for 1500 characters line length. so better use BIN
    
    d. Where (in which t-code) will i check the uploaded data.
    "Go to CG3Y, Give both file names, download to .txt or .csv file.
    "U can see the uploaded data.
    
    "If the line length is less than 255 characters u can directly 
    "view the data in transaction AL11
    
    

    Thanks,

    Vinod.

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Senthil,

      It will create the file. There should not be any problem. Probably the file got saved some where else.(Documents and settings) or u might not have permissions to save in C Drive other than ur documents and settings.

      Just download to desktop and see.

      If u want to view it in SAP as i told u can go to AL11 transaction and view it. But it will show till 255 characters only. If it is more than 255 then u have to download n see. There is no other option other than through programming.

      Thanks,

      Vinod.

  • Jul 29, 2008 at 07:48 AM

    Senthil,

    report ztest.
     
    data: begin of itab occurs 0,
    field(256),
    end of itab.
    data: dsn(100) value '/usr/sap/xfr/FIS/testpdf',
    length like sy-tabix,
    lengthn like sy-tabix.
     
    call function 'GUI_UPLOAD'
    exporting
    filename = 'c:\temp\test.pdf'
    filetype = 'BIN'
    importing
    filelength = length
    tables
    data_tab = itab.
     
    open dataset dsn for output in binary mode.
     
    loop at itab.
    transfer itab-field to dsn.
    endloop.
     
    close dataset dsn.
    clear itab.
    refresh itab.
     
     
     
    To crosscheck if it went well 
     
    open dataset dsn for input in binary mode.
     
    do.
    read dataset dsn into itab-field.
    if sy-subrc = 0.
    append itab.
    else.
    exit.
    endif.
    enddo.
     
    call function 'GUI_DOWNLOAD'
    exporting
    filename = 'c:\temp\testn.pdf'
    filetype = 'BIN'
    bin_filesize = length
    importing
    filelength = lengthn
    tables
    data_tab = itab.

    and you can use cg3z for same just explore your self further.

    Amit.

    Add comment
    10|10000 characters needed characters exceeded

  • Jul 29, 2008 at 07:49 AM

    hi,

    give ur filename in presentation server ,give path in application server and click upload.it will be uploaded.

    u can check in AL11 transaction.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jul 29, 2008 at 07:57 AM

    hi check this...

    it is better to use the opendata set rather that using the tcode cg3y....

    Add comment
    10|10000 characters needed characters exceeded