Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

cg3z t-code

Former Member
0 Kudos

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

1 ACCEPTED SOLUTION

vinod_vemuru2
Active Contributor
0 Kudos

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.

8 REPLIES 8

former_member181995
Active Contributor
0 Kudos

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.

GauthamV
Active Contributor
0 Kudos

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.

Former Member
0 Kudos

hi check this...

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

vinod_vemuru2
Active Contributor
0 Kudos

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.

0 Kudos

hi,

CSV file is not accepting in CG3Z t-code.

what to do?

0 Kudos

Hi Senthil,

It do accept. But by default in search help it shows only .DAT files. Press F4 in presentation server file, In the Files of TYPE dropdown just select all files. It shows CSV files as well.

Check this and get back incase of any issues.

Thanks,

Vinod.

Edited by: Vinod Reddy Vemuru on Jul 29, 2008 5:00 PM

0 Kudos

hi,

its uploaded successfully. but if i download it from CG3Y, it wont create any file in the c drive.

how can i check the data in SAP itself?

0 Kudos

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.