How to Download JPEG file?
Hi.
I have one Jsp Page. I needed to provide a facility to download an jpeg image. For that i write one link. On that link i give path of that image, so instead of giving a option to save or open, a browser open it in browse. No i want to donwload, save that image when user click on that link. So it is possible? and if yes then can anyone provoide me little help.
Well, first it would depend on DRM protection (copyrights of the author) whether you can legally download it at all.
Aside from that, you would also have to automate your Mac to be on that very specific website, connected to the internet, with the mouse choosing which specific image you want to download (as websites can contain many images).
Similar Messages
-
How to download a file from a folder
hello frnds.. i've uploaded a file to a folder in tomcat server. Now how to download that file at the client side.. pls help me out... it would be better if you gimme the related code for it..
Create a link to it.
EG:
Link
Here I asked a similar question a while back. Link
Edited by: gtRpr on 2008/12/15 10:08 -
How to download a file version from office 365 using csom
I need to download an older file version from office 365 and get the data into a byte array. I have no trouble downloading the latest version with File.OpenBinaryStream() and I have no trouble loading the previous file versions with File.Versions. But now
I need to actually download an older version of the file and it seems the only way is to use File.OpenBinaryDirect. So I am creating a client context using my oAuth access token and providing the correct path, but I am getting a (401) Unauthorized
error. Looking with Fiddler I can see that the call to OpenBinaryDirect is somehow trying to post to my file URL and the server is responding with 401.
context = TokenHelper.GetClientContextWithAccessToken(SPHostUrl, AccessToken);
FileInformation info = File.OpenBinaryDirect(context, "/" + _fileVersion.Url); //throws 401
//leading slash required otherwise ArgumentOutOfRangeException
I have to be able to access the older file versions with my c# code -- I don't have a viable app without that ability -- any help urgently needed and greatly appreciated!Thank you SO much (Can't wait for the next release)!
For anyone else who lands here, here's the code I ended up using:
// VersionAccessUser and VersionAccessPassword are stored in web.config
// web.Url is loaded via the clientContext
// myVersion is the FileVersion I got from the file's Versions.GetById() method
// probably a lot of ways to get hostUrl, it just needs to be https://yourdomain.sharepoint.com/
// - I'm running my app from a subweb
// I had trouble following the links to get the full MsOnlineClaimsHelper code
// (the one on msdn.com was missing RequestBodyWriter, WSTrustFeb2005ContractClient,
// and IWSTrustFeb2005Contract
// so I've included the code I used here.
string myVersionFullUrl = string.Format("{0}/{1}", web.Url, myVersion.Url);
string userName = WebConfigurationManager.AppSettings.Get("VersionAccessUser");
string strPassword = WebConfigurationManager.AppSettings.Get("VersionAccessPassword");
string hostUrl = Regex.Replace(web.Url, "([^/]+//[^/]+/).*", "$1");
MsOnlineClaimsHelper claimsHelper = new MsOnlineClaimsHelper(hostUrl, userName, strPassword);
var client = new WebClient();
client.Headers["Accept"] = "/";
client.Headers.Add(HttpRequestHeader.UserAgent, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)");
client.Headers.Add(HttpRequestHeader.Cookie, claimsHelper.CookieContainer.GetCookieHeader(new Uri(hostUrl)));
var document = client.DownloadString(myVersionFullUrl);
// These classes are needed to download old versions of files (see: http://social.msdn.microsoft.com/Forums/en-US/7746d857-d351-49cc-b2f0-496663239e02/how-to-download-a-file-version-from-office-365-using-csom?forum=sharepointdevelopment)
// I cobbled this file from http://social.technet.microsoft.com/Forums/msonline/en-US/4e304493-7ddd-4721-8f46-cb7875078f8b/problem-logging-in-to-office-365-sharepoint-online-from-webole-hosted-in-the-cloud?forum=onlineservicessharepoint
// and http://fredericloud.com/2011/01/11/connecting-to-sharepoint-with-claims-authentication/
using Microsoft.IdentityModel.Protocols.WSTrust;
using Microsoft.SharePoint.Client;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Security;
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.Text;
using System.Web;
using System.Xml;
using System.Xml.Linq;
namespace DPSiDoxAppWeb.Helpers
/// <summary>
/// Create a new contract to use for issue claims for the SharePoint requests
/// </summary>
[ServiceContract]
public interface IWSTrustFeb2005Contract
[OperationContract(ProtectionLevel = ProtectionLevel.EncryptAndSign,
Action = "http://schemas.xmlsoap.org/ws/2005/02/trust/RST/Issue",
ReplyAction = "http://schemas.xmlsoap.org/ws/2005/02/trust/RSTR/Issue",
AsyncPattern = true)]
IAsyncResult BeginIssue(Message request, AsyncCallback callback, object state);
Message EndIssue(IAsyncResult asyncResult);
/// <summary>
/// Implement the client contract for the new type
/// </summary>
public class WSTrustFeb2005ContractClient : ClientBase<IWSTrustFeb2005Contract>, IWSTrustFeb2005Contract
public WSTrustFeb2005ContractClient(Binding binding, EndpointAddress remoteAddress)
: base(binding, remoteAddress)
public IAsyncResult BeginIssue(Message request, AsyncCallback callback, object state)
return Channel.BeginIssue(request, callback, state);
public Message EndIssue(IAsyncResult asyncResult)
return Channel.EndIssue(asyncResult);
/// <summary>
/// Create a class that will serialize the token into the request
/// </summary>
class RequestBodyWriter : BodyWriter
readonly WSTrustRequestSerializer _serializer;
readonly RequestSecurityToken _rst;
/// <summary>
/// Constructs the Body Writer.
/// </summary>
/// <param name="serializer">Serializer to use for serializing the rst.</param>
/// <param name="rst">The RequestSecurityToken object to be serialized to the outgoing Message.</param>
public RequestBodyWriter(WSTrustRequestSerializer serializer, RequestSecurityToken rst)
: base(false)
if (serializer == null)
throw new ArgumentNullException("serializer");
_serializer = serializer;
_rst = rst;
/// <summary>
/// Override of the base class method. Serializes the rst to the outgoing stream.
/// </summary>
/// <param name="writer">Writer to which the rst should be written.</param>
protected override void OnWriteBodyContents(XmlDictionaryWriter writer)
_serializer.WriteXml(_rst, writer, new WSTrustSerializationContext());
public class MsOnlineClaimsHelper
#region Properties
readonly string _username;
readonly string _password;
readonly bool _useRtfa;
readonly Uri _host;
CookieContainer _cachedCookieContainer = null;
DateTime _expires = DateTime.MinValue;
#endregion
#region Constructors
public MsOnlineClaimsHelper(string host, string username, string password)
: this(new Uri(host), username, password)
public MsOnlineClaimsHelper(Uri host, string username, string password)
_host = host;
_username = username;
_password = password;
_useRtfa = true;
public MsOnlineClaimsHelper(Uri host, string username, string password, bool useRtfa)
_host = host;
_username = username;
_password = password;
_useRtfa = useRtfa;
#endregion
#region Constants
public const string office365STS = "https://login.microsoftonline.com/extSTS.srf";
public const string office365Login = "https://login.microsoftonline.com/login.srf";
public const string office365Metadata = "https://nexus.microsoftonline-p.com/federationmetadata/2007-06/federationmetadata.xml";
public const string wsse = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd";
public const string wsu = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd";
private const string userAgent = "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)";
#endregion
class MsoCookies
public string FedAuth { get; set; }
public string rtFa { get; set; }
public DateTime Expires { get; set; }
public Uri Host { get; set; }
// Method used to add cookies to CSOM
public void clientContext_ExecutingWebRequest(object sender, WebRequestEventArgs e)
e.WebRequestExecutor.WebRequest.CookieContainer = getCookieContainer();
//e.WebRequestExecutor.WebRequest.UserAgent = userAgent;
// Creates or loads cached cookie container
CookieContainer getCookieContainer()
if (_cachedCookieContainer == null || DateTime.Now > _expires)
// Get the SAML tokens from SPO STS (via MSO STS) using fed auth passive approach
MsoCookies cookies = getSamlToken();
if (cookies != null && !string.IsNullOrEmpty(cookies.FedAuth))
// Create cookie collection with the SAML token
_expires = cookies.Expires;
CookieContainer cc = new CookieContainer();
// Set the FedAuth cookie
Cookie samlAuth = new Cookie("FedAuth", cookies.FedAuth)
Expires = cookies.Expires,
Path = "/",
Secure = cookies.Host.Scheme == "https",
HttpOnly = true,
Domain = cookies.Host.Host
cc.Add(samlAuth);
if (_useRtfa)
// Set the rtFA (sign-out) cookie, added march 2011
Cookie rtFa = new Cookie("rtFA", cookies.rtFa)
Expires = cookies.Expires,
Path = "/",
Secure = cookies.Host.Scheme == "https",
HttpOnly = true,
Domain = cookies.Host.Host
cc.Add(rtFa);
_cachedCookieContainer = cc;
return cc;
return null;
return _cachedCookieContainer;
public CookieContainer CookieContainer
get
if (_cachedCookieContainer == null || DateTime.Now > _expires)
return getCookieContainer();
return _cachedCookieContainer;
private MsoCookies getSamlToken()
MsoCookies ret = new MsoCookies();
try
var sharepointSite = new
Wctx = office365Login,
Wreply = _host.GetLeftPart(UriPartial.Authority) + "/_forms/default.aspx?wa=wsignin1.0"
//get token from STS
string stsResponse = getResponse(office365STS, sharepointSite.Wreply);
// parse the token response
XDocument doc = XDocument.Parse(stsResponse);
// get the security token
var crypt = from result in doc.Descendants()
where result.Name == XName.Get("BinarySecurityToken", wsse)
select result;
// get the token expiration
var expires = from result in doc.Descendants()
where result.Name == XName.Get("Expires", wsu)
select result;
ret.Expires = Convert.ToDateTime(expires.First().Value);
HttpWebRequest request = createRequest(sharepointSite.Wreply);
byte[] data = Encoding.UTF8.GetBytes(crypt.FirstOrDefault().Value);
using (Stream stream = request.GetRequestStream())
stream.Write(data, 0, data.Length);
stream.Close();
using (HttpWebResponse webResponse = request.GetResponse() as HttpWebResponse)
// Handle redirect, added may 2011 for P-subscriptions
if (webResponse.StatusCode == HttpStatusCode.MovedPermanently)
HttpWebRequest request2 = createRequest(webResponse.Headers["Location"]);
using (Stream stream2 = request2.GetRequestStream())
stream2.Write(data, 0, data.Length);
stream2.Close();
using (HttpWebResponse webResponse2 = request2.GetResponse() as HttpWebResponse)
ret.FedAuth = webResponse2.Cookies["FedAuth"].Value;
ret.rtFa = webResponse2.Cookies["rtFa"].Value;
ret.Host = request2.RequestUri;
else
ret.FedAuth = webResponse.Cookies["FedAuth"].Value;
ret.rtFa = webResponse.Cookies["rtFa"].Value;
ret.Host = request.RequestUri;
catch (Exception ex)
return null;
return ret;
static HttpWebRequest createRequest(string url)
HttpWebRequest request = HttpWebRequest.Create(url) as HttpWebRequest;
request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded";
request.CookieContainer = new CookieContainer();
request.AllowAutoRedirect = false; // Do NOT automatically redirect
request.UserAgent = userAgent;
return request;
private string getResponse(string stsUrl, string realm)
RequestSecurityToken rst = new RequestSecurityToken
RequestType = WSTrustFeb2005Constants.RequestTypes.Issue,
AppliesTo = new EndpointAddress(realm),
KeyType = WSTrustFeb2005Constants.KeyTypes.Bearer,
TokenType = Microsoft.IdentityModel.Tokens.SecurityTokenTypes.Saml11TokenProfile11
WSTrustFeb2005RequestSerializer trustSerializer = new WSTrustFeb2005RequestSerializer();
WSHttpBinding binding = new WSHttpBinding();
binding.Security.Mode = SecurityMode.TransportWithMessageCredential;
binding.Security.Message.ClientCredentialType = MessageCredentialType.UserName;
binding.Security.Message.EstablishSecurityContext = false;
binding.Security.Message.NegotiateServiceCredential = false;
binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.None;
EndpointAddress address = new EndpointAddress(stsUrl);
using (WSTrustFeb2005ContractClient trustClient = new WSTrustFeb2005ContractClient(binding, address))
trustClient.ClientCredentials.UserName.UserName = _username;
trustClient.ClientCredentials.UserName.Password = _password;
Message response = trustClient.EndIssue(
trustClient.BeginIssue(
Message.CreateMessage(
MessageVersion.Default,
WSTrustFeb2005Constants.Actions.Issue,
new RequestBodyWriter(trustSerializer, rst)
null,
null));
trustClient.Close();
using (XmlDictionaryReader reader = response.GetReaderAtBodyContents())
return reader.ReadOuterXml(); -
How to download a file from database
Hi,
My flex application contains a form that uploads a file into the server. This file is however saved in the database, and not on the disk. Most of the tutorials in the database explains how to download a file by passing the file's url to the "download" function of the fileReference Object. That dsnt work for me as my file is saved in the database.
How do I download this file from the server ?
For example, in php, we would do smthing like this :
$content = $file_to_download['content'];
$size = $file_to_download['content_size'];
$type = $file_to_download['content_type'];
$name = $file_to_download['filename'];
header("Content-type:$type");
header("Content-length:$size");
header("Content-Disposition:attachment;filename=$name");
header("Content-Description:PHP Generated Data");
echo $content;
When executing this file, it opens up the "download file" dialog box. How do i get the same effect in flex 4 ?You need the bytes use FileReference.download() and after download you can save
it on disk with FileReference.save(); You also need FP 10 at least I think. Use
the docs they are less error pron than mi memory :).
C -
How to Download a file from remote system.
Hi,
If anybody knows how to download a file directly from database to localdirectoryI have data in a blob column of one table.
from a html page if i click download link then a download dialog box shoud come saying save and cancle etc ., the blobdata from database should be retrived and stored in desired loaction in client system. -
How to download a file from the net and save it into .txt format in a datab
Can some one show me a tutorial on how to download a file from the net and save it into .txt format in a database?
Thank you,http://java.sun.com/docs/books/tutorial/networking/urls/readingWriting.html
-
How to download a file from Path specifed
Hi Frndz..
How to download a file from a specified path like , i have a file on server in the path like "C://temp/Sap.pdf"
I want to download this to user desktop..
Thanks in Advance
regards
RajeshHi,
For file down load u have to use a UI element as "File download".
u just create context attribute as setdownload_res and file data.
setdownload_res as of type "com.sap.ide.webdynpro.uielementdefinitions.Resource" then bound it to the ui element "resource".
file data as of type "com.sap.tc.webdynpro.progmodel.api.IWDInputStream"
and set calcuclated as true and read only as true.
then in doinit method u just write this code
IWDAttributePointer attr = wdContext.currentContextElement().getAttributePointer("fileData");
IWDResource res = WDResourceFactory.createResource(attr,null,WDWebResourceType.UNKNOWN);
wdContext.currentContextElement().setDownload_res(res);
wdComponentAPI.getMessageManager().reportSuccess(""+c);
after this in the getter method u write this code
IWDInputStream stream = null;
try
stream = WDResourceFactory.createInputStream(new FileInputStream(new File("<pathof the file to be download>")));
catch(Exception e)
e.printStackTrace();
return stream;
also look at this thread How to DownLoad any type of File from the server(PDF,XLS,Word)
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/202a850a-58e0-2910-eeb3-bfc3e081257f
PradeeP -
How to download a file from the internet using terminal
how to download a file from the internet using terminal
does any one know how to download afile from the internet using the Terminal application?Use curl. Something like this:
curl -O http://www.example.com/filename.zip
For more info, type +man curl+. -
How to download a file from AL11 inot Excel format without collapse the col
Hi,
Please suggest how to download a file from AL11 to Excel sheet.currenlty all field are merging into single column.I writing this file via using DATASET.
Regards
RickyHi,
Try this code,
==============================================
TYPES : BEGIN OF ty_emp,
empno(2) TYPE c,
empid(10) TYPE c,
empname(3) TYPE c,
END OF ty_emp.
DATA : it_emp TYPE TABLE OF ty_emp,
wa_emp TYPE ty_emp.
DATA : pbk TYPE string.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS : p_file TYPE rlgrap-filename.
PARAMETERS : p_asfile TYPE rlgrap-filename.
SELECTION-SCREEN END OF BLOCK b1.
pbk = p_file.
OPEN DATASET p_asfile FOR INPUT IN TEXT MODE ENCODING DEFAULT.
DO.
READ DATASET p_asfile INTO wa_emp.
IF sy-subrc <> 0.
EXIT.
ENDIF.
APPEND wa_emp TO it_emp.
ENDDO.
CLOSE DATASET p_asfile.
Filling the already created file with download PS radiobutton
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE =
filename = pbk
FILETYPE = 'ASC'
append = 'X'
write_field_separator = ' '
HEADER = '00'
TRUNC_TRAILING_BLANKS = ' '
WRITE_LF = 'X'
COL_SELECT = ' '
COL_SELECT_MASK = ' '
DAT_MODE = ' '
IMPORTING
FILELENGTH =
TABLES
data_tab = it_emp
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
==============================================
Regards,
Krrishna -
How to capture JPEG files by using camera
Hi, now I have a problem, I need your help, I am trying to use a camera that capture JPEG files from camera, I have used those related classes(JMF), but I still can not capture any JPEG files from it.
Although there are some examples about the video capture(just for mov or avi files), it does not mention how to capture JPEG files.
Thank you for your help!I have the same problem.
please,help us. -
How to convert jpeg files into word
How to convert jpeg files into Word
Hi Eugene,
I don't think you can convert an image to a Word document, but you could place the JPEG into a Word document using the Insert > Object command in Word.
For other questions relating to Word, you will probably have more luck getting an answer if you post on the Microsoft forums (we can help if you're using Acrobat, or another Adobe product, but you'll find the Word experts on the Microsoft forums.)
Best,
Sara -
How to download installation file in Russian CS 5.5 Design Standard
How to download installation file in Russian CS 5.5 Design Standard
Arussy if you purchased the software from Adobe directly then please see http://forums.adobe.com/thread/1006208?tstart=0&promoid=KBHJQ for information on how to download your purchased software.
-
How to Download XML File to internal table
Hi Friends,
This is my urgent requirement. How to download XML File to Internal table.
regards
pauldharmaHai,
Please check this Link
http://www.sap-img.com/abap/upload-direct-excel.htm
PARAMETERS: filename LIKE rlgrap-filename MEMORY ID M01,
begcol TYPE i DEFAULT 1 NO-DISPLAY,
begrow TYPE i DEFAULT 1 NO-DISPLAY,
endcol TYPE i DEFAULT 100 NO-DISPLAY,
endrow TYPE i DEFAULT 32000 NO-DISPLAY.
* Tick don't append header
PARAMETERS: kzheader AS CHECKBOX.
DATA: BEGIN OF intern OCCURS 0.
INCLUDE STRUCTURE alsmex_tabline.
DATA: END OF intern.
DATA: BEGIN OF intern1 OCCURS 0.
INCLUDE STRUCTURE alsmex_tabline.
DATA: END OF intern1.
DATA: BEGIN OF t_col OCCURS 0,
col LIKE alsmex_tabline-col,
size TYPE i.
DATA: END OF t_col.
DATA: zwlen TYPE i,
zwlines TYPE i.
DATA: BEGIN OF fieldnames OCCURS 3,
title(60),
table(6),
field(10),
kz(1),
END OF fieldnames.
* No of columns
DATA: BEGIN OF data_tab OCCURS 0,
value_0001(50),
value_0002(50),
value_0003(50),
value_0004(50),
value_0005(50),
value_0006(50),
value_0007(50),
value_0008(50),
value_0009(50),
value_0010(50),
value_0011(50),
value_0012(50),
value_0013(50),
value_0014(50),
value_0015(50),
value_0016(50),
value_0017(50),
value_0018(50),
value_0019(50),
value_0020(50),
value_0021(50),
value_0022(50),
value_0023(50),
value_0024(50),
value_0025(50),
value_0026(50),
value_0027(50),
value_0028(50),
value_0029(50),
value_0030(50),
value_0031(50),
value_0032(50),
value_0033(50),
value_0034(50),
value_0035(50),
value_0036(50),
value_0037(50),
value_0038(50),
value_0039(50),
value_0040(50),
value_0041(50),
value_0042(50),
value_0043(50),
value_0044(50),
value_0045(50),
value_0046(50),
value_0047(50),
value_0048(50),
value_0049(50),
value_0050(50),
value_0051(50),
value_0052(50),
value_0053(50),
value_0054(50),
value_0055(50),
value_0056(50),
value_0057(50),
value_0058(50),
value_0059(50),
value_0060(50),
value_0061(50),
value_0062(50),
value_0063(50),
value_0064(50),
value_0065(50),
value_0066(50),
value_0067(50),
value_0068(50),
value_0069(50),
value_0070(50),
value_0071(50),
value_0072(50),
value_0073(50),
value_0074(50),
value_0075(50),
value_0076(50),
value_0077(50),
value_0078(50),
value_0079(50),
value_0080(50),
value_0081(50),
value_0082(50),
value_0083(50),
value_0084(50),
value_0085(50),
value_0086(50),
value_0087(50),
value_0088(50),
value_0089(50),
value_0090(50),
value_0091(50),
value_0092(50),
value_0093(50),
value_0094(50),
value_0095(50),
value_0096(50),
value_0097(50),
value_0098(50),
value_0099(50),
value_0100(50).
DATA: END OF data_tab.
DATA: tind(4) TYPE n.
DATA: zwfeld(19).
FIELD-SYMBOLS: <fs1>.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR filename.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
mask = '*.xls'
static = 'X'
CHANGING
file_name = filename.
START-OF-SELECTION.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = filename
i_begin_col = begcol
i_begin_row = begrow
i_end_col = endcol
i_end_row = endrow
TABLES
intern = intern
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
OTHERS = 3.
IF sy-subrc <> 0.
WRITE:/ 'Upload Error ', SY-SUBRC.
ENDIF.
END-OF-SELECTION.
LOOP AT intern.
intern1 = intern.
CLEAR intern1-row.
APPEND intern1.
ENDLOOP.
SORT intern1 BY col.
LOOP AT intern1.
AT NEW col.
t_col-col = intern1-col.
APPEND t_col.
ENDAT.
zwlen = strlen( intern1-value ).
READ TABLE t_col WITH KEY col = intern1-col.
IF sy-subrc EQ 0.
IF zwlen > t_col-size.
t_col-size = zwlen.
* Internal Table, Current Row Index
MODIFY t_col INDEX sy-tabix.
ENDIF.
ENDIF.
ENDLOOP.
DESCRIBE TABLE t_col LINES zwlines.
SORT intern BY row col.
IF kzheader = 'X'.
LOOP AT intern.
fieldnames-title = intern-value.
APPEND fieldnames.
AT END OF row.
EXIT.
ENDAT.
ENDLOOP.
ELSE.
DO zwlines TIMES.
WRITE sy-index TO fieldnames-title.
APPEND fieldnames.
ENDDO.
ENDIF.
SORT intern BY row col.
LOOP AT intern.
IF kzheader = 'X'
AND intern-row = 1.
CONTINUE.
ENDIF.
tind = intern-col.
CONCATENATE 'DATA_TAB-VALUE_' tind INTO zwfeld.
ASSIGN (zwfeld) TO <fs1>.
<fs1> = intern-value.
AT END OF row.
APPEND data_tab.
CLEAR data_tab.
ENDAT.
ENDLOOP.
CALL FUNCTION 'DISPLAY_BASIC_LIST'
EXPORTING
file_name = filename
TABLES
data_tab = data_tab
fieldname_tab = fieldnames.
*-- End of Program
http://sap.ittoolbox.com/groups/technical-functional/sap-dev/excel-file-download-to-an-internal-table-in-sap-crm-1719453#
tables: zinv_release,
zpo_release.
** decleration of data
DATA: BEGIN OF my_tab OCCURS 0.
INCLUDE STRUCTURE zinv_release.
DATA: END OF my_tab.
*DATA: hex_tab TYPE x VALUE '09'.
DATA: rec(200)."'/usr/test.dat'.
DATA:
zhours(20) TYPE c,
MINS(20) type c. "decimals.
data: coma.
coma = ','.
SELECTION-SCREEN BEGIN OF BLOCK txt
WITH FRAME TITLE text-001.
PARAMETERS: dsn(60) DEFAULT '\\sapdev01\prod\'.
SELECTION-SCREEN END
OF BLOCK txt.
*using a dataset to get text
OPEN DATASET dsn FOR INPUT IN TEXT MODE.
IF sy-subrc = 0.
DO.
READ DATASET dsn INTO rec.
IF sy-subrc <> 0.
EXIT.
ENDIF.
split rec at coma into
zpo_release-REL_GRP
zpo_release-REL_CODE
zpo_release-RESPREL
zpo_release-ALTREL
zpo_release-MANAGER
ZHOURS
MINS
zpo_release-FROMTIME
zpo_release-TOTIME
zpo_release-EXCLWKENDS.
move zpo_release-REL_GRP to my_tab-REL_GRP.
move zpo_release-REL_CODE to my_tab-REL_CODE.
move zpo_release-RESPREL to my_tab-RESPREL.
move zpo_release-ALTREL to my_tab-ALTREL.
move zpo_release-MANAGER to my_tab-MANAGER.
move ZHOURS to my_tab-ZHOURS.
move MINS to my_tab-mins.
move zpo_release-FROMTIME to my_tab-fromtime.
move zpo_release-TOTIME to my_tab-totime.
move zpo_release-EXCLWKENDS to my_tab-exclwkends.
APPEND my_tab.
ENDDO.
INSERT zpo_release FROM TABLE my_tab ACCEPTING DUPLICATE KEYS.
** DELETE zmm_ppa_cc FROM TABLE tab.
** INSERT zzzak_emp FROM TABLE my_tab ACCEPTING DUPLICATE KEYS.
IF sy-subrc = 0.
MESSAGE i000(zv) WITH 'File Successful stored in DB.' '' '' ''.
** ELSE.
MESSAGE i000(zv) WITH 'File already stored in DB.' '' '' ''.
endif.
ENDIF.
reward if helpful
raam -
How to download XML file to ITAB
hi friends
this is my urgent req. how to download XML file to Local itab
any other function or sample program available.
with luv.
pauldharmaHi,
please check this code.
Uploading Excel file to SAP Using Function Module ALSM_EXCEL_TO_INTERNAL_TABLE
REPORT ZEXCELUPLOAD.
PARAMETERS: filename LIKE rlgrap-filename MEMORY ID M01,
begcol TYPE i DEFAULT 1 NO-DISPLAY,
begrow TYPE i DEFAULT 1 NO-DISPLAY,
endcol TYPE i DEFAULT 100 NO-DISPLAY,
endrow TYPE i DEFAULT 32000 NO-DISPLAY.
* Tick don't append header
PARAMETERS: kzheader AS CHECKBOX.
DATA: BEGIN OF intern OCCURS 0.
INCLUDE STRUCTURE alsmex_tabline.
DATA: END OF intern.
DATA: BEGIN OF intern1 OCCURS 0.
INCLUDE STRUCTURE alsmex_tabline.
DATA: END OF intern1.
DATA: BEGIN OF t_col OCCURS 0,
col LIKE alsmex_tabline-col,
size TYPE i.
DATA: END OF t_col.
DATA: zwlen TYPE i,
zwlines TYPE i.
DATA: BEGIN OF fieldnames OCCURS 3,
title(60),
table(6),
field(10),
kz(1),
END OF fieldnames.
* No of columns
DATA: BEGIN OF data_tab OCCURS 0,
value_0001(50),
value_0002(50),
value_0003(50),
value_0004(50),
value_0005(50),
value_0006(50),
value_0007(50),
value_0008(50),
value_0009(50),
value_0010(50),
value_0011(50),
value_0012(50),
value_0013(50),
value_0014(50),
value_0015(50),
value_0016(50),
value_0017(50),
value_0018(50),
value_0019(50),
value_0020(50),
value_0021(50),
value_0022(50),
value_0023(50),
value_0024(50),
value_0025(50),
value_0026(50),
value_0027(50),
value_0028(50),
value_0029(50),
value_0030(50),
value_0031(50),
value_0032(50),
value_0033(50),
value_0034(50),
value_0035(50),
value_0036(50),
value_0037(50),
value_0038(50),
value_0039(50),
value_0040(50),
value_0041(50),
value_0042(50),
value_0043(50),
value_0044(50),
value_0045(50),
value_0046(50),
value_0047(50),
value_0048(50),
value_0049(50),
value_0050(50),
value_0051(50),
value_0052(50),
value_0053(50),
value_0054(50),
value_0055(50),
value_0056(50),
value_0057(50),
value_0058(50),
value_0059(50),
value_0060(50),
value_0061(50),
value_0062(50),
value_0063(50),
value_0064(50),
value_0065(50),
value_0066(50),
value_0067(50),
value_0068(50),
value_0069(50),
value_0070(50),
value_0071(50),
value_0072(50),
value_0073(50),
value_0074(50),
value_0075(50),
value_0076(50),
value_0077(50),
value_0078(50),
value_0079(50),
value_0080(50),
value_0081(50),
value_0082(50),
value_0083(50),
value_0084(50),
value_0085(50),
value_0086(50),
value_0087(50),
value_0088(50),
value_0089(50),
value_0090(50),
value_0091(50),
value_0092(50),
value_0093(50),
value_0094(50),
value_0095(50),
value_0096(50),
value_0097(50),
value_0098(50),
value_0099(50),
value_0100(50).
DATA: END OF data_tab.
DATA: tind(4) TYPE n.
DATA: zwfeld(19).
FIELD-SYMBOLS: <fs1>.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR filename.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
mask = '*.xls'
static = 'X'
CHANGING
file_name = filename.
START-OF-SELECTION.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = filename
i_begin_col = begcol
i_begin_row = begrow
i_end_col = endcol
i_end_row = endrow
TABLES
intern = intern
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
OTHERS = 3.
IF sy-subrc <> 0.
WRITE:/ 'Upload Error ', SY-SUBRC.
ENDIF.
END-OF-SELECTION.
LOOP AT intern.
intern1 = intern.
CLEAR intern1-row.
APPEND intern1.
ENDLOOP.
SORT intern1 BY col.
LOOP AT intern1.
AT NEW col.
t_col-col = intern1-col.
APPEND t_col.
ENDAT.
zwlen = strlen( intern1-value ).
READ TABLE t_col WITH KEY col = intern1-col.
IF sy-subrc EQ 0.
IF zwlen > t_col-size.
t_col-size = zwlen.
* Internal Table, Current Row Index
MODIFY t_col INDEX sy-tabix.
ENDIF.
ENDIF.
ENDLOOP.
DESCRIBE TABLE t_col LINES zwlines.
SORT intern BY row col.
IF kzheader = 'X'.
LOOP AT intern.
fieldnames-title = intern-value.
APPEND fieldnames.
AT END OF row.
EXIT.
ENDAT.
ENDLOOP.
ELSE.
DO zwlines TIMES.
WRITE sy-index TO fieldnames-title.
APPEND fieldnames.
ENDDO.
ENDIF.
SORT intern BY row col.
LOOP AT intern.
IF kzheader = 'X'
AND intern-row = 1.
CONTINUE.
ENDIF.
tind = intern-col.
CONCATENATE 'DATA_TAB-VALUE_' tind INTO zwfeld.
ASSIGN (zwfeld) TO <fs1>.
<fs1> = intern-value.
AT END OF row.
APPEND data_tab.
CLEAR data_tab.
ENDAT.
ENDLOOP.
CALL FUNCTION 'DISPLAY_BASIC_LIST'
EXPORTING
file_name = filename
TABLES
data_tab = data_tab
fieldname_tab = fieldnames.
*-- End of Program
Uploading Excel file to SAP Using Function Module TEXT_CONVERT_XLS_TO_SAP
REPORT zupload_excel_to_itab.
TYPE-POOLS: truxs.
PARAMETERS: p_file TYPE rlgrap-filename.
TYPES: BEGIN OF t_datatab,
col1(30) TYPE c,
col2(30) TYPE c,
col3(30) TYPE c,
END OF t_datatab.
DATA: it_datatab type standard table of t_datatab,
wa_datatab type t_datatab.
DATA: it_raw TYPE truxs_t_text_data.
* At selection screen
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
field_name = 'P_FILE'
IMPORTING
file_name = p_file.
*START-OF-SELECTION.
START-OF-SELECTION.
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
* I_FIELD_SEPERATOR =
i_line_header = 'X'
i_tab_raw_data = it_raw " WORK TABLE
i_filename = p_file
TABLES
i_tab_converted_data = it_datatab[] "ACTUAL DATA
EXCEPTIONS
conversion_failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
* END-OF-SELECTION.
END-OF-SELECTION.
LOOP AT it_datatab INTO wa_datatab.
WRITE:/ wa_datatab-col1,
wa_datatab-col2,
wa_datatab-col3.
ENDLOOP.
here are the links for further details
http://www.sapdevelopment.co.uk/file/file_upexcel.htm
http://www.sap-img.com/abap/upload-direct-excel.htm
reward if helpful
raam -
How to download a file uploaded in the portal admin console
Hi All ,
I have created a content using admin console.
It has a property called , "file", and it is of type "Binary".and its primary property
I need to have link in JSP , to download that file/content.
I am using <templates tag , but not able to download.
Could you pls suggest how to download a file uploaded to admin console
Thanks & Regards,
SrinivasSrinivas,
Check the WLP API http://e-docs.bea.com/wlp/docs102/javadoc/index.html?overview-summary.html
Search for com.bea.content.manager.servlets.ShowBinaryServlet class and com.bea.content.manager.servlets.DownloadBinaryServlet class. You can use one of these depending on your requirment. I think there is not jsp tag for these classes so you have to use scriptlets.
Maybe you are looking for
-
Making a gallery in dw with fireworks?
Hi, 5 days ago I downloaded a 30 day free trial of fireworks cs3 but in dw when you do commands>create web photo gallery the dialog box comes up and says "this feature requires that you have fireworks4+ installed on your machine" then bellow that it
-
We are in need of a reverse proxy solution for WL that works with Windows 2003 IIS6. IISForward/IISproxy is not supported and doesn't work. We have tried several third party products but they all fail relating to how WL manages cookies. Any Suggestio
-
Lightroon CC upgrade will not run on windows 8.1
Ran Adobe Creative Cloud updates today, all updates installed and are working OK except for Lightroom, it will not run when opened, no error messages appear and windows trouble shooter reports it as lightroom is incompatible. I have done a complete m
-
Is it possible to get RAW files to be the primary version used?
I've been shooting RAW with my Nikon D7000 and using iPhoto '09 8.1.2, OSX 10.6.8 as a cataloging/minor editing software. I'm considering buying Aperture but before I do so I'd like to know if it's possible to avoid an annoying thing about iPhoto.
-
Viewing items in Finder full screen
I seem to remember reading somewhere that when viewing finder items in cover flow (at least I think it was in cover flow), you could make the item appear full screen size, or at least very large. Is this right? If so how? Thanks! DanK