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.
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. -
I deleted my back up files from my external hard drive and my trash won't empty. I get an error code -22. Can anyone tell me how to fix this?
JLCruz wrote:
I deleted my back up files from my external hard drive ...
If this is related to Time Machine Backups...
See here > Should I delete old backups? If so, How?
From Here > http://pondini.org/TM/FAQ.html
If the TRASH still won’t Empty...
See Here > http://pondini.org/TM/E6.html -
How do I extract my music files from a evternal hard drive and put them on my itunes?
how do I extract my music files from a evternal hard drive and put them on my itunes?
If you used the Finder to move the files, iMovie will have lost track of them. iMovie holds the locations of the Event files, and Project files contain references to those locations. If you move the files, iMovie has no way of knowing where they are.
If you can, first move all the files back to their original locations. Plug in the external drive. Open iMovie and move the files in iMovie's interface (help explains how, but basically, just drag and drop in the event pane).
Then you can connect the drive to the new computer, and iMovie will see them. -
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 java client to php
hi
i am trying to upload/send a file from client using swing/applet
and receiving it with php code.
here is the php code which uploads the post file from the client
$uploaddir = "/home/raghavendra/Documents/";
$file = basename( $_FILES["uploadedfile"]["name"]);
echo "file:\n".$file;
$uploadfile = $uploaddir. $file;
if (move_uploaded_file($_FILES["uploadedfile"]["tmp_name"],$uploadfile)) {
echo "File is valid, and was successfully uploaded.\n";
else {
echo "File upload failure Possible file upload attack!\n";
and corresponding different java code which post the
1)
public void postmethodTest(String filefrom){
try{
String hostname = "localhost";
int port = 80;
InetAddress addr = InetAddress.getByName(hostname);
Socket socket = new Socket(addr, port);
// Send header
String path ="/php_prgs/var/www/nsboxng/htdocs/tryupdate.php";
File theFile = new File(filefrom);
System.out.println ("size: " + (int) theFile.length());
DataInputStream fis = new DataInputStream(new BufferedInputStream(new FileInputStream(theFile)));
byte[] theData = new byte[(int) theFile.length( )];
fis.readFully(theData);
fis.close();
DataOutputStream raw = new DataOutputStream(socket.getOutputStream());
Writer wr = new OutputStreamWriter(raw);
String command =
"POST "+path+" HTTP/1.0\r\n"
+ "Content-type: multipart/form-data, boundary=mango\r\n"
+ "Content-length: " + ((int) theFile.length()) + "\r\n"
+ "\r\n"
+ "--mango\r\n"
+ "content-disposition: name=\"MAX_FILE_SIZE\"\r\n"
+ "\r\n"
+ "\r\n--mango\r\n"
+ "content-disposition: attachment; name=\"datafile\"" ;
String filename="test.doc\"\r\n"
+ "Content-Type: text/doc\r\n"
+ "Content-Transfer-Encoding: binary\r\n"
+ "\r\n";
wr.write(command);
wr.flush();
raw.write(theData);
raw.flush( );
wr.write("\r\n--mango--\r\n");
wr.flush( );
BufferedReader rd = new BufferedReader(new
InputStreamReader(socket.getInputStream()));
String line;
while ((line = rd.readLine()) != null) {
System.out.println("out"+line);
wr.close();
raw.close();
socket.close();
} catch (Exception e) {System.out.println(e.toString());}
2)
public void postMethod(String strURL, String filefrom){
try {
String fname = filefrom.substring(filefrom.lastIndexOf("/")+1, filefrom.length());
File input=new File(filefrom);
// Prepare HTTP post
PostMethod post = new PostMethod(strURL);
// Request content will be retrieved directly
// from the input stream
// Per default, the request content needs to be buffered
// in order to determine its length.
// Request body buffering can be avoided when
// content length is explicitly specified
post.setRequestEntity(new InputStreamRequestEntity(new FileInputStream(input), input.length()));
// Specify content type and encoding
// If content encoding is not explicitly specified
// ISO-8859-1 is assumed
//post.setRequestHeader("Content-type", "text/xml; charset=ISO-8859-1");
post.setRequestHeader("Content-Type","multipart/form-data");
post.setRequestHeader("Content-Disposition", "form-data; name="+fname);
// Get HTTP client
HttpClient httpclient = new HttpClient();
// Execute request
try {
int result=httpclient.executeMethod(post);
// Display status code
System.out.println("Response status code: " +result);
// Display response
System.out.println("Response body: ");
// System.out.println(post.getResponseBodyAsString());
BufferedReader console = new BufferedReader(new InputStreamReader(post.getResponseBodyAsStream()));
String name = null;
String line = null;
try {
while ((line = console.readLine()) != null) {
System.out.println("output"+line);
//name = console.readLine();
catch (IOException e) { name = "<" + e + ">"; }
// System.out.println("Hello " + name);
} finally {
// Release current connection to the connection pool
// once you are done
post.releaseConnection();
catch(IOException e){
but am getting else condition response from php code
but if i post with html code it is working fine.
can anybody help me please where i have to change the code
please suggest me. am in a big trouble and i have to complete this as soon as possibleOne thread is enough.
http://forum.java.sun.com/thread.jspa?threadID=5198449
You could have bumped it instead. Also, you still just posted a junk of unformatted stuff. Furthermore, for HttpClient support ask at an HttpClient mailing list of rorum. -
How to upload file from client to server in servlets.
actually in my application i have to upload file from client m/c to server.
it is not possible through file i/p stream as fileStreams does not work on network. Please mail me if you have any solution to this.
Thank's in advance............Haii roshan
Pls go through this thread..
http://forum.java.sun.com/thread.jspa?forumID=45&threadID=616589
regards
Shanu -
How to load files from old external hard drive to new PC
Copied files from old PC (Windows XP) to external hard drive. Purchased new PC (Windows 7). Paid technicians to transfer files from old PC to new PC. Some files were lost in the process.
Please walk me through (step by step) on how to load spicific files from an external hard drive onto my new PC.
Thanx, rp1Click anywhere on the open desktop so that the Finder menus are displayed at the top of the screen.
Click Go > Network
Double click the Time Capsule icon, then double click the icon representing the drive to mount it on the Mac's desktop. It is named "Data" unless you have changed it
You can drag/drop files to the "Data" icon on the desktop
235 GB is going to take forever if you try to do this using wireless. If at all possible, connect an Ethernet cable from your Mac to one of the LAN <-> ports on the Time Capsule.
Even using Ethernet, you are probably looking at 10-12 hours for the file transfer. All bets are off with wireless only, but a guess would be several days....or even more. -
HT2090 how to transfer files from a portable hard drive to another
I tried to transfer some files from one portable hard drive to another but I cant seem to transfer anything.but hard drives are under the NTFS thingy.The brand of the hard drive is WD.pliz help...
Your HDDs are formatted for windows. There is software available that will allow you to use them with your MBP. It has received mixed reviews and you will have to use Google to find it. Perhaps someone else will give you specific information on same.
The other option is to reformat the HDDs to be compatible with your MBP using Disk Utility, but that will erase the user data.
Ciao. -
How to copy files from a removed hard drive
Hi removed my hard drive from my Dv9408nr laptop because the screen won't power on, and but my question is there a way to copy the files from my removed hard drive to another laptop. Is there a cord the fits into the hard drive connector slot to a usb or some other cord that goes to a laptop so I can copy my files to another laptop, so I can recover my files?
Hi,
Something like this should work and you can have an external HDD at the end
http://www.google.com.au/products/catalog?q=hdd+enclosure+2.5+usb+2.0&hl=en&biw=1680&bih=849&prmd=im...#
Regards.
BH
**Click the KUDOS thumb up on the left to say 'Thanks'**
Make it easier for other people to find solutions by marking a Reply 'Accept as Solution' if it solves your problem. -
How to check file name in local c drive and run exe file
Hi All,
I'm newbie user in action script. How can i check sepecific
file name in local c:\ drive and if file doesn't exist in local
drive download from server and run and if exist go to frame ..... .
Please help to me.
Thanks,Dear Marghoob Suleman
Thank you very much for your kind help.
Thanks in advance -
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. -
How to drag file from desktop into Finder window?
I use the four finger gesture to reveal my desktop, then I drag and file and intend to put it in one of the Finder windows that was there before the "reveal desktop" gesture. How do I get the windows to come back while the file is being dragged? There seems to be no hot corner or keyboard shortcut for "unrevealing" the desktop.
Got it! That was SO EASY...thank you very much
-
How to upload file from client to server
Can someone please help.
User needs to browse file on his desktop and upload file using browse button. This file should then be uploaded to the server. I am using javascript in the front end and servlet in the back.
Any help will be highly appreciated.
Thanks,
IndrasishJakarta Commons FileUpload is the standard way of doing the file uploading these days. You can find source, binaries and documentation at the Jakarta Site http://jakarta.apache.org/ . The Commons has a number of subprojects, so start with the Commons libraries, then find FileUpload.
Brian -
Want to upload files from an external hard drive. How does this work?
I am new to the Mac world and have old files from my PC that I want to transfer on to my Time Capsule.
Click anywhere on the open desktop so that the Finder menus are displayed at the top of the screen.
Click Go > Network
Double click the Time Capsule icon, then double click the icon representing the drive to mount it on the Mac's desktop. It is named "Data" unless you have changed it
You can drag/drop files to the "Data" icon on the desktop
235 GB is going to take forever if you try to do this using wireless. If at all possible, connect an Ethernet cable from your Mac to one of the LAN <-> ports on the Time Capsule.
Even using Ethernet, you are probably looking at 10-12 hours for the file transfer. All bets are off with wireless only, but a guess would be several days....or even more.
Maybe you are looking for
-
Problem Saving Gererating GIF Image
Hello, we are having a problem in production environment when try to right mouse and select Print on an mii grid. Works just fine in all of our non-production environments. Checked the System Security pull downs and they all matched non-prod. Was not
-
How Do I Dynamically Update a PDF Textbox Using Excel Like Columns Which Automatically Wrap and Size
I am trying to dynamically display a list rooftop units to which are associated to each product our company produces. Our website is database driven and each product has a link to a PDF file which explains the product, and a "List" of each rooftop un
-
Hi guy, just to share my first experience with a very simple struts application integration (luckily) I've transformed my webapp in a module as stated in http://edocs.bea.com/wlp/docs100/portals/integrate.html#wp1005659 I've got to say that this was
-
How can I reduce the amount of space between paragraphs in Pages?
How can I reduce the amount of space between paragraphs in Pages?
-
Error ORA-12505, TNS:listener does not currently know of SID given in co
Hi , When I am running the jdeveoper for my adf application , I am getting the follwoing error: starting weblogic with Java version: java version "1.6.0_14" Java(TM) SE Runtime Environment (build 1.6.0_14-b08) weblogic.common.ResourceException: weblo