Download Signed files

Hi,
I have a web application running. It has a download link for downloading a file. My requirement is to download this file without asking the user where to download. This file is kind of an executable. I also want this file to execute after download. This executable will generate some binary files. After the creation, I want these files to be uploaded back to the server. All this should happen on a single click on the website.
I know this will be kind of a force download and execute and will be a security threat.
To allow this, I am thinking of signing my executable file with some certificate, so that when the user download this executable for the first time, he will shown kind of a warning dialog (as shown in case of Java Web Start). For future downloads, this warning dialog should not be shown. Basically I am thinking of providing this feature as Java Web Start provides.
Is this possible?
If yes, then how to execute this executable once download and how to upload the binaries back to the server.
Thanks,
Charanjeet

As you say, you could use Web Start. Or you could use a signed applet. However if you are asking about executables that aren't written in Java, then you are far off-topic here. (It isn't even a servlets question, either.)

Similar Messages

  • Downloading Signed files

    Hi,
    I have a web application running. It has a download link for downloading a file. My requirement is to download this file without asking the user where to download. This file is kind of an executable. I also want this file to execute after download. This executable will generate some binary files. After the creation, I want these files to be uploaded back to the server. All this should happen on a single click on the website.
    I know this will be kind of a force download and execute and will be a security threat.
    To allow this, I am thinking of signing my executable file with some certificate, so that when the user download this executable for the first time, he will shown kind of a warning dialog (as shown in case of Java Web Start). For future downloads, this warning dialog should not be shown. Basically I am thinking of providing this feature as Java Web Start provides.
    Is this possible?
    If yes, then how to execute this executable once download and how to upload the binaries back to the server.
    Thanks,
    Charanjeet

    Originally posted by: birsan.nospam.ca.ibm.com
    Check the following newsgroup posting: "update manager isn't working through
    https" from last week, it may help.
    -Dorian
    "Rainer Schmitz" <[email protected]> wrote in message
    news:1054900032.209713@miraculix...
    > We are providing some digitally signed features at an update site.
    > When downloading the files using update manager the digital signature is
    > displayed but the certificate is not recognized. The message displayed is:
    >
    > "The certificates used to authenticate this feature are not recognized.
    The
    > provider of this feature cannot be verified."
    >
    > I tried using the eclipse startup parameters -keyring and -password, but
    > eclipse still does not recognize the certificate.
    >
    > Any solutions?
    >
    > Cheers,
    > Rainer
    >

  • Minus Sign in the Downloaded DME file using F110 Transaction

    Hi All,
    From the F110 Transaction I navigate to the DME Administration from the menu bar in order to download the DME file into my system. I could open the txt file that is downloaded. Now my requirement is to add a minus sign to the invoice amount of the txt file.
    I tried debugging the program to find out where the data is populated but was unable to. I can see the FM GUI_DOWNLOAD that downloads the file but the internal table contains hexadecimal data.I don't understand how this is converted to the text data.
    I'm unsure of what to do.... Any body has any suggestions.
    Regards,
    Shipin Paul

    Hi Anmol,
    Your answer helped me a lot. I am really thankful. But my issue is not solved.
    I went to the DMEE Transaction and gave the correct format and the tree type as input.
    Inside the format i went into the amount element as you have mentioned and included an exit module with the respective coding.
    Then i execute the transaction F110 with the Run date and Identification.
    I then navigate to the menubar Enviroment->Payment Medium->DME Administration so as to download it into my system as notepad.
    I select one of the entries and press the download button. But it does not stop at the exit which i included in the DMEE Transaction
    even though i have created a breakpoint there..
    Do you have any idea about this.
    Regards,
    Shipin Paul

  • Every time I download a file to my macbook pro, it saves it to downloads but changes the name and inserts % sign.  Please advise how to correct the name that it is saved under.

    Every time I download a file to my macbook pro, it saves it to downloads but changes the name and inserts % sign.  Please advise how to correct the name that it is saved under.

    Anything Downloaded with a Particular Apple ID is tied to that Apple ID and Cannot be Merged or Transferred to a Different Apple ID.
    Apple ID FAQs
    http://support.apple.com/kb/HE37

  • The selected signed file could not be authenticated. The file might have been tampered with or an error might have occured during download. Please verify the MD5 hash value against the Cisco Systems web site

    I am trying to load any 9.0.3 firmware on my UCM 5.0.4.2000-1 server. Every newer firmware I load throws the following error. I have verified the MD5 is correct and also downloaded the file several times with the same result. I can load the same firmware file on another UCM server and it loads fine. Any ideas?
    Thanks in advance!
    Error Message:
    The selected signed file could not be authenticated. The file might have been  tampered with or an error might have occured during download. Please verify the  MD5 hash value against the Cisco Systems web site:  9b:b6:31:09:18:15:e7:c0:97:9f:e6:fe:9a:19:94:99
    Firmware File: cmterm-7970_7971-sccp.9-0-3.cop.sgn
    UCM version: 5.0.4.2000-1

    Thanks for your reply. We have a lab environment where I maintain  UCM 5.0, 5.1, 6.0, 6.1, 7.0, 7.1 and 8.0 servers each running the latest released firmware for our QA testing team. I have downloaded and installed the latest device packages but find that if I try to install any firmware newer then 8.3.1 on either 5.0.4 or 6.0 i start getting MD5 hash authentication errors. It looks like 9.0.3 firmware should work on UCM 5.0 and 6.0 so I am lost as to why I can't seem to update any firmware for any model phone if it is newer then version 8.3.1 on either 5.0 or 6.0. while 5.1 and 6.1 work without issues. Maybe it is just a bug. I mostly wanted to see if anyone else has experienced this or if it is just me.

  • If i download any file which is prepare on microsoft office 2007 . The file have been download without extension of the prog. Means if files name is "1,docx" when i download from firefox it download in that form "1". after download i have to rename and gi

    If i download any file which is prepare on microsoft office 2007 . The file have been download without extension of the prog. Means if files name is "1,docx" when i download from firefox it download in that form "1". after download i have to rename and give the extension name is plz tell me the way that office files are compatible with it.
    == This happened ==
    Every time Firefox opened
    == when i download the office files

    In Firefox Options / Privacy be sure "Remember download history" is checked. To see all of the options on that panel, "Firefox will" must be set to "Use custom settings for history".
    To find your OS information, on your Windows desktop, right-click the My Computer icon, choose Properties, under System on that small window is info about your OS.
    '''If this reply solves your problem, please click "Solved It" next to this reply when <u>signed-in</u> to the forum.'''

  • 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();

  • Error in task -Downloading a file from report

    Hi all,
    This is my code to download the content of report to Excel,Problem i am getting when trying to put heading for numerical fields .Its getting '0' in the heading .For remaining  Fields which are non-numberic its displaying nicely.Could any one solve this for me.
    report zt11.
      data :  itab type mard occurs 0 .
    select  * from mard into table itab .
    data: it_t001   type t001  occurs 0,
          it_fields type dfies occurs 0  with header line,
          begin of it_fnames occurs 0,
            reptext like dfies-reptext,
          end of it_fnames.
          CALL FUNCTION 'GET_FIELDTAB'
      EXPORTING
      LANGU                     = SY-LANGU
      ONLY                      = ' '
        TABNAME                   = 'MARD'
      WITHTEXT                  = 'X'
    IMPORTING
      HEADER                    =
      RC                        =
      TABLES
        FIELDTAB                  = it_fields
      EXCEPTIONS
        INTERNAL_ERROR            = 1
        NO_TEXTS_FOUND            = 2
        TABLE_HAS_NO_FIELDS       = 3
        TABLE_NOT_ACTIV           = 4
        OTHERS                    = 5
    IF SY-SUBRC <> 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    loop at it_fields.
      it_fnames-reptext = it_fields-reptext.
      append it_fnames.
    endloop.
    CALL FUNCTION 'EXCEL_OLE_STANDARD_DAT'
      EXPORTING
        FILE_NAME                       = 'C:\T001'
      CREATE_PIVOT                    = 0
        DATA_SHEET_NAME                 = 'Companies'
      PIVOT_SHEET_NAME                = ' '
      PASSWORD                        = ' '
      PASSWORD_OPTION                 = 0
      TABLES
      PIVOT_FIELD_TAB                 =
        DATA_TAB                        = itab
       FIELDNAMES                      = it_fnames
      EXCEPTIONS
        FILE_NOT_EXIST                  = 1
        FILENAME_EXPECTED               = 2
        COMMUNICATION_ERROR             = 3
        OLE_OBJECT_METHOD_ERROR         = 4
        OLE_OBJECT_PROPERTY_ERROR       = 5
        INVALID_FILENAME                = 6
        INVALID_PIVOT_FIELDS            = 7
        DOWNLOAD_PROBLEM                = 8
        OTHERS                          = 9
    IF SY-SUBRC <> 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    short dump :  unable to interpret the "..... " as number.

    Hi,
    You are not formatting the internal table for field labels correctly.
    See the attached code and do accordingly.
    This will help you.
    Reward for useful answers.
    report zesdr001
           line-size 215
           line-count 65
           no standard page heading
           message-id zv.
                          Tables Declaration
    tables:vbrk,       " Sales Document: Billing Header Data
           mara,       " Material Master Data
           mbew,       " Material Valuation data
           mbewh,      " Material Valuation: History Data
           t001,       " Company Codes
           t001w,      " Plants/Branches
           konv,       " Pricing Conditions Data
           t179t,      " Materials: Product hierarchies: Texts
           tcurx,      " Currency Conversion Table
           vbuk,       " Sales Document: Header Status data
           tvko,       " Organizational Unit: Sales Organizations
           tvtw,       " Organizational Unit: Dist.Channels
           tspa,       " Organizational Unit: Divisions
           tvfk,       " Billing Document Types
           kna1.       " Customer Master Data
                 Declaration of Data and Internal Tables
    Internal table to store the Billing Details data.(VBRK,VBRP)
    data: begin of itab_bill occurs 0,
            vbeln like vbrk-vbeln,            " Billing Document Number
            fktyp like vbrk-fktyp,            " Billing Category
            vbtyp like vbrk-vbtyp,            " Sales Doc Category
            fkdat like vbrk-fkdat,            " Billing doc date
            fkart like vbrk-fkart,            " Billing Doc type
            bukrs like vbrk-bukrs,            " Company Code
            kurrf like vbrk-kurrf,            " Exchange type
            knumv like vbrk-knumv,            " Condition Number
            waerk like vbrk-waerk,            " Currency
            kunag like vbrk-kunag,            " Sold to Party
            vrkme like vbrp-vrkme,            " sales Unit
            posnr like vbrp-posnr,            " Item Number
            charg like vbrp-charg,            " Batch Number
            fkimg like vbrp-fkimg,            " Billed quantity
            werks like vbrp-werks,            " Plant
            matnr like vbrp-matnr,            " Material Number
            netwr like vbrp-netwr,            " Net Value of the doc
            wavwr like vbrp-wavwr,            " Cost in Doc Currency
            kdmat like vbap-kdmat,            " Customer Material
          end of itab_bill.
    Internal table to write the report output when Customer Mode
    Radiobutton is selected
    data: begin of itab_out occurs 0,
            kunag like vbrk-kunag,            " Customer No
            vbeln like vbrk-vbeln,            " Billing Document Number
            fkart like vbrk-fkart,            " Billing Doc type
            fktyp like vbrk-fktyp,            " Billing Category
            vbtyp like vbrk-vbtyp,            " Sales Doc Category
            fkdat like vbrk-fkdat,            " Billing doc date
            kunnr like kna1-kunnr,            " Customer
            bukrs like vbrk-bukrs,            " Company Code
            kurrf like vbrk-kurrf,            " Exchange Rate
            waerk like vbrk-waerk,            " Currency
            vrkme like vbrp-vrkme,            " Sales Unit
            posnr like vbrp-posnr,            " Item Number
            charg like vbrp-charg,            " Batch Number
            fkimg like vbrp-fkimg,            " Billed quantity
            werks like vbrp-werks,            " Plant
            matnr like vbrp-matnr,            " Material NUmber
            kdmat like vbap-kdmat,            " Customer Material
            bil_amt(16) type p decimals 2,    " Bill Amount
            mode(10),                         " Mode
            density(10),                      " Density
            sel_prc(16) type p decimals 2,    " Selling Price
            mvg_prs like mbew-verpr,          " Moving Price
            gp_mvp_amt like vbrp-netwr,       " GrossProfit Amount(MVP)
            gp_mvp_pr(6)  type p decimals 2,  "   ,, percentage
          end of itab_out.
    Internal table to write the report output when Mode
    Radiobutton is selected
    data: begin of itab_out2 occurs 0,
            mode(10),
            vbeln like vbrk-vbeln,             " Billing Document Number
            fktyp like vbrk-fktyp,             " Billing Category
            vbtyp like vbrk-vbtyp,             " Sales Doc Category
            fkdat like vbrk-fkdat,             " Billing doc date
            kunag like vbrk-kunag,             " Sold to party
            kunnr like kna1-kunnr,             " Customer
            bukrs like vbrk-bukrs,             " Company Code
            kurrf like vbrk-kurrf,             " Exchange Rate
            waerk like vbrk-waerk,             " Currency
            vrkme like vbrp-vrkme,             " Sales UNit
            posnr like vbrp-posnr,             " Item No
            charg like vbrp-charg,             " Batch Number
            fkimg like vbrp-fkimg,             " Billed quantity
            werks like vbrp-werks,             " Plant
            matnr like vbrp-matnr,             " Material Number
            kdmat like vbap-kdmat,             " Customer Material No
            bil_amt(16)   type p decimals 2,   " Billing Amount
            density(10),                       " density
            sel_prc(16) type p decimals 4,     " Selling Price
            mvg_prs like mbew-verpr,           " Moving Price
            gp_mvp_amt like vbrp-netwr,        " GrossProfit Amount(MVP)
            gp_mvp_pr(6)  type p decimals 2,   "   ,, percentage
          end of itab_out2.
    Internal table to write the report output when Density
    Radiobutton is selected
    data: begin of itab_out3 occurs 0,
            mode(10),
            density(10),
            vbeln like vbrk-vbeln,            " Billing Document Number
            fktyp like vbrk-fktyp,            " Billing Category
            vbtyp like vbrk-vbtyp,            " Sales Doc Category
            fkdat like vbrk-fkdat,            " Billing doc date
            kunag like vbrk-kunag,            " Sold to Party
            kunnr like kna1-kunnr,            " Customer
            bukrs like vbrk-bukrs,            " Company Code
            kurrf like vbrk-kurrf,            " Exchange Rate
            waerk like vbrk-waerk,            " Currency
            vrkme like vbrp-vrkme,            " Sales Unit
            posnr like vbrp-posnr,            " Item Number
            charg like vbrp-charg,            " Batch Number
            fkimg like vbrp-fkimg,            " Billed quantity
            werks like vbrp-werks,            " Plant
            matnr like vbrp-matnr,            " Material Number
            kdmat like vbap-kdmat,            " Customer Material
            bil_amt(16)   type p decimals 2,  " Bill Amount
            sel_prc(16) type p decimals 4,    " Selling Price
            mvg_prs like mbew-verpr,          " Moving Price
            gp_mvp_amt like vbrp-netwr,       " GrossProfit Amount(MVP)
            gp_mvp_pr(6)  type p decimals 2,  "   ,, percentage
          end of itab_out3.
    *-Internal Table to Hold data to be downloaded to file
    data: begin of itab_out1 occurs 0,
            kunag(10),                       " Customer
            vbeln(10),                       " Billing Doc No
            fkdat(10),                       " Bill Date
            posnr(6),                        " Item No
            mode(6),                         " Mode
            density(6),                      " Density
            matnr(18),                       " Material
            charg(10),                       " Batch Number
            fkimg like vbrp-fkimg,           " Billed quantity
            vrkme(4),                        " Sales Unit
            sel_prc(14),                     " Selling Price
            bil_amt(15)  type p decimals 2,  " Billing Amount
            waerk(4),                        " Currency
            mvg_prs(15),                     " Moving Price
            gp_mvp_amt like vbrp-netwr,      " Gross profit Amount(MVP)
            gp_mvp_pr(15),                   "    ,,  percentage
            kdmat(35),                       " Customer Material
          end of itab_out1.
    *Internal Table
    data: begin of fieldnames occurs 0,
            title(25) type c,
            table(5)  type c,
            field(5)  type c,
            type(1)   type c,
          end of fieldnames.
    Declaration Of Variables
    data: w_period like bapi0002_4-fiscal_period,
          w_year   like bapi0002_4-fiscal_year,
          w_date   like bsad-budat,
          w_lin type i.       "No.of lines in Internal Table
    data: t_fkimg             like vbrp-fkimg,
          t_bil_amt(8)        type p decimals 2,
          t_gp_mvp_amt(8)     type p decimals 2,
          t_gr_fkimg          like vbrp-fkimg,
          t_gr_bil_amt(8)     type p decimals 2,
          t_gr_gp_mvp_amt(8)  type p decimals 2,
          t_efkimg            like vbrp-fkimg,
          t_ebil_amt(8)       type p decimals 2,
          t_egp_mvp_amt(8)    type p decimals 2.
    data:f_flg .
                       Select-Options
    selection-screen: begin of block b with frame.
    selection-screen : begin of block b1 with frame title text-001.
    select-options:s_bukrs for t001-bukrs no intervals no-extension
                                                         obligatory,
                   s_vkorg for tvko-vkorg no intervals no-extension,
                   s_vtweg for tvtw-vtweg no intervals no-extension,
                   s_spart for tspa-spart no intervals no-extension,
                   s_werks for t001w-werks no intervals no-extension,
                   s_kunag for kna1-kunnr,
                   s_vbeln for vbuk-vbeln,
                   s_fkart for tvfk-fkart,
                   s_fkdat for vbrk-fkdat obligatory.
    selection-screen begin of line.
    selection-screen comment 1(20) text-008.
    selection-screen end   of line.
    selection-screen begin of line.
    parameters p_cust type c radiobutton group cust.
    selection-screen comment 3(20) text-004 for field p_cust.
    selection-screen end of line.
    selection-screen begin of line.
    parameters p_mode type c radiobutton group cust.
    selection-screen comment 3(20) text-006 for field p_mode.
    selection-screen end of line.
    selection-screen begin of line.
    parameters p_dens type c radiobutton group cust.
    selection-screen comment 3(20) text-007 for field p_dens.
    selection-screen end of line.
    selection-screen: end of block b1.
    selection-screen : begin of block b2 with frame title text-002.
    parameters:  p_dwnlod as checkbox,
                 p_file like rlgrap-filename. " default 'C:\zesdr001'.
    selection-screen: end of block b2.
    selection-screen: end of block b.
    *******At Selection Screen********************************************
    at selection-screen.
    At Selection Screen on Value Request
    at selection-screen on value-request for p_file.
      perform f4_help.
    Checking for the input values of selection screen.
      perform screen_check.
    Top Of Page***************************************************
    top-of-page.
      perform rep_headers.
    *******Start of Selection*********************************************
    start-of-selection.
    Selecting data from the database tables
      perform invoice_selection.
      describe table itab_bill lines w_lin.
      if w_lin = 0.
        message i008.   " No Data Found for the Given Selection Criteria
      else.
    Moving the data records into output internal table
        perform bill_details.
    When Customer Radio button is selected
        if p_cust eq 'X'.
          perform invoice_output_cust.
    When Mode Radio button is selected
        elseif p_mode eq 'X'.
          perform invoice_output_mode.
    When density Radio button is selected
        elseif p_dens eq 'X'.
          perform invoice_output_dens.
        endif.
      endif.
    *******End of Selection***********************************************
    end-of-selection.
      perform init_fieldnames.
      if p_dwnlod = 'X'.
        perform read_data_for_dowlload.
      perform down_load_to_file using p_file.
        perform download_excel using p_file.
      endif.
    *&      Form  screen_check
       Ckecking for Selection Screen fields Validation
    form screen_check.
    Validation of Sales Organization
      clear tvko.
      if not s_vkorg-low is initial.
        select vkorg from tvko up to 1 rows
               into tvko-vkorg
               where vkorg in s_vkorg.
        endselect.
        if sy-subrc ne 0.
          message e009.  " Invalid Sales Organization
        endif.
      endif.
    Validation of Distribution Channel
      clear tvtw.
      if not s_vtweg-low is initial.
        select vtweg from tvtw up to 1 rows
               into tvtw-vtweg
               where vtweg in s_vtweg.
        endselect.
        if sy-subrc ne 0.
          message e010.  " Invalid Distribution Channel
        endif.
      endif.
    Validation of Division
      clear tspa.
      if not s_spart-low is initial.
        select spart from tspa up to 1 rows
               into tspa-spart
               where spart in s_spart.
        endselect.
        if sy-subrc ne 0.
          message e011.  " Invalid Division
        endif.
      endif.
    Validation for company code
      clear t001.
      if not s_bukrs-low is initial.
        select single bukrs from t001
             into t001-bukrs
             where bukrs in s_bukrs.
        if sy-subrc <> 0.
          message e007.   " Enter valid Company Code
        endif.
      endif.
    Validation of billing Document Type
      clear tvfk.
      if not s_fkart is initial.
        select fkart from tvfk up to 1 rows
               into tvfk-fkart
               where fkart in s_fkart.
        endselect.
        if sy-subrc ne 0.
          message e012.  " Invalid Billing Document Type
        endif.
      endif.
    Validation of Billing Document Number
      clear vbuk.
      if not s_vbeln is initial.
        select vbeln from vbuk up to 1 rows
               into vbuk-vbeln
               where vbeln in s_vbeln and
                     vbtyp = 'M'.
        endselect.
        if sy-subrc ne 0.
          message e013.   " Invalid Billing Doc Number
        endif.
      endif.
    Validation of Customer
      clear kna1.
      if not s_kunag is initial.
        select kunnr from kna1 up to 1 rows
               into kna1-kunnr
               where kunnr in s_kunag.
        endselect.
        if sy-subrc ne 0.
          message e014.    " Invalid Customer Number
        endif.
      endif.
    Validation of Plant
      clear t001w.
      if not s_werks is initial.
        select werks from t001w up to 1 rows
               into t001w-werks
               where werks in s_werks.
        endselect.
        if sy-subrc ne 0.
          message e004.    " Invalid Plant Number
        endif.
      endif.
    Validation for File path to download
      if p_dwnlod = 'X'.
        if p_file is initial.
          message e006.  " Enter the Valid file path to Download
        endif.
      endif.
    endform.             "screen_check
          FORM invoice_selection                                        *
    Selecting data from the database tables
    form invoice_selection.
      select
            a~vbeln                   " Billing Doc Number
            a~fktyp                   " Billing Category
            a~vbtyp                   " Sales Doc category
            a~fkdat                   " Billing doc date
            a~fkart                   " Billing doc type
            a~bukrs                   " Company code
            a~kurrf                   " Exchange rate
            a~knumv                   " Condition record Number
            a~waerk                   " Currency
            a~kunag                   " Sold to Party
            b~vrkme                   " Sales Unit
            b~posnr                   " Item Number
            b~charg                   " Batch Number
            b~fkimg                   " Billed quantity
            b~werks                   " Plant
            b~matnr                   " Material Number
            b~netwr                   " Net Value of Bill Doc
            b~wavwr                   " Cost in Doc Currency
            c~kdmat                   " Customer Material
                     into table itab_bill
                     from vbrk as a join vbrp as b
                            on bvbeln = avbeln
                            join vbap as c
                            on baubel = cvbeln and
                               baupos = cposnr
                      where a~vbeln in s_vbeln and
                            a~fkdat in s_fkdat and
                            a~bukrs in s_bukrs and
                            a~vtweg in s_vtweg and
                            a~vkorg in s_vkorg and
                            a~spart in s_spart and
                            a~fkart in s_fkart and
                            b~werks in s_werks and
                            a~kunag in s_kunag and
                            a~sfakn eq ' ' and
                            a~fksto eq ' ' .
    endform .
          FORM bill_details                                             *
    appending data into itab_out internal table
    form bill_details.
      sort itab_bill by vbeln.
      select single waers from t001 into t001-waers
                              where bukrs in s_bukrs.
      data:f_txt1(10),f_txt2(10),f_txt3(10).
      loop at itab_bill.
        itab_out-vbeln   = itab_bill-vbeln.
        itab_out-fktyp   = itab_bill-fktyp.
        itab_out-vbtyp   = itab_bill-vbtyp.
        itab_out-fkdat   = itab_bill-fkdat.
        itab_out-fkart   = itab_bill-fkart.
        itab_out-bukrs   = itab_bill-bukrs.
        itab_out-kurrf   = itab_bill-kurrf.
        itab_out-waerk   = itab_bill-waerk.
        itab_out-kunag   = itab_bill-kunag.
        itab_out-vrkme   = itab_bill-vrkme.
        itab_out-posnr   = itab_bill-posnr.
        itab_out-charg   = itab_bill-charg.
        itab_out-fkimg   = itab_bill-fkimg.
        itab_out-werks   = itab_bill-werks.
        itab_out-matnr   = itab_bill-matnr.
        itab_out-kdmat   = itab_bill-kdmat.
       select single currdec from tcurx into tcurx-currdec
              where currkey eq itab_out-waerk.
        if sy-subrc eq '0' .
          if tcurx-currdec eq '0'.
            itab_bill-netwr = itab_bill-netwr * 100.
            itab_bill-wavwr = itab_bill-wavwr * 100.
          endif.
        endif.
        itab_out-bil_amt = itab_bill-netwr.
        clear : konv.
    Pricing data from KONV table
        select single kbetr kwert kpein from konv into
                                      (konv-kbetr,konv-kwert,konv-kpein)
                                       where knumv = itab_bill-knumv and
                                             kposn = itab_bill-posnr and
                                             kschl eq 'ZSP1' and
                                             krech eq 'C' and
                                             kinak eq ' '.
    Currency conversion
        select single currdec from tcurx into tcurx-currdec
                           where currkey eq itab_out-waerk.
        if sy-subrc eq '0' .
          if tcurx-currdec eq '0'.
            konv-kbetr = konv-kbetr * 100.
          endif.
        endif.
    Unit Price
        itab_out-sel_prc = konv-kbetr.
    Unit Price Calculation
        if not konv-kpein is initial.
          itab_out-sel_prc = itab_out-sel_prc / konv-kpein .
        endif.
    Call Function to get the Period for the given Billing date
    and Company Code
        perform get_period.
    Selecting Material Valuation Data
        clear:mbew.
        if itab_out-fktyp eq 'L'.
          select single
              lfmon lfgja verpr stprs vmver vmstp
                 from mbew
                 into (mbew-lfmon,mbew-lfgja,mbew-verpr,
                       mbew-stprs,mbew-vmver,mbew-vmstp)
                          where matnr = itab_out-matnr
                          and   bwkey = itab_out-werks.
          if mbew-lfmon = w_period and mbew-lfgja = w_year.
            select single currdec from tcurx into tcurx-currdec
                  where currkey eq t001-waers.
            if sy-subrc eq '0' .
              if tcurx-currdec eq '0'.
                mbew-stprs = mbew-stprs * 100.
                mbew-verpr = mbew-verpr * 100.
              endif.
            endif.
            if itab_out-waerk eq t001-waers.
              itab_out-mvg_prs = mbew-verpr  ."/ itab_out-kurrf.
            else.
              itab_out-mvg_prs = mbew-verpr  / itab_out-kurrf.
            endif.
          else.
            clear:mbewh.
            select single
             lfmon lfgja verpr stprs
                from mbewh
                into (mbewh-lfmon,mbewh-lfgja,mbewh-verpr,
                      mbewh-stprs)
                         where matnr = itab_out-matnr
                         and   bwkey = itab_out-werks
                         and   lfmon = w_period
                         and   lfgja = w_year.
            select single currdec from tcurx into tcurx-currdec
                    where currkey eq t001-waers.
            if sy-subrc eq '0' .
              if tcurx-currdec eq '0'.
                mbewh-verpr = mbewh-verpr * 100.
              endif.
            endif.
            if itab_out-waerk eq t001-waers.
              itab_out-mvg_prs = mbewh-verpr ."/ itab_out-kurrf.
            else.
              itab_out-mvg_prs = mbewh-verpr  / itab_out-kurrf.
            endif.
            if itab_out-mvg_prs is initial.
              select single
                      lfmon lfgja verpr stprs vmver vmstp
                         from mbew
                         into (mbew-lfmon,mbew-lfgja,mbew-verpr,
                               mbew-stprs,mbew-vmver,mbew-vmstp)
                                  where matnr = itab_out-matnr
                                  and   bwkey = itab_out-werks.
              select single currdec from tcurx
                 into tcurx-currdec
                 where currkey eq t001-waers.
              if sy-subrc eq '0' .
                if tcurx-currdec eq '0'.
                  mbew-verpr = mbew-verpr * 100.
                endif.
              endif.
              if itab_out-waerk eq t001-waers.
                itab_out-mvg_prs = mbew-verpr  ."/ itab_out-kurrf.
              else.
                itab_out-mvg_prs = mbew-verpr  / itab_out-kurrf.
              endif.
            endif.
          endif.
        endif.
    To find Density and Mode from MARA and T179T tables
        clear :mara,t179t.
        select single prdha from mara
              into mara-prdha
              where matnr = itab_out-matnr.
        select single vtext from t179t
               into t179t-vtext
               where spras = 'EN' and
               prodh = mara-prdha(4).
        split t179t-vtext at ' ' into f_txt1 f_txt2 f_txt3.
        itab_out-mode = f_txt2.
        itab_out-density = f_txt3.
        if not itab_out-mvg_prs is initial.
          if itab_out-fktyp eq 'L'.
            itab_out-gp_mvp_amt = itab_out-bil_amt - itab_out-mvg_prs *
                                                       itab_out-fkimg.
          else.
            itab_out-gp_mvp_amt = '0'.
          endif.
        endif.
        if not itab_out-mvg_prs is initial
           and not itab_out-sel_prc is initial.
          itab_out-gp_mvp_pr = ( itab_out-sel_prc - itab_out-mvg_prs )
                                         / itab_out-sel_prc * 100.
        endif.
        append itab_out.
        clear itab_out.
      endloop.
      loop at itab_out.
        if itab_out-vbtyp eq 'N' or itab_out-vbtyp eq 'O'.
          itab_out-fkimg   = itab_out-fkimg * -1.
          itab_out-sel_prc = itab_out-sel_prc * -1.
          itab_out-bil_amt = itab_out-bil_amt * -1.
          itab_out-mvg_prs = itab_out-mvg_prs * -1.
          itab_out-gp_mvp_amt = itab_out-gp_mvp_amt * -1.
          itab_out-gp_mvp_pr = itab_out-gp_mvp_pr * -1.
    If the bill amount is 0 then the quantity should also be 0.
          if itab_out-bil_amt = 0.
            itab_out-fkimg = 0.
          endif.
    Check if the Bill amount is Credit memo amount, then the gross profit
    should also be the same bill amount irrespecitve of +ve or -ve.
          if itab_out-gp_mvp_amt = 0.
            move: itab_out-bil_amt to itab_out-gp_mvp_amt.
          endif.
          modify itab_out.
          clear itab_out.
        endif.
      endloop.
    endform.
    *&      Form  get_period
    Getting Document Period
    form get_period.
      clear :w_period,w_year,w_date.
      concatenate itab_out-fkdat(4)
                   itab_out-fkdat+4(2)
                   itab_out-fkdat+6(2)
                   into w_date.
      call function 'BAPI_COMPANYCODE_GET_PERIOD'
           exporting
                companycodeid = itab_out-bukrs
                posting_date  = w_date
           importing
                fiscal_year   = w_year
                fiscal_period = w_period.
    endform.                    " get_period
    *&      Form  invoice_output_cust
          Report Output when customer is selected
    form invoice_output_cust.
      write at /1(214) sy-uline.
      sort itab_out  by kunag vbeln fkart posnr fkdat.
      loop at itab_out.
        if f_flg = 'X'.
          format color col_normal intensified off.
          f_flg = ' '.
        else.
          format color col_normal intensified on.
          f_flg = 'X'.
        endif.
        at new kunag.
          read table itab_out index sy-tabix.
        endat.
        write:  /01 sy-vline,  2(10) itab_out-kunag,
                 12 sy-vline, 13(10) itab_out-vbeln,
                 23 sy-vline, 24(6)  itab_out-posnr,
                 30 sy-vline, 31(10) itab_out-fkdat,
                 41 sy-vline, 42(6)  itab_out-mode,
                 48 sy-vline, 49(7)  itab_out-density,
                 56 sy-vline, 57(18) itab_out-matnr,
                 75 sy-vline, 76(10) itab_out-charg,
                 86 sy-vline,
                 87(13) itab_out-fkimg unit itab_out-vrkme no-sign,
                 102(3) itab_out-vrkme,
                105 sy-vline,
                106(14) itab_out-sel_prc currency konv-waers no-sign,
                120 sy-vline,
                121(15) itab_out-bil_amt currency vbrk-waerk no-sign,
                138(3) itab_out-waerk,
                141 sy-vline,
                142(15) itab_out-mvg_prs currency vbrk-waerk no-sign,
                157 sy-vline,
                158(15) itab_out-gp_mvp_amt currency vbrk-waerk no-sign,
                173 sy-vline,174(6)  itab_out-gp_mvp_pr no-sign ,
                180 sy-vline,181(33) itab_out-kdmat,
                214 sy-vline.
        t_fkimg = t_fkimg + itab_out-fkimg.
        t_bil_amt = t_bil_amt + itab_out-bil_amt.
        t_gp_mvp_amt = t_gp_mvp_amt + itab_out-gp_mvp_amt.
        t_gr_fkimg      = t_gr_fkimg         + itab_out-fkimg.
        t_gr_bil_amt    = t_gr_bil_amt       + itab_out-bil_amt.
        t_gr_gp_mvp_amt = t_gr_gp_mvp_amt    + itab_out-gp_mvp_amt.
        at end of kunag.
          format reset.
          format color col_total intensified off.
          write:/1(214) sy-uline.
          write:/01 sy-vline,
                 02 'Sub Total of Customer:'(035), itab_out-kunag,
                 87(13) t_fkimg unit itab_out-vrkme no-sign,
                121(15) t_bil_amt no-sign,
                158(15) t_gp_mvp_amt no-sign,
                214 ' ',
                /1(214)  sy-uline.
          clear: t_fkimg, t_bil_amt, t_gp_mvp_amt.
        endat.
        at last.
          write:/01 sy-vline,
                 02 'Grand Total :'(032),
                 87(13) t_gr_fkimg unit itab_out-vrkme no-sign,
                121(15) t_gr_bil_amt no-sign,
                158(15) t_gr_gp_mvp_amt no-sign,
                214 ' '.
        endat.
        format color off.
      endloop.
      write at /1(214) sy-uline.
    endform.    "invoice_output_cust
    *&      Form  invoice_output_mode
          Report Output
    form invoice_output_mode.
      loop at itab_out.
        move-corresponding itab_out to itab_out2.
        append itab_out2.
        clear: itab_out2.
      endloop.
      write at /1(214) sy-uline.
      sort itab_out2  by mode vbeln posnr fkdat.
      loop at itab_out2.
        if f_flg = 'X'.
          format color col_normal intensified off.
          f_flg = ' '.
        else.
          format color col_normal intensified on.
          f_flg = 'X'.
        endif.
        at new mode.
          read table itab_out2 index sy-tabix.
        endat.
        write: /01 sy-vline,  2(10) itab_out2-kunag,
                12 sy-vline, 13(10) itab_out2-vbeln,
                23 sy-vline, 24(6)  itab_out2-posnr,
                30 sy-vline, 31(10) itab_out2-fkdat,
                41 sy-vline, 42(6)  itab_out2-mode,
                48 sy-vline, 49(7)  itab_out2-density,
                56 sy-vline, 57(18) itab_out2-matnr,
                75 sy-vline, 76(10) itab_out2-charg,
                86 sy-vline,
                87(13) itab_out2-fkimg unit itab_out2-vrkme no-sign,
                102(3) itab_out2-vrkme,
                105 sy-vline,
                106(14) itab_out2-sel_prc currency vbrk-waerk no-sign,
                120 sy-vline,
                121(15) itab_out2-bil_amt currency vbrk-waerk no-sign,
                             138(3)  itab_out2-waerk,
                141 sy-vline,
                142(15) itab_out2-mvg_prs currency vbrk-waerk no-sign,
                157 sy-vline,
                158(15) itab_out2-gp_mvp_amt currency vbrk-waerk no-sign,
                173 sy-vline,174(6)  itab_out2-gp_mvp_pr no-sign,
                180 sy-vline,181(33) itab_out2-kdmat,
                214 sy-vline.
        t_fkimg = t_fkimg + itab_out2-fkimg.
        t_bil_amt = t_bil_amt + itab_out2-bil_amt.
        t_gp_mvp_amt = t_gp_mvp_amt + itab_out2-gp_mvp_amt.
        t_gr_fkimg      = t_gr_fkimg         + itab_out2-fkimg.
        t_gr_bil_amt    = t_gr_bil_amt       + itab_out2-bil_amt.
        t_gr_gp_mvp_amt = t_gr_gp_mvp_amt    + itab_out2-gp_mvp_amt.
        at end of mode.
          format reset.
          format color col_total intensified off.
          write:/1(214) sy-uline.
          write:/01 sy-vline,
                 02 'Sub Total of Mode :'(033), itab_out2-mode,
                 87(13) t_fkimg unit itab_out-vrkme no-sign,
                121(15) t_bil_amt no-sign,
                158(15) t_gp_mvp_amt no-sign,
                214 ' ',
                /1(214)  sy-uline.
          clear: t_fkimg, t_bil_amt, t_gp_mvp_amt.
        endat.
        at last.
          write:/01 sy-vline,
                 02 'Grand Total :'(032),
                 87(13) t_gr_fkimg unit itab_out-vrkme no-sign,
                121(15) t_gr_bil_amt no-sign,
                158(15) t_gr_gp_mvp_amt no-sign,
                214 ' '.
        endat.
        format color off.
      endloop.
      write at /1(214) sy-uline.
    endform.    "invoice_output_mode
    *&      Form  invoice_output_dens
          Report Output
    form invoice_output_dens.
      loop at itab_out.
        move-corresponding itab_out to itab_out3.
        append itab_out3.
        clear: itab_out3.
      endloop.
      write at /1(214) sy-uline.
      sort itab_out3  by mode density vbeln posnr fkdat.
      loop at itab_out3.
        if f_flg = 'X'.
          format color col_normal intensified off.
          f_flg = ' '.
        else.
          format color col_normal intensified on.
          f_flg = 'X'.
        endif.
        at new mode.
        endat.
        at new density.
          read table itab_out3 index sy-tabix.
        endat.
        write:  /01 sy-vline,  2(10) itab_out3-kunag,
                 12 sy-vline, 13(10) itab_out3-vbeln,
                 23 sy-vline, 24(6)  itab_out3-posnr,
                 30 sy-vline, 31(10) itab_out3-fkdat,
                 41 sy-vline, 42(6)  itab_out3-mode,
                 48 sy-vline, 49(7)  itab_out3-density,
                 56 sy-vline, 57(18) itab_out3-matnr,
                 75 sy-vline, 76(10) itab_out3-charg,
                 86 sy-vline,
                 87(13) itab_out3-fkimg unit itab_out3-vrkme no-sign,
                 102(3) itab_out3-vrkme,
                 105 sy-vline,106(14) itab_out3-sel_prc no-sign,
                 120 sy-vline,
                 121(15) itab_out3-bil_amt currency vbrk-waerk no-sign,
                              138(3)  itab_out3-waerk,
                 141 sy-vline,142(15) itab_out3-mvg_prs no-sign
                                      currency vbrk-waerk,
                 157 sy-vline,158(15) itab_out3-gp_mvp_amt no-sign
                                      currency vbrk-waerk,
                 173 sy-vline,174(6)  itab_out3-gp_mvp_pr no-sign,
                 180 sy-vline,181(33) itab_out3-kdmat,
                 214 sy-vline.
        t_efkimg      = t_efkimg      + itab_out3-fkimg.
        t_ebil_amt    = t_ebil_amt    + itab_out3-bil_amt.
        t_egp_mvp_amt = t_egp_mvp_amt + itab_out3-gp_mvp_amt.
        t_fkimg = t_fkimg + itab_out3-fkimg.
        t_bil_amt = t_bil_amt + itab_out3-bil_amt.
        t_gp_mvp_amt = t_gp_mvp_amt + itab_out3-gp_mvp_amt.
        t_gr_fkimg      = t_gr_fkimg         + itab_out3-fkimg.
        t_gr_bil_amt    = t_gr_bil_amt       + itab_out3-bil_amt.
        t_gr_gp_mvp_amt = t_gr_gp_mvp_amt    + itab_out3-gp_mvp_amt.
        at end of density.
          format reset.
          format color col_total intensified off.
          write:/1(214) sy-uline.
          write:/01 sy-vline,
                 02 'Sub Total of Density :'(034), itab_out3-density,
                87(13) t_efkimg unit itab_out-vrkme no-sign,
               121(15) t_ebil_amt currency vbrk-waerk no-sign,
               158(15) t_egp_mvp_amt currency vbrk-waerk no-sign,
               214 ' ',
                /1(214) sy-uline.
          clear: t_efkimg, t_ebil_amt,t_egp_mvp_amt.
        endat.
        at end of mode.
          format reset.
          format color col_total intensified off.
          write:/01 sy-vline,
                 02 'Sub Total of Mode :'(033), itab_out3-mode,
                 87(13) t_fkimg unit itab_out-vrkme no-sign,
                121(15) t_bil_amt no-sign,
                158(15) t_gp_mvp_amt no-sign,
                214 ' ',
                /1(214) sy-uline.
          clear: t_fkimg, t_bil_amt, t_gp_mvp_amt.
        endat.
        at last.
          write:/01 sy-vline,
                 02 'Grand Total :'(032),
                87(13) t_gr_fkimg unit itab_out-vrkme no-sign,
               121(15) t_gr_bil_amt no-sign,
               158(15) t_gr_gp_mvp_amt no-sign,
               214 ' '.
        endat.
        format color off.
      endloop.
      write at /1(214) sy-uline.
    endform.    "invoice_output_dens
    *&      Form  f4_help
          To Get F4 Help to Select File Name
    form f4_help.
      call function 'F4_FILENAME'
           exporting
                program_name  = sy-cprog
                dynpro_number = syst-dynnr
                field_name    = 'P_FILE'
           importing
                file_name     = p_file.
    endform.                                                    " f4_help
    *&      Form  rep_headers
          Report Header
    form rep_headers.
      format color col_heading on.
      format color col_heading on.
      select single butxt from t001 into t001-butxt
                                    where bukrs = s_bukrs-low.
      skip 2.
      write: /2 t001-butxt, 92 'BILLING ANALYSIS'(003),
             190 'Date :'(010),sy-datum.
      write :/2 'Company Code :'(011), s_bukrs-low ,
            85 'Billing Date :'(012) , s_fkdat-low , '-' ,s_fkdat-high ,
            190 'Page :'(013), sy-pagno,
            214 ' '.
      write at /1(214) sy-uline.
      write: /1 sy-vline,  2(10) 'Customer'(004) centered,
             12 sy-vline, 13(10) 'Billing'(009) centered,
             23 sy-vline, 24(6)  'Billing'(009) centered,
             30 sy-vline, 31(10) 'Billing'(009) centered,
             41 sy-vline, 42(6)  'Mode'(006) centered,
             48 sy-vline, 49(7)  'Density'(014) centered,
             56 sy-vline, 57(18) 'Material'(015) centered,
             75 sy-vline, 76(10) 'Batch'(016) centered,
             86 sy-vline, 87(13) 'Quantity'(017) centered,102(3) 'UOM'(027),
             105 sy-vline, 106(14) 'Selling'(018) centered ,
             120 sy-vline, 121(15) 'Billing'(009) centered,
                           138(3) 'Cur'(028),
             141 sy-vline, 142(15) 'Mvg.Avg.Price'(020) centered,
             157 sy-vline, 158(22) 'Gross Profit(MVP)'(022) centered,
             180 sy-vline, 181(33) 'Customer Material'(023) centered,
             214 sy-vline.
      write: /1 sy-vline,  2(10) 'Code'(024) centered,
             12 sy-vline, 13(10) 'Document'(025) centered,
             23 sy-vline, 24(6)  'Item'(026) centered,
             30 sy-vline, 31(10) 'Date'(036) centered,
             41 sy-vline,
             48 sy-vline,
             56 sy-vline,
             75 sy-vline,
             86 sy-vline,
            105 sy-vline, 106(14) 'Price'(030) centered ,
            120 sy-vline, 121(15) 'Amount'(031) centered,
            141 sy-vline, 142(15) '(per Unit)'(019) centered,
            157 sy-vline, 158(15) 'Amount'(031) centered,
            173 sy-vline, 174(6) ' % '(029) centered,
            180 sy-vline,
            214 sy-vline.
      format color off.
    endform.                    " rep_headers
    *&      Form  init_fieldnames
    Initialise all the fields to download in Excel Data File
    form init_fieldnames.
      perform append_fieldname using text-004 'itab_out1'
                                     'KUNAG'    'X'.
      perform append_fieldname using text-037 'itab_out1'
                                     'VBELN'   'X'.
      perform append_fieldname using text-036 'itab_out1'
                                     'FKDAT'  'X'.
      perform append_fieldname using text-038 'itab_out1'
                                     'POSNR'    'X'.
      perform append_fieldname using text-006 'itab_out1'
                                     'MODE' 'X'.
      perform append_fieldname using text-014 'itab_out1'
                                     'DENSITY' 'X'.
      perform append_fieldname using text-015 'itab_out1'
                                     'MATNR'    'X'.
      perform append_fieldname using text-016 'itab_out1'
                                     'CHARG' 'X'.
      perform append_fieldname using text-017 'itab_out1'
                                     'FKIMG'    'X'.
      perform append_fieldname using text-039 'itab_out1'
                                     'VRKME' 'X'.
      perform append_fieldname using text-040 'itab_out1'
                                     'SEL_PRC' 'X'.
      perform append_fieldname using text-041 'itab_out1'
                                     'BIL_AMT' 'X'.
      perform append_fieldname using text-028 'itab_out1'
                                     'WAERK' 'X'.
      perform append_fieldname using text-020 'itab_out1'
                                     'MVG_PRS' 'X'.
      perform append_fieldname using text-044 'itab_out1'
                                     'GP_MVP_AMT' 'X'.
      perform append_fieldname using text-045 'itab_out1'
                                     'GP_MVP_PR' 'X'.
      perform append_fieldname using text-023 'itab_out1'
                                     'KDMAT'         'X'.
    endform.
    *&      Form  append_fieldname
    Appending field Names
    form append_fieldname using p_title p_table p_field p_type.
      clear: fieldnames.
      fieldnames-title = p_title.
      fieldnames-ta

  • I am running 4.0.1 and when I download something the Download box stays blank-even though I have selected in General Preferences 'Show the downloads window when downloading a file' AND selected 'Save files to Downloads'....???

    I am running 4.0.1 and when I download something the Download box stays blank-even though I have selected in General Preferences 'Show the downloads window when downloading a file' AND selected 'Save files to Downloads'....???

    In Firefox Options / Privacy be sure "Remember download history" is checked. To see all of the options on that panel, "Firefox will" must be set to "Use custom settings for history".
    To find your OS information, on your Windows desktop, right-click the My Computer icon, choose Properties, under System on that small window is info about your OS.
    '''If this reply solves your problem, please click "Solved It" next to this reply when <u>signed-in</u> to the forum.'''

  • Changing filename when downloading generated file

    The scenario:
    There is a list of files that logged in users are able to download. The files themselves are not kept within the web root, as we need to be able to ensure that a user has rights to download the file. To do this I have created a JSP page which (a) checks that the user is logged and has appropriate permissions, (b) sets the content type to something the browser does not understand (to ensure the file, which is basically just text is downloaded instead of just displayed in the browser) and (c) gets and includes the content of the file using java.io.File.
    The problem:
    ... with this approach is that it uses a link which looks something like thefile.snd. This means that the file name in the save dialogue always defaults to 'getfile.jsp', when it needs to default to 'thefile.snd'.
    Any ideas? I've considered using an signed applet to do the download and rename the file but would like to avoid this if possible (although if anyone has the source for such an applet that would also be helpful).

    Thanks for the post clem. FYI, I had a similar problem but my data was coming from a database - not a file on disk. At first, setting the content-disposition wasn't working. Then I removed the "file; " part and left just
    response.setHeader("Content-Disposition","filename="+filename);
    and it worked.

  • When I click to open anything I get a box saying open link in new window, open link in new tab, download linked file etc.  When I go to close anything I get hide toolbar, customize toolbar.  It takes  3-5 clicks and it will finally close.

    When I click to open anything I get a box saying open link in new window, open link in new tab, download linked file etc.  When I go to close anything I get hide toolbar, customize toolbar.  It takes  3-5 clicks and it will finally close.

    In Firefox Options / Privacy be sure "Remember download history" is checked. To see all of the options on that panel, "Firefox will" must be set to "Use custom settings for history".
    To find your OS information, on your Windows desktop, right-click the My Computer icon, choose Properties, under System on that small window is info about your OS.
    '''If this reply solves your problem, please click "Solved It" next to this reply when <u>signed-in</u> to the forum.'''

  • After downloading a file, the downloads window pops up, but is always empty. the downloaded files are not visible.

    After downloading a file, the Downloads window pops up but it is always empty. The files downloaded are not visible on this window. In order to access them, they must be sought out via windows explorer. Any ideas? Thanks.

    Be sure Options > Privacy > "Remember download history" is checked.
    *[https://support.mozilla.com/en-US/kb/Options%20window%20-%20Privacy%20panel Options window-Privacy panel]
    If you want to retain download history, do not clear Download History when using Clear Recent History or "Clear history when Firefox closes" > Settings
    *[https://support.mozilla.com/en-US/kb/Clear%20Recent%20History Clear Recent History]
    *Clear history when Firefox closes: [https://support.mozilla.com/en-US/kb/Options%20window%20-%20Privacy%20panel Options window-Privacy panel]
    '''If this reply solves your problem, please click "Solved It" next to this reply when <u>signed-in</u> to the forum.'''
    Not related to your question, but...
    You need to update some plug-ins:
    *Plug-in check: https://www-trunk.stage.mozilla.com/en-US/plugincheck/
    *Adobe Shockwave for Director Netscape plug-in: [https://support.mozilla.com/en-US/kb/Using%20the%20Shockwave%20plugin%20with%20Firefox#w_installing-shockwave Installing ('''''or Updating''''') the Shockwave plugin with Firefox]
    *Adobe PDF Plug-In For Firefox and Netscape: [https://support.mozilla.com/en-US/kb/Using%20the%20Adobe%20Reader%20plugin%20with%20Firefox#w_installing-and-updating-adobe-reader Installing/Updating Adobe Reader in Firefox]
    *Next Generation Java Plug-in for Mozilla browsers: [https://support.mozilla.com/en-US/kb/Using%20the%20Java%20plugin%20with%20Firefox#w_installing-or-updating-java Installing or Updating Java in Firefox]

  • Getting Exception in JWS while downloading jar files from server

    Hi All,
    I am running JWS on j2re1.4.2_10(build 03). while JWS is trying to download jar files from web server, I am getting the following Exception.
    All the jar files are signed. Any idea ?
    JNLPException[category: Download Error : Exception: null : LaunchDesc: null ]
         at com.sun.javaws.cache.DownloadProtocol.doDownload(Unknown Source)
         at com.sun.javaws.cache.DownloadProtocol.getDownloadSize(Unknown Source)
         at com.sun.javaws.LaunchDownload.downloadJarFiles(Unknown Source)
         at com.sun.javaws.LaunchDownload.downloadEagerorAll(Unknown Source)
         at com.sun.javaws.Launcher.downloadResources(Unknown Source)
         at com.sun.javaws.Launcher.handleApplicationDesc(Unknown Source)
         at com.sun.javaws.Launcher.handleLaunchFile(Unknown Source)
         at com.sun.javaws.Launcher.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)

    Are you able to download your *.jar files directly from server
    For example say,
    http://127.0.0.1:8080/test/testme.jarIf yes,
    Then problem should be with your *.jnlp file. Check all your *.jar with respect to context location of your url from where you are downloading *.jnlp file

  • Why does my signin ID and password work to download a file I created?

    Why does my signin ID and password work to download a file I created?

    Hi acastel5,
    Please try signing in using a different browser and check.
    Have you tried resetting the password and checked?
    Regards,
    Rave

  • Digital signed File Upload to XI (PI)

    Hello we need to provide high End-to-End Data Intregity.
    We upload files to XI via FileAdapter, put them to the KM and provide them for download.
    Can the XI (PI) sign these Files? Can we use the XI (PI) as CA (Certification Authority)?
    What are the Best Practise for us?
    It ist very important to ensure the Data Integrity.
    Please help.
    Edited by: Norman Trapp on Aug 7, 2008 1:41 PM

    I am not aware of a optin where file adapters can be used to Sign Files. Digital Signatures are normally used for Non Repudiation purposes and File adapter cannot be used for this.
    With File adapters you can ensure Secure Data and Connection layer by using FTPS - FTP over SSL but you definitely will not be able to sign the file's content.
    Are you using the file adapter for sure? What is the adapter you are using to integrae with KM?
    If you are using SOAP, HTTP adapter or any of the b2b adapters then this is possible, but not with the file adapter of XI.
    Can you explain further if possible if the answer is off track?
    Regards,
    Bhavesh

Maybe you are looking for

  • How do I move photos from one album on my website to another album?

    I have created our family website and on it I have included about 15 photo albums from the past year. To clean things up a bit, I would like to create a couple of "archive" albums with my most favorite pictures from each of my 15 albums and then dele

  • Mirroring MacBook Pro?

    I was wondering if anyone knows if there is a way to mirror a MacBook Pro to Apple TV in the same way an iPad or iPod does? I was able to find and use, as a trial, an app called AirParrot but it costs $9.99. It really is a great idea but I can't help

  • Questions about emailing 5 mg file using Stuffit

    My questions are: Is stuffit compatible with MS i.e. can you unzip it using MS software? If not is there a better one like WinZip? Thanks LarryB

  • Exit to KE26

    Hi Gurus, Using a Program for finding exits with transaction code. i found out that for Transaction KE26 there is an Exit Function Module:EXIT_SAPLKEII_002. And i have written codings . but when i tried to test it the exit is not triggered when i try

  • How to get Current Background Job name and Job Count programmically?

    Hi all,         I have a requirement wherein I need to get the Current Background Job name and Job Count in the program and store it in a custom table. In other words, whenever I schedule a particular program ( This is a Std program) in background, I