How to Upload files in a directory?
Can any one tell me how to upload a file in my root directory using jsp.
any example, links,script
i want to upload only a small text file (how to restrict size)
Read this tutorial and implement -
http://www.javazoom.net/jzservlets/uploadbean/uploadbean.html
Its easy and effective.
Similar Messages
-
How to upload file from Application Server?
Dear Friends,
How to upload file from Application Server?
Plz. with example...
Regards,
Dharmeshhi,
check the code for upload from application server.
tables: kna1.
types: begin of s_file,
customer type kna1-kunnr,
country type kna1-land1,
name type kna1-name1,
region type kna1-regio,
end of s_file.
*--Internal tables
data: it_file type s_file occurs 0 with header line.
*-- Selection screen
selection-screen: begin of block b1 with frame title text-001.
parameter: p_file type rlgrap-filename default 'C:/customer.txt'
obligatory.
selection-screen: end of block b1.
*-- At selection screen
at selection-screen on value-request for p_file.
perform file_help using p_file.
*-- Process File
start-of-selection.
perform upload_file using p_file.
*-- write File data to o/p
end-of-selection.
perform write_data.
*& Form file_help
form file_help using p_p_file.
data: l_filepath type ibipparms-path.
call function 'F4_FILENAME'
EXPORTING
PROGRAM_NAME = SYST-CPROG
DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = ' '
importing
file_name = l_filepath
p_p_file = l_filepath.
endform. " file_help
*& Form upload_file
form upload_file using p_p_file.
call function 'WS_UPLOAD'
exporting
filename = p_p_file
filetype = 'DAT'
IMPORTING
FILELENGTH =
tables
data_tab = it_file
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 i001.
endif.
endform. " upload_file
*& Form write_data
form write_data .
loop at it_file.
write:/ it_file-customer, it_file-country, it_file-name,
it_file-region.
endloop.
endform.
regards,
keerthi. -
How to upload file in a server
Hi,
How to upload file to server through reporting. Plz guide me and what would be the probable code.
ThanksHi,
Try this Report Program.
*& Report ZUPLOADTAB *
*& Example of Uploading tab delimited file *
REPORT zuploadtab .
PARAMETERS: p_infile LIKE rlgrap-filename
OBLIGATORY DEFAULT '/usr/sap/'..
DATA: ld_file LIKE rlgrap-filename.
*Internal tabe to store upload data
TYPES: BEGIN OF t_record,
name1 like pa0002-VORNA,
name2 like pa0002-name2,
age type i,
END OF t_record.
DATA: it_record TYPE STANDARD TABLE OF t_record INITIAL SIZE 0,
wa_record TYPE t_record.
*Text version of data table
TYPES: begin of t_uploadtxt,
name1(10) type c,
name2(15) type c,
age(5) type c,
end of t_uploadtxt.
DATA: wa_uploadtxt TYPE t_uploadtxt.
*String value to data in initially.
DATA: wa_string(255) type c.
constants: con_tab TYPE x VALUE '09'.
*If you have Unicode check active in program attributes then you will
*need to declare constants as follows:
*class cl_abap_char_utilities definition load.
*constants:
con_tab type c value cl_abap_char_utilities=>HORIZONTAL_TAB.
*START-OF-SELECTION
START-OF-SELECTION.
ld_file = p_infile.
OPEN DATASET ld_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc NE 0.
ELSE.
DO.
CLEAR: wa_string, wa_uploadtxt.
READ DATASET ld_file INTO wa_string.
IF sy-subrc NE 0.
EXIT.
ELSE.
SPLIT wa_string AT con_tab INTO wa_uploadtxt-name1
wa_uploadtxt-name2
wa_uploadtxt-age.
MOVE-CORRESPONDING wa_uploadtxt TO wa_upload.
APPEND wa_upload TO it_record.
ENDIF.
ENDDO.
CLOSE DATASET ld_file.
ENDIF.
*END-OF-SELECTION
END-OF-SELECTION.
*!! Text data is now contained within the internal table IT_RECORD
Display report data for illustration purposes
loop at it_record into wa_record.
write:/ sy-vline,
(10) wa_record-name1, sy-vline,
(10) wa_record-name2, sy-vline,
(10) wa_record-age, sy-vline.
endloop.
Regards,
Padmam. -
How to upload file in webdynpro abap alv
Hello Friends,
how to upload file in webdynpro abap alv
Regards
Narendra
Moderator message: please search for available information, post in correct "Web Dynpro ABAP" forum if still required.
Edited by: Thomas Zloch on Jun 6, 2011 11:55 AMHi Narendra,
You ahve to search before posting. This discussed many times.
You need to use file upload ui element to upload data. and display in alv.
Please go thorugh this..
http://wiki.sdn.sap.com/wiki/display/WDABAP/UploadandDownloadfilesinWebdynproABAP
Re: Upload .xls file in WDABAP
http://forums.sdn.sap.com/click.jspa?searchID=72307893&messageID=5425671
Cheers,
Kris. -
How to upload files to dashboard obiee 11g
hi,
can anyone explain how to upload files to obiee dashboard.
thanks in advance..refer this link .
http://total-bi.com/2011/02/external-files-obiee-dashboard/ -
How to upload file to server physical directory
Dear Sir,
My Software Details:
Oracle9i Release 1
Oracle9iAS 1.0.2.2.2
Solaris 8
I have a web application developed using PL/SQL.
How do i upload a file from user to a server physical directory through Oracle9iAS without storing in database?
I can do this if file is uploaded to a 9ias upload table.
But i'm looking for solution on uploading file straight to the physical server directory.
Please advise.
Thanks.
Regards,
Jap Boon ChurnHi Jap,
You won't be able to do this with modplsql if that is what you are asking. modplsql only uploads file into the database.
With that said, however, you can write your own CGI/Servlet/Perl program that does the uploading of files into the server physical directory. In your program, you will need to handle HTTP POST requests so that you can parse out the file contents and write it out onto the file system.
I am sure there is already some CGI/Servlet/Perl program out there that does this. If you search on Google, you should be able to find some and modify it to your needs. Hope that helps. Thanks.
Eric. -
How to upload file containing Japanese characters in AL11
Hi All,
I'm trying to modify a program that extracts a text file from local drive then upload the file to sap directory. The input text file contains Japanese characters. When I view the file created, it looks like the one below:
#º#®#~#^#ì#q ¼ÓÔ¼·Ï·º
#ì#ç#ß#q ÐÅÐÁÂÞº
The code that I am fixing is below:
open dataset pv_name for output in text mode encoding non-unicode
ignoring conversion errors.
open dataset pv_name for output in legacy text mode code page '8000' ignoring conversion errors.
*OPEN DATASET pv_name FOR OUTPUT IN TEXT MODE ENCODING UTF-8 WITH BYTE-ORDER MARK.
if sy-subrc = 0.
LOOP AT pt_input.
TRANSFER pt_input TO pv_name.
IF SY-SUBRC NE 0.
WRITE:/ 'Error writing file'(011), pv_name.
STOP.
ENDIF.
ENDLOOP.
endif.
Close dataset
CLOSE DATASET pv_name.
Any suggestions on how to resolve this one?
Thanks a lot in advance.I didnt said that this will resolve your errors. But using this is the same of ignoring comiler errors....
As you didnt said anything about codepages you're using no help is possible, you didnt mentioned if your SAP system is Unicode, Non-Unicode or even a MDMP system.
You need to figure out which codepage the file has on the presentation server and which codepage your SAP system is using. And it can be that no conversion is possible cause both systems do not have any character in common. -
How to Import file into sap directory.
Hi all,
I need to import a .XML file into SAP-BW directory from my local pc.
By tcod AL11 I can only display all the directories, but I cannot import/upload this file.
How I Can create my own directory e.g /usr/sap/tmp123
Help me please.
thanks.
Kaustubh.Hi Kaustubh,
Use the FM ARCHIVFILE_CLIENT_TO_SERVER.
Give Filename + path for both the source and destination and your file will get transferred to the specified directory in AL11.
But I am not sure about creating your own directory in AL11.
Reward if helpful.
Regards
Hemant Khemani -
How to upload file from desktop or C drive and send as attachments
Hello Experts,
Please tell me
How to upload jpg or gif or drawing files from desktop or any drive and store into R/3 by the same time I have to send mail as a attachment.
I heard that FM
SO_NEW_DOCUMENT_ATT_SEND_API1 is only to send as a attachment what ever the data is present in the internal table only.
please help me on that.I m using this code its having attachment but I m not able to open the file. Please help me
I m using gui_upload to upload the file
PROGRAM ZTEST
no standard page heading line-size 255.
DATA: xfile TYPE string.
data : t_IW51 LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.
DATA: OBJPACK LIKE SOPCKLSTI1 OCCURS 2 WITH HEADER LINE.
DATA: OBJHEAD LIKE SOLISTI1 OCCURS 1 WITH HEADER LINE.
DATA: OBJBIN LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.
DATA: OBJTXT LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.
DATA: RECLIST LIKE SOMLRECI1 OCCURS 5 WITH HEADER LINE.
DATA: DOC_CHNG LIKE SODOCCHGI1.
DATA: TAB_LINES LIKE SY-TABIX.
data : email type table of BAPIADSMTP.
PARAMETERS : file LIKE rlgrap-filename OBLIGATORY.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR file.
CLEAR file.
CALL FUNCTION 'F4_FILENAME'
IMPORTING
file_name = file.
xfile = file.
START-OF-SELECTION.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = xfile
filetype = 'ASC'
has_field_separator = 'X'
TABLES
data_tab = t_IW51.
Creation of the document to be sent
File Name
DOC_CHNG-OBJ_NAME = 'SENDFILE'.
Mail Subject
DOC_CHNG-OBJ_DESCR = 'Send External Mail'.
Mail Contents
OBJTXT = 'Minimum bid : $250000'.
APPEND OBJTXT.
OBJTXT = 'A representation of the pictures up for auction'.
APPEND OBJTXT.
OBJTXT = 'was included as attachment.'.
APPEND OBJTXT.
DESCRIBE TABLE OBJTXT LINES TAB_LINES.
READ TABLE OBJTXT INDEX TAB_LINES.
DOC_CHNG-DOC_SIZE = ( TAB_LINES - 1 ) * 255 + STRLEN( OBJTXT ).
Creation of the entry for the compressed document
CLEAR OBJPACK-TRANSF_BIN.
OBJPACK-HEAD_START = 1.
OBJPACK-HEAD_NUM = 0.
OBJPACK-BODY_START = 1.
OBJPACK-BODY_NUM = TAB_LINES.
OBJPACK-DOC_TYPE = 'RAW'.
APPEND OBJPACK.
Creation of the document attachment
(Assume that the data in OBJBIN is in BMP format)
*OBJBIN = ' \O/ '. APPEND OBJBIN.
*OBJBIN = ' | '. APPEND OBJBIN.
*OBJBIN = ' / \ '. APPEND OBJBIN.
OBJBIN[] = t_IW51[].
DESCRIBE TABLE OBJBIN LINES TAB_LINES.
OBJHEAD = 'PICTURE.PDF'.
APPEND OBJHEAD.
OBJBIN[] = t_IW51[].
Creation of the entry for the compressed attachment
OBJPACK-TRANSF_BIN = 'X'.
OBJPACK-HEAD_START = 1.
OBJPACK-HEAD_NUM = 1.
OBJPACK-BODY_START = 1.
OBJPACK-BODY_NUM = TAB_LINES.
OBJPACK-DOC_TYPE = 'PDF'.
OBJPACK-OBJ_NAME = 'PICTURE'.
OBJPACK-OBJ_DESCR = 'Representation of object 138'.
OBJPACK-DOC_SIZE = TAB_LINES * 255.
APPEND OBJPACK.
Completing the recipient list
RECLIST-RECEIVER = 'email_id have to enter here'.
RECLIST-REC_TYPE = 'U'.
APPEND RECLIST.
RECLIST-RECEIVER = 'ENTEG01'.
RECLIST-REC_TYPE = 'P'.
APPEND RECLIST.
Sending the document
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
DOCUMENT_DATA = DOC_CHNG
PUT_IN_OUTBOX = 'X'
commit_work = 'X'
TABLES
PACKING_LIST = OBJPACK
OBJECT_HEADER = OBJHEAD
CONTENTS_BIN = OBJBIN
CONTENTS_TXT = OBJTXT
RECEIVERS = RECLIST
*EXCEPTIONS
TOO_MANY_RECEIVERS = 1
DOCUMENT_NOT_SENT = 2
OPERATION_NO_AUTHORIZATION = 4
*OTHERS = 99.
CASE SY-SUBRC.
WHEN 0.
WRITE: / 'Result of the send process:'.
LOOP AT RECLIST.
WRITE: / RECLIST-RECEIVER(48), ':'.
IF RECLIST-RETRN_CODE = 0.
WRITE 'The document was sent'.
ELSE.
WRITE 'The document could not be sent'.
ENDIF.
ENDLOOP.
WHEN 1.
WRITE: / 'No authorization for sending to the specified number',
'of recipients'.
WHEN 2.
WRITE: / 'Document could not be sent to any recipient'.
WHEN 4.
WRITE: / 'No send authorization'.
WHEN OTHERS.
WRITE: / 'Error occurred while sending'.
ENDCASE. -
How to upload file from a client machine to server machine
hei evryone!
can anyone pls help me on how i can upload file from a client machine to another machine (or server). using jsp.Then later on, i can also retrieve the names of these files to place it as values for option tag in an html form.I have a seperate screen for uploading the file and the screen for displaying all the files that were uploaded on the server...
any sample code/ ideas would be much appreciated.Thx!!!!hei evryone!
can anyone pls help me on how i can upload file from a client machine to another machine (or server). using jsp.Then later on, i can also retrieve the names of these files to place it as values for option tag in an html form.I have a seperate screen for uploading the file and the screen for displaying all the files that were uploaded on the server...
any sample code/ ideas would be much appreciated.Thx!!!! -
How to upload file from one machine (windows) to another (linux)through cre
How to upload a file from windows platform to linux platform.
on both platforms sun app server is running.
from creator is there any methode to open ftp port and uploadhttp://www.google.com/search?q=jdbc+blob
Blob processing varies between databases; see also examples for whatever database you are using, e.g.
http://www.google.com/search?q=jdbc+blob+oracle
If you are storing text data instead of binary data, replace "blob" by "clob" in the searches. -
Upload file to global directory in Dev, Q&A and Prod!
I have an upload application in BSP, that uploads files to for example /usr/sap/BWD/files
this works in Development, but of course this directory is not available in Production, so BSP won't work there.
Isn't it possible to use one global directory?
Right now somebody created for us a directory, that's the same on all 3 systems (Dev, Q, and Production)
this dir is
on Development: DIR_TRANS /usr/sap/transBW
on Quality: DIR_TRANS /usr/sap/transBW
on Production: DIR_TRANS /usr/sap/trans
notice the small difference in path in Production... Is there a way to use the DIR_TRANS instead of the real path?
my application writes data like this:
fname = '/usr/sap/CBD/files/FILE.CSV'.
OPEN DATASET fname FOR OUTPUT in TEXT MODE encoding default.
if sy-subrc gt 0.
WRITE: / 'Error opening file'.
endif.
LOOP AT data_TAB INTO LIN.
TRANSFER LIN TO FNAME.
ENDLOOP.
CLOSE DATASET FNAME.
thanks a lot, points will be rewarded for usefull answers!
thanks!use transaction FILE to create logical path for the actual file path.
and then use FM
call function 'FILE_GET_NAME'
exporting
client = sy-mandt
logical_filename = pil_file "Input logical file name
operating_system = sy-opsys
importing
file_name = p_i_file "Physical file name
exceptions
file_not_found = 1
others = 2.
Regards
Raja -
How to upload files residing in a folder on local file system .
Hi, I have a problem when trying to upload files.
I have a folder in my local system and have n files in it. Now if i use the file upload element i need to click n times to upload these files. So i want to achieve programatically to upload all the files in a folder given the folder name to the application. Is this possible or is there any restriction to achieve this through webdynpro.
Also how to know programatically all the names of files and folders in a particular folder during web dynpro session.
Regards,
Vinay.Hi Vinayaka,
Watch these links..
Uploading multiple files using the FileUpload UI element
Files...
Regards,
Karthick K Eswaran
Display files in web browser -
How to store file into a directory?
i want to save the file(text file) into the directory which i have created using File object in the codes below. how do i do it?
public void saveString(String filename, String string)
//declare textfile to be null
PrintWriter textFile = null;
String line = null;
try {
// writes to write.txt
textFile = new PrintWriter (new FileWriter(filename,true));
line = string;
// save string in textfile
textFile.println(line);
textFile.close();
// create a directory (to store (output).xml file)
File fobj = new File("Testing");
fobj.mkdir();
catch (IOException e) {
System.out.println("Error in opening file");
System.exit(0);
}create the directory first and then create the file u want liek this
File f = new File (fobj,filename);
and then open the fiel to write like this
textFile = new PrintWriter (new FileWriter(f,true));
regards
rohan -
How to upload file to the R/3 server
Hi Experts,
I need to upload scanned documents to the R/3 server.I am using File upload UI element. can anybody tell me how to upload to a server.And at the same time how to download the uploaded content.
Awaiting for the reply.
Regards,
Ramanan.P
Edited by: Ramanan Panchabakesan on Sep 9, 2008 2:14 PMstoring:
The data of your uploaded document is stored in your context node.
Read this data, turn it into a table with one of the SCMS* functions.
store it in a table, or write it into a file. Whichever you choose.
downloading again:
read all data from your table or file
turn it into an xstring using one of the SMCS* functions
put the xstring in the context node bound to your downloadfile element
The principle is deadsimple. The only thing that really matters is where you want to store the file. And that is more of technical ABAP R/3 question, if not a functional question than a webdynpro for abap one.
Maybe you are looking for
-
Plug-in or rcp - Using ViewPart
I'm programming a eclipse plug-in and I need to do a particular thing. I have a action toolbar controlled by the class that implement IWorkbenchWindowActionDelegate; this toolbar have 1 button. Also I have one view that implement ViewPart; this view
-
No matter which program I use to sync my music (WMP, Creative Media Solutions, or the Zen Media Organizer), the songs always come up on my player organized by genre. This is a difficult and frustrating way to search for songs. Can I sort and organize
-
Why is my wireless network not found?
I have just installed HP Deskjet F4500 on my PC. I want to connect to my wireless network connection but it keeps telling me "wireless network not found". (I am using my wireless so I know that the wireless connection is fine.) I have all correct det
-
HT201272 download previously purchased music to your iTunes
My issue is how do I get my past purchases to show on my iTunes purchase area???? This is where I have my problem???
-
Question: plz help in this
hi, in XI how we will maintain for a perticular file for example at a particular time.like the poll interval if maintained at 30sec the porocessor will check the record for every 30sec but if we want to schedule at 12:00 every day to check for the re