How to download a file/contents through a session bean to the bean client

Hi All,
I'm a newbie to enterprise beans and facing a problem. I have a requirement where an excel file saved on the server will be a accessed by a session bean and return it to the bean client (developed in swing). Client will display the file contents, user edits the contents and saves. Pressing the save button will save the excel on the server again using the same session bean.
As far as displaying the contents of excel on the form/panel is concerned I have developed this part and able to load files and save them on my local machine.
But my main requirement is to load it through Session Bean and then save it back on the server. An EJB 2.0 code snippet addressing this part would be a great help.
Thanks,

and where's the problem?
I see 2 EJB calls, one to retrieve the data and another one to send it back to the server.
That's the simplest scenario, easy to implement using a stateless session bean (though if you want to prevent concurrent modification of the file there's a bit more work to do, like keeping a record of open files).
A more complex solution would have the client send only the changes to the file (for network performance reasons maybe) and have the EJB merge those in some way with the original document.
Complex, possibly error prone, probably not worth the effort.
First scenario should pose no problem if you're familiar with Java and have a passing familiarity with EJB.

Similar Messages

  • 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 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,
    Srinivas

    Srinivas,
    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.

  • 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 remote system.

    Hi,
    If anybody knows how to download a file directly from database to localdirectory

    I 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
    Rajesh

    Hi,
    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
    Ricky

    Hi,
       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 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
    pauldharma

    Hai,
    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.
    pauldharma

    Hi,
    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 read trace file content

    Hi,
    DB :11.2
    How to read trace file content.It's only for ORACLE SUPPORT?
    calling         
    call
    entry           
    argument values in hex
    location        
    type
    point           
    (? means dubious value)
    ksedst()+31     
    call
    ksedst1()       
    000000000 ? 000000001 ?
    7FFF19B98CA0 ? 7FFF19B98D00 ?
    7FFF19B98C40 ? 000000000 ?
    ksedmp()+610    
    call
    ksedst()        
    000000000 ? 000000001 ?
    7FFF19B98CA0 ? 7FFF19B98D00 ?
    7FFF19B98C40 ? 000000000 ?
    ksfdmp()+21     
    call
    ksedmp()        
    000000003 ? 000000001 ?
    7FFF19B98CA0 ? 7FFF19B98D00 ?
    7FFF19B98C40 ? 000000000 ?
    kgerinv()+161   
    call
    ksfdmp()        
    000000003 ? 000000001 ?
    7FFF19B98CA0 ? 7FFF19B98D00 ?
    7FFF19B98C40 ? 000000000 ?
    kgeasnmierr()+163
    call
    kgerinv()       
    0069107E0 ? 011F80370 ?
    7FFF19B98D00 ? 7FFF19B98C40 ?
    000000000 ? 000000000 ?
    kssmov()+502    
    call
    kgeasnmierr()   
    0069107E0 ? 011F80370 ?
    7FFF19B98D00 ? 7FFF19B98C40 ?
    000000029 ? 0D3F1C600 ?
    kfncInitSlavePool()  call
    kssmov()        
    0D3F1C5D0 ? 000000000 ?
    +203                                          
    7FFF19B98D00 ? 7FFF19B98C40 ?
    000000029 ? 0D3F1C600 ?
    kfncWorkMsgAlloc()+  call
    kfncInitSlavePool()  0D3F1C5D0 ? 000000000 ?
    83                                            
    7FFF19B98D00 ? 7FFF19B98C40 ?
    000000029 ? 0D3F1C600 ?
    kfncFileUnidentify(  call
    kfncWorkMsgAlloc()   0D3F1C5D0 ? 7FFF19B99AD0 ?
    )+635                                         
    7FFF19B98D00 ? 7FFF19B98C40 ?
    000000029 ? 0D3F1C600 ?
    kffmRequestFree()+1  call
    kfncFileUnidentify(  7FFF19B99BC8 ? 7FFF19B99BC0 ?
    Br,
    Raj

    One needs to know the meaning of the kernel functions and their working within the oracle database. I guess, oracle support can do the analysis more easily as they have access to the software code  as well necessary tools to interpret these internal routines.
    Aman....

  • HOw to download a file in background without user intervention?

    Hello people,
    A few hours ago I asked a couple of guys how to download a file to html. For that I am most thankful, and as mentioned this is a two part question, my other question is about how to proccess downloading the html in background and to automatically send it to a folder or other path. Without any user intervention.
    Example, I run a long report to be downloaded in background. The lets say the next day, I can get the file in a folder. Thanks guys take care!

    Hello guys thanks for your help so far. I have been off again on again with this task because its more for future purposes than anything.
    So far I have searched the net and stuff and decided that I will use WWW_LIST_TO_HTML since I want to download it the way it is. I am also going to use open/close dataset as many of you have mentioned.
    SO far Im just trying it out with a simple report program to see its funcitonalities. My code goes like this.
    <b>REPORT ZCCYT_COOL2 NO STANDARD PAGE HEADING LINE-COUNT 100 .
    DATA: IFIELDS TYPE TABLE OF W3FIELDS WITH HEADER LINE.
    *DATA: ihtml   TYPE TABLE OF w3html   WITH HEADER LINE.
    DATA: IHTML   TYPE TABLE OF W3_HTML  WITH HEADER LINE.
    DATA: BEGIN OF I_TAB OCCURS 0,
            MATNR LIKE MAKT-MATNR,
            MAKTX LIKE MAKT-MAKTX,
          END OF I_TAB.
    SELECT-OPTIONS: SO_MATNR FOR I_TAB-MATNR.
    SELECT MATNR MAKTX
      FROM MAKT
      INTO TABLE I_TAB
      WHERE MATNR IN SO_MATNR..
    LOOP AT I_TAB.
      WRITE: / I_TAB-MATNR,
               I_TAB-MAKTX.
    ENDLOOP.
    CALL FUNCTION 'WWW_LIST_TO_HTML'
       EXPORTING
           list_index = sy-lsind
         TABLES
              HTML       = IHTML.
    DATA: FILE TYPE LOCALFILE.
    FILE = '/usr/test.html'.
    OPEN DATASET FILE FOR OUTPUT IN BINARY MODE.
    LOOP AT IHTML.
      TRANSFER IHTML TO FILE.
    ENDLOOP.
    CLOSE DATASET FILE.</b>
    NOw the problem now though is that the file isnt downloading or saving at all. I cant seem to get what is wrong since the path does exist and the this seems the universal way to implement the program. Im guessing the problem lies in the file name, because everything seems to work fine. Hope to hear again soon sorry for not visiting this place sooner cuz I was buzy elsewhere.

Maybe you are looking for

  • What could have happened as my 3 Nik plugins do not show up on my edit key in Lightroom 3???

    I am using Lightroom 3.  I have been using 3 Nik Software plug-ins from my edit key.   All of a sudden only one plug-in will work.  The other two are not even showing up in my edit box.. They are in my system, because they appear when I click on thei

  • HP Laser jet Cp1525

    My laserjet jams up frequently when I am printing envelopes.  I usually load about 10 business size envelopes in tray 2 but it seems that the printer won't pick them.  Any ideas?

  • Factory unlocked iphone 5 turns out to be locked

    My aunt bought a factory unlocked iPhone 5 from London apple store at full price 530pounds. When I insert the nano sim in it, it says no service. So I went to IMEI.info and typed its imei. The status showed that my iphone is locked. What should I do

  • ADF and not Oracle database

    Hi all. In trace log I see that ADF creates such SQL for a lock row : [NNN] Executing LOCK "SELECT ... FROM TABLE WHERE PK=? FOR UPDATE" but I use FireBird as SQL Server and for this database syntax has to be "SELECT ... FROM TABLE WHERE PK=? FOR UPD

  • W520 - Color Calibrator won't work.

    Hello guys, I'm stuck. I want to calibrate the monitor through the Color Calibrator Tray that always complains that the monitor needs new profiling. When I start the application and I shut the laptop to run the first test it says "No connection possi