Tax Reporter in PDF

Hi all,
In 4.6c we are able to get the tax reporter in sap script but in the upgrade ECC 6.0
i am not getting the tax reporter.
it is shows the errors in the following.
Error in generating the PDF from : HR_F_6559
Error in generating the PDF from : HR_F_W2_01
Error in generating the PDF from : HR_F_W2_Audit
Error in generating the PDF from : HR_F_W2_Summary
Error in generating the PDF from : HR_F_W3_01
Error in generating the PDF from : HR_F_W2_multi_01
Before posting this to sap i would like to know your thoughts.
Regards, and thanks in advance..............

Hi Joe,
I am facing the same issue that you are facing. Please advice me how did u resolverade this issue. As the forms are not getting generated/displayed after the upgrade.
Please do spare some time and mail me for the below mentioned id the solution to overcome this issue.
Thanks a lot.
Regards,
sunita
[email protected]

Similar Messages

  • Not yet solve....TAX Report regarding (client)question

    Client asked to me in interview, please give me answer
    This is regarding US PAYROLL
    1  Transaction PU19 Reports for tax reporting/Tax Returns / Files for State Unemployment Reporting on CD or Diskette :-
      We have issues on some reports regarding address, page numbers and totals. Alex worked on it and told that we need to contact SAP         for help as he thinks problem is with SAP Forms itself.  Currently typing manual returns pending changes to forms.
    2 Deposits on 941 form:-
       Can we update the form to include tax deposits made on the 941 line for deposits?
    3 State Tax Returns not configured in SAP:-
       Can we have state tax returns configured in the PDF format also?
    4 Printing of W-2:-
    Need to be able to print W-2s so we can fold/seal so address apprears on outside for mailing.  Duplex or 11/14 form?  Our folder/sealer uses pressure seal self sealing forms.
    5 Documentation of Processes (Benefit and Garnishment):-
    6 Configure benefit changes for 2009:-
    7 Update benefit tables / rates for 2009:-
    8 'Update SUT rates for new year:-
    9 New 401k Limits Entered :-
    Documentation how to do this
    10 W-2 Reporting, Non Taxable Relocation, Personal Use of Company car (Box 12 and 14 items) for W-2 Reporting:-
    11 Deceased Employee Payments:-
    How do we handle so W-2 is correct and any 1099 items handled correctly
    12 'Mag Media File - Federal (annual):-
    'RS record missing from Magnetic Media file.  Can this be included in the Federal Mag Media file?  Kathy has sent some changes that need to be made to Frank.
    13 'State Mag Media Files and State annual returns:-
    Have some states that we must file by diskette file.  Can we also have annual state tax returns configured in the PDF format?
    14 Federal 940 Return:-
    Make sure this form is configured correctly
    15 Pension Plan Indicator box on W-2:-
    Tested and is not showing on the W-2 or in the Mag Media file
    16 Third Party Sick Pay indicator box  on W-2:-
    Tested and is not showing on the W-2 or in the Mag Media file
    17 Retirement Calculation:-
    18 Year end close procedure:-
    What all has to be done before we can close the year and print W-2's.  Do we have to do any zeroing of wages, taxes and deductions before the first check of the new year can happen?
    19 Sort order for W-2 printing:-
    20 941 Correction Form (941C):-
    Need training on how this is handled
    21 'W-2 correction form (W-2C):-
    Need training on how this is handled
    22 'Payments received in January that affect prior year W-2:-
    'How do we handle.  We receive info in January that must be included on the prior year W-2.  Want to be able to include on original W-2 without filing a W-2C. (Third Party Sick Pay, Payments made in Mexico, Germany, etc) Usually don't receive.
    Regards

    Aswin,
    The client session is your primary TopLink interface abstracting over the shared cache and connection pooling. Depending if you are using internal or external connection pooling and the transaction state you are in TopLink may have a JDBC connection allocated to your client session. A client session does equate to a single dedicated JDBC connection for its entire lifecycle.
    Assuming you are using an external connection pool (Application server's data source) your client session will have a connection from this data source when required to perform a read and during the commit of its UnitOfWork.
    Doug

  • PU19 Tax Reporter - Form 941 spool missing after 4.6c to ECC 6.0 upgrade

    Hi Experts,
    We recently underwent a technical upgrade from 4.6c to ECC 6.0.When we use PU19 tax reporter Form 941 as it is  a federal tax return form in US .When i check in job spool is not coming.Please let me know if some note is release for spool and printout put.
    Looking for your prompt response.
    Thanks & Regards,
    Ankur

    Hello Ankur,
    You need to get the Adobe Document Server running if you are going to
    print PDF files from Tax Reporter. Please have you basis group check
    that the Adobe Document Server is working correctly.
    Please use transaction SFP to test the Adobe Document Server using the
    Tax Reporter forms.
    From Adobe Document Services Implementation Guide;
    Installation Preparation
    Install a SAP Web AS 6.40 J2EE Engine or higher
    A SAP J2EE Engine on Windows is the basis for the Adobe Document
    Services.
    Therefore, before you begin with the installation, make sure that one of
    the following prerequisites are met:
    SAP Web AS J2EE engine on Windows is Installed
    The following installation types are supported:
    - SAP Web AS 6.40 ABAP + J2EE system (J2EE Add-In) or higher
    - SAP Web AS 6.40 J2EE system or higher
    For both variants the following installation options are supported:
    - Central System (Central Instance and Database Instance on one host)
    - Distributed System (Central Instance and Database Instance on separate
    hosts)
    - Dialog Instances
    For information on Adobe and the ADS I would suggest looking at the
    online documentation.
    http://service.sap.com -> SAP Help Portal -> Search on ADOBE and you
    will get the help information on configuration.
    Also review SAP Note No. 944221
    Regards,
    Manny

  • PU19 Tax Reporter - Form 941spool missing after 4.6c to ECC 6.0 upgrade

    Hi Experts,
    We recently underwent a technical upgrade from 4.6c to ECC 6.0.When we use PU19 tax reporter Form 941 as it is  a federal tax return form in US .When i check in job spool is not coming.Please let me know if some note is release for spool and printout put.
    Looking for your prompt response.
    Thanks & Regards,
    Ankur

    Hello Ankur,
    You need to get the Adobe Document Server running if you are going to
    print PDF files from Tax Reporter. Please have you basis group check
    that the Adobe Document Server is working correctly.
    Please use transaction SFP to test the Adobe Document Server using the
    Tax Reporter forms.
    From Adobe Document Services Implementation Guide;
    Installation Preparation
    Install a SAP Web AS 6.40 J2EE Engine or higher
    A SAP J2EE Engine on Windows is the basis for the Adobe Document
    Services.
    Therefore, before you begin with the installation, make sure that one of
    the following prerequisites are met:
    SAP Web AS J2EE engine on Windows is Installed
    The following installation types are supported:
    - SAP Web AS 6.40 ABAP + J2EE system (J2EE Add-In) or higher
    - SAP Web AS 6.40 J2EE system or higher
    For both variants the following installation options are supported:
    - Central System (Central Instance and Database Instance on one host)
    - Distributed System (Central Instance and Database Instance on separate
    hosts)
    - Dialog Instances
    For information on Adobe and the ADS I would suggest looking at the
    online documentation.
    http://service.sap.com -> SAP Help Portal -> Search on ADOBE and you
    will get the help information on configuration.
    Also review SAP Note No. 944221
    Regards,
    Manny

  • Pu19-Tax Reporter

    Hi there,
    We are upgrading to ECC 6.0 When testing pu19 for 941, SUI  and multiple worksite reports,  I am getting PDF form error, whereas W2 works okay.
    Do you guys use Adobe. Is there any alternative if we don't go with Adobe files like Enterprise.
    Your response is greatly appreciated.
    Thanks,
    Gajanan

    Hello Gajanan,
    Has your issue for tax reporter resolved. We are also facing the similar issue.
    Thanks
    Sachin

  • Need a sample of Withholding Tax Report

    Hi,
    Can anyone send me a sample of SAP Business One's Withholding Tax Report as my current database do not hold any data on it. If possible, can I have it in PDF format?
    PS: I am currently using 2007B
    Thanks,
    Gavin
    Edited by: Tan Gavin on Jan 5, 2009 9:42 AM

    Hi Gavin,
    There is no standard report for withholding Tax.you can develop one by Query generator or through XL Reporter or through Crystal Reports. you just need to know which are the tables that store the value you need and the conditions you want to mention. to know the table name you can go to View->check System Information. at the bottom you will know the Table name as well as field name.
    regards
    Shreyas

  • Tax Reporter HELPPPPP.. please....

    Hello Gurus,
    for tax reporter in 6.0 you use PDF now, no SAPScript. My questions are along the lines of can't I use the delivered PDF forms or do I have to copy them? How much config do I have to do to get the tax reports and forms out?
    Any help is greatly appreciated and points awarded..
    Thanks in Advance..
    Soniya Singh...

    Hi Soniya,
    The most recommended approach is to use SAP delivered Tax reporter PDF Forms. The reason is SAP has already covered all the major legal requirements in Tax reporter. You need to map your wage types to proper tax form groups and you will see the result.
    If you have some specific requirements on the Mag Media you can copy standard to Z copy and make the changes.
    I will forward you one PPT file which will tell you more about the Tax reporter.
    Provide me with you email address.
    Thank you,
    Arti

  • ADS in Tax reporter :US Payroll

    Hi ,
    Can anyone tel me what is use of ADS in Tax reporting. how to configure ADS in tax reporter.
    pls. help
    Thanks
    Eliz

    ADS is used to generate tax forms in PDF format in SAP system. ADS can also be used portal.
    We being HCM consultant does not do ADS configuration. Contact your basis and ask them to setup ADS for you.
    Arti

  • Dynamic CRM 2013 Online how to execute Report, generate PDF and email

    Dear All,
    I am using Dynamic CRM 2013 online. For quote, I have workflow and Dialogue processes for review process. On approval, I want the system to generate a PDF of quote report, attach the PDF and email it to the Customer.
    Better I would like, When approver, clicks on the approve button, the system should auto generate a PDF of quote report, attach the PDF and email it to the Customer, without any further input from the user. If its not possible, I may have to put button on
    quote form.
    I am using the attached code, but facing various issues.
    1. Under prepare the SOAP Message coding part, I am not sure what should be the below URL for CRM 2013 Online?
    xHReq.Open("POST", "/mscrmservices/2007/CrmService.asmx", false);
    2. What should be the emailid here? Is it Recepient Contact id(Guid) ?
    var emailid = resultXml.selectSingleNode("//CreateResult").nodeTypedValue;
    alert("emailid" + emailid.toString());
    3. Using this code, not able to create Entity for "ActivityMimeAttachment", I am getting newEntity as undefined.
    Below is the code I am using. Please check and help me out, where I am going wrong. Let me know if any better way to implement it. At present, I have put one button on quote form, on click event, below code will get executed.
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title></title>
    <script type="text/javascript">
    var Xrm;
    if (window.opener) { Xrm = window.opener.Xrm; }
    else if (window.parent) { Xrm = window.parent.Xrm; }
    function getReportingSession() {
    var reportName = "Quotation_Report"; //set this to the report you are trying to download
    var reportId = "7C39D18F-1DC6-E311-8986-D89D6765B238"; //set this to the guid of the report you are trying to download
    var recordid = Xrm.Page.data.entity.getId();
    // recordid = recordid.substring(1, 37); //getting rid of curly brackets
    alert(recordid);
    var pth = Xrm.Page.context.getServerUrl() + "/CRMReports/rsviewer/reportviewer.aspx";
    var retrieveEntityReq = new XMLHttpRequest();
    retrieveEntityReq.open("POST", pth, false);
    retrieveEntityReq.setRequestHeader("Accept", "*/*");
    retrieveEntityReq.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    retrieveEntityReq.send("id=%7B" + reportId + "%7D&uniquename=" + Xrm.Page.context.getOrgUniqueName() + "&iscustomreport=true&reportnameonsrs=&reportName=" + reportName + "&isScheduledReport=false");
    var x = retrieveEntityReq.responseText.indexOf("ReportSession=");
    var ret = new Array();
    ret[0] = retrieveEntityReq.responseText.substr(x + 14, retrieveEntityReq.responseText.indexOf("&", x) - x - 14); //the session id
    x = retrieveEntityReq.responseText.indexOf("ControlID=");
    ret[1] = retrieveEntityReq.responseText.substr(x + 10, retrieveEntityReq.responseText.indexOf("&", x) - x - 10); //the control id
    return ret;
    function createEntity(ent, entName, upd) {
    var jsonEntity = JSON.stringify(ent);
    var createEntityReq = new XMLHttpRequest();
    var ODataPath = Xrm.Page.context.getServerUrl() + "XRMServices/2011/OrganizationData.svc";
    createEntityReq.open("POST", ODataPath + "/" + entName + "Set" + upd, false);
    createEntityReq.setRequestHeader("Accept", "application/json");
    createEntityReq.setRequestHeader("Content-Type", "application/json; charset=utf-8");
    createEntityReq.send(jsonEntity);
    var newEntity = JSON.parse(createEntityReq.responseText).d;
    alert("new entity" + newEntity);
    return newEntity;
    function createAttachment() {
    var params = getReportingSession();
    var recordid = Xrm.Page.data.entity.getId();
    alert("recordid " + recordid);
    var orgName = Xrm.Page.context.getOrgUniqueName();
    var userID = Xrm.Page.context.getUserId();
    //create email record
    // Prepare the SOAP message.
    var xml = "<?xml version='1.0' encoding='utf-8'?>" +"<soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'" +
    " xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'" +
    " xmlns:xsd='http://www.w3.org/2001/XMLSchema'>" +
    "<soap:Header>" +
    "</soap:Header>" +
    "<soap:Body>" +
    "<Create xmlns='http://schemas.microsoft.com/crm/2007/WebServices'>" +
    "<entity xsi:type='email'>" +
    "<regardingobjectid type='quote'>" + recordid + "</regardingobjectid>" +
    "<subject>" + "Email with Attachment4" + "</subject>" +
    "</entity>" +
    "</Create>" +
    "</soap:Body>" +
    "</soap:Envelope>";
    // Prepare the xmlHttpObject and send the request.
    var xHReq = new ActiveXObject("Msxml2.XMLHTTP");
    xHReq.Open("POST", "/mscrmservices/2007/CrmService.asmx", false);
    xHReq.setRequestHeader("SOAPAction", "http://schemas.microsoft.com/crm/2007/WebServices/Create");
    xHReq.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
    xHReq.setRequestHeader("Content-Length", xml.length);
    xHReq.send(xml);
    // Capture the result
    var resultXml = xHReq.responseXML;
    // alert("resultXml " + resultXml);
    // Check for errors.
    var errorCount = resultXml.selectNodes('//error').length;
    if (errorCount != 0) {
    alert("ERROR");
    var msg = resultXml.selectSingleNode('//description').nodeTypedValue;
    alert(msg);
    var emailid = resultXml.selectSingleNode("//CreateResult").nodeTypedValue;
    alert("emailid" + emailid.toString());
    //var emailid = userID;
    var post = Object();
    post.Body = encodePdf(params);
    var email = new Array();
    email[0] =new Object();
    email[0].id = emailid;
    email[0].entityType ='email';
    post.Subject ="File Attachment";
    post.AttachmentNumber = 1;
    post.FileName ="Report.pdf";
    post.MimeType ="application/pdf";
    post.ObjectId = Object();
    post.ObjectId.LogicalName ="email";
    post.ObjectId.Id = email[0].id;
    post.ObjectTypeCode ="email";
    alert(post.ObjectId.Id);
    createEntity(post,"ActivityMimeAttachment", "");
    alert("created successfully");
    email.Subject = "Your Order";
    //Set The current order as the Regarding object
    email.RegardingObjectId = {
    Id: Xrm.Page.data.entity.getId(), //Get the current entity Id , here OrderId
    LogicalName: Xrm.Page.data.entity.getEntityName()//Get the current entity name, here it will be “salesOrder”
    //Create Email Activity
    SDK.JScriptRESTDataOperations.Create(email, "Email", EmailCallBack, function (error) { alert(error.message); });
    // Email Call Back function
    function EmailCallBack(result) {
    email = result; // Set the email to result to use it later in email attachment for retrieving activity Id
    var activityPartyFrom = new Object();
    // Set the From party of the ActivityParty to relate an entity with Email From field
    activityPartyFrom.PartyId = {
    Id: customerId, // id of entity you want to associate this activity with.
    LogicalName: "contact"
    // Set the "activity" of the ActivityParty
    activityPartyFrom.ActivityId = {
    Id: result.ActivityId,
    LogicalName: "email"
    // Now set the participation type that describes the role of the party on the activity).
    activityPartyFrom.ParticipationTypeMask = { Value: 2 }; // 2 means ToRecipients
    // Create the from ActivityParty for the email
    SDK.JScriptRESTDataOperations.Create(activityPartyFrom, "ActivityParty", ActivityPartyFromCallBack, function (error) { alert(error.message); });
    var activityPartyTo = new Object();
    // Set the From party of the ActivityParty to relate an entity with Email From field
    activityPartyTo.PartyId = {
    Id: ownerId, // id of entity you want to associate this activity with.
    LogicalName: "systemuser"
    // Set the "activity" of the ActivityParty
    activityPartyTo.ActivityId = {
    Id: result.ActivityId,
    LogicalName: "email"
    // Now set the participation type that describes the role of the party on the activity). activityPartyTo.ParticipationTypeMask = { Value: 1 }; // 1 means Sender
    // Create the from ActivityParty
    SDK.JScriptRESTDataOperations.Create(activityPartyTo, "ActivityParty", ActivityPartyToCallBack, function (error) { alert(error.message); });
    //ActivityParty From Callback
    function ActivityPartyFromCallBack(result) {
    //ActivityParty To Callback
    function ActivityPartyToCallBack(result) {
    var StringMaker = function () {
    this.parts = [];
    this.length = 0;
    this.append = function (s) {
    this.parts.push(s);
    this.length += s.length;
    this.prepend = function (s) {
    this.parts.unshift(s);
    this.length += s.length;
    this.toString = function () {
    return this.parts.join('');
    var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
    function encode64(input) {
    var output = new StringMaker();
    var chr1, chr2, chr3;
    var enc1, enc2, enc3, enc4;
    var i = 0;
    while (i < input.length) {
    chr1 = input[i++];
    chr2 = input[i++];
    chr3 = input[i++];
    enc1 = chr1 >> 2;
    enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
    enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
    enc4 = chr3 & 63;
    if (isNaN(chr2)) {
    enc3 = enc4 = 64;
    else if (isNaN(chr3)) {
    enc4 = 64;
    output.append(keyStr.charAt(enc1) + keyStr.charAt(enc2) + keyStr.charAt(enc3) + keyStr.charAt(enc4));
    return output.toString();
    var bdy = new Array();
    var bdyLen = 0;
    function concat2Bdy(x) {
    bdy[bdyLen] = x;
    bdyLen++;
    function encodePdf(params) {
    bdy = new Array();
    bdyLen = 0;
    var retrieveEntityReq = new XMLHttpRequest();
    var pth = Xrm.Page.context.getServerUrl() + "/Reserved.ReportViewerWebControl.axd?ReportSession=" + params[0] + "&Culture=1033&CultureOverrides=True&UICulture=1033&UICultureOverrides=True&ReportStack=1&ControlID=" + params[1] + "&OpType=Export&FileName=Public&ContentDisposition=OnlyHtmlInline&Format=PDF";
    retrieveEntityReq.open("GET", pth, false);
    retrieveEntityReq.setRequestHeader("Accept", "*/*");
    retrieveEntityReq.send();
    BinaryToArray(retrieveEntityReq.responseBody);
    return encode64(bdy);
    </SCRIPT>
    <SCRIPT type=text/vbscript>
    Function BinaryToArray(Binary)
    Dim i
    ReDim byteArray(LenB(Binary))
    For i = 1 To LenB(Binary)
    byteArray(i-1) = AscB(MidB(Binary, i, 1))
    concat2Bdy(AscB(MidB(Binary, i, 1)))
    Next
    BinaryToArray = byteArray
    End Function
    </SCRIPT>
    </head>
    <body>
    <input type="button" onclick="createAttachment();" value="Attach Report" />
    </body>
    </html>
    Thanks. and waiting for your valuable comments.
    - Mittal

    Hello,
    Yes, I was able to make my code working as below. Tested on CRM online 2013.
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title></title>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script>
    <script type="text/javascript">
    if (typeof (SDK) == "undefined")
    { SDK = { __namespace: true }; }
    SDK.JScriptRESTDataOperations = {
    _context: function () {
    if (typeof GetGlobalContext != "undefined")
    { return GetGlobalContext(); }
    else {
    if (typeof Xrm != "undefined") {
    return Xrm.Page.context;
    else { return new Error("Context is not available."); }
    _getServerUrl: function () {
    var serverUrl = this._context().getServerUrl()
    if (serverUrl.match(/\/$/)) {
    serverUrl = serverUrl.substring(0, serverUrl.length - 1);
    return serverUrl;
    _ODataPath: function () {
    return this._getServerUrl() + "/XRMServices/2011/OrganizationData.svc/";
    _errorHandler: function (req) {
    return new Error("Error : " +
    req.status + ": " +
    req.statusText + ": " +
    JSON.parse(req.responseText).error.message.value);
    _dateReviver: function (key, value) {
    var a;
    if (typeof value === 'string') {
    a = /Date\(([-+]?\d+)\)/.exec(value);
    if (a) {
    return new Date(parseInt(value.replace("/Date(", "").replace(")/", ""), 10));
    return value;
    Create: function (object, type, successCallback, errorCallback) {
    var req = new XMLHttpRequest();
    req.open("POST", this._ODataPath() + type + "Set", true);
    req.setRequestHeader("Accept", "application/json");
    req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
    req.onreadystatechange = function () {
    if (this.readyState == 4 /* complete */) {
    if (this.status == 201) {
    successCallback(JSON.parse(this.responseText, SDK.JScriptRESTDataOperations._dateReviver).d);
    else {
    errorCallback(SDK.JScriptRESTDataOperations._errorHandler(this));
    req.send(JSON.stringify(object));
    Retrieve: function (id, type, successCallback, errorCallback) {
    var req = new XMLHttpRequest();
    req.open("GET", this._ODataPath() + type + "Set(guid'" + id + "')", true);
    req.setRequestHeader("Accept", "application/json");
    req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
    req.onreadystatechange = function () {
    if (this.readyState == 4 /* complete */) {
    if (this.status == 200) {
    successCallback(JSON.parse(this.responseText, SDK.JScriptRESTDataOperations._dateReviver).d);
    else {
    errorCallback(SDK.JScriptRESTDataOperations._errorHandler(this));
    req.send();
    Update: function (id, object, type, successCallback, errorCallback) {
    var req = new XMLHttpRequest();
    req.open("POST", this._ODataPath() + type + "Set(guid'" + id + "')", true);
    req.setRequestHeader("Accept", "application/json");
    req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
    req.setRequestHeader("X-HTTP-Method", "MERGE");
    req.onreadystatechange = function () {
    if (this.readyState == 4 /* complete */) {
    if (this.status == 204 || this.status == 1223) {
    successCallback();
    else {
    errorCallback(SDK.JScriptRESTDataOperations._errorHandler(this));
    req.send(JSON.stringify(object));
    Delete: function (id, type, successCallback, errorCallback) {
    var req = new XMLHttpRequest();
    req.open("POST", this._ODataPath() + type + "Set(guid'" + id + "')", true);
    req.setRequestHeader("Accept", "application/json");
    req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
    req.setRequestHeader("X-HTTP-Method", "DELETE");
    req.onreadystatechange = function () {
    if (this.readyState == 4 /* complete */) {
    if (this.status == 204 || this.status == 1223) {
    successCallback();
    else {
    errorCallback(SDK.JScriptRESTDataOperations._errorHandler(this));
    req.send();
    RetrieveMultiple: function (type, filter, successCallback, errorCallback) {
    if (filter != null) {
    filter = "?" + filter;
    else { filter = ""; }
    var req = new XMLHttpRequest();
    req.open("GET", this._ODataPath() + type + "Set" + filter, true);
    req.setRequestHeader("Accept", "application/json");
    req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
    req.onreadystatechange = function () {
    if (this.readyState == 4 /* complete */) {
    if (this.status == 200) {
    successCallback(JSON.parse(this.responseText, SDK.JScriptRESTDataOperations._dateReviver).d.results);
    else {
    errorCallback(SDK.JScriptRESTDataOperations._errorHandler(this));
    req.send();
    __namespace: true
    </script>
    <script type="text/javascript">
    //Create Email and link it with Order as Regarding field
    var Xrm;
    var email = new Object();
    var ownerID = "";
    var CustomerId = "";
    if (window.opener) { Xrm = window.opener.Xrm; }
    else if (window.parent) { Xrm = window.parent.Xrm; }
    //Get ownerid who send email of quotation to customer
    function GetOwnerID() {
    var owner = Xrm.Page.getAttribute("ownerid").getValue();
    ownerID = owner[0].id;
    var ownerName = owner[0].name;
    var entityType = owner[0].entityType;
    GetToEmailGUID();
    //Get customerid who receive email of quotation from owner
    function GetToEmailGUID() {
    var Customer = Xrm.Page.getAttribute('customerid').getValue();
    CustomerId = Customer[0].id;
    var CustomerName = Customer[0].name;
    var entityType = Customer[0].entityType;
    //if CustomerId is type of "Account" then get Primary Contact id of that account
    if (entityType == "account") {
    var contact = Xrm.Page.getAttribute("customerid").getValue();
    if (contact === null) return;
    var serverUrl = Xrm.Page.context.getClientUrl();
    var oDataSelect = serverUrl + "/XRMServices/2011/OrganizationData.svc/AccountSet(guid'" + contact[0].id + "')?$select=PrimaryContactId";
    var req = new XMLHttpRequest();
    req.open("GET", oDataSelect, false);
    req.setRequestHeader("Accept", "application/json");
    req.setRequestHeader("Content-Type", "application/json;charset=utf-8");
    req.onreadystatechange = function () {
    if (req.readyState === 4) {
    if (req.status === 200) {
    var retrieved = JSON.parse(req.responseText).d;
    CustomerId = retrieved.PrimaryContactId.Id;
    else {
    alert(this.statusText);
    req.send();
    function CreateEmail() {
    GetOwnerID();
    email.Subject = "Email with Report Attachment";
    //Set The current order as the Regarding object
    email.RegardingObjectId = {
    Id: Xrm.Page.data.entity.getId(), //Get the current entity Id , here OrderId
    LogicalName: Xrm.Page.data.entity.getEntityName()//Get the current entity name, here it will be “salesOrder”
    //Create Email Activity
    SDK.JScriptRESTDataOperations.Create(email, "Email", EmailCallBack, function (error) { alert(error.message); });
    // Email Call Back function
    function EmailCallBack(result) {
    email = result; // Set the email to result to use it later in email attachment for retrieving activity Id
    var activityPartyFrom = new Object();
    // Set the From party of the ActivityParty to relate an entity with Email From field
    activityPartyFrom.PartyId = {
    Id: CustomerId, //"79EBDD26-FDBE-E311-8986-D89D6765B238", // id of entity you want to associate this activity with.
    LogicalName: "contact"
    // Set the "activity" of the ActivityParty
    activityPartyFrom.ActivityId = {
    Id: result.ActivityId,
    LogicalName: "email"
    // Now set the participation type that describes the role of the party on the activity).
    activityPartyFrom.ParticipationTypeMask = { Value: 2 }; // 2 means ToRecipients
    // Create the from ActivityParty for the email
    SDK.JScriptRESTDataOperations.Create(activityPartyFrom, "ActivityParty", ActivityPartyFromCallBack, function (error) { alert(error.message); });
    var activityPartyTo = new Object();
    // Set the From party of the ActivityParty to relate an entity with Email From field
    activityPartyTo.PartyId = {
    Id: ownerID, //"79EBDD26-FDBE-E311-8986-D89D6765B238", // id of entity you want to associate this activity with.
    LogicalName: "systemuser"
    // Set the "activity" of the ActivityParty
    activityPartyTo.ActivityId = {
    Id: result.ActivityId,
    LogicalName: "email"
    // Now set the participation type that describes the role of the party on the activity).
    activityPartyTo.ParticipationTypeMask = { Value: 1 }; // 1 means Sender
    // Create the from ActivityParty
    SDK.JScriptRESTDataOperations.Create(activityPartyTo, "ActivityParty", ActivityPartyToCallBack, function (error) { alert(error.message); });
    //ActivityParty From Callback
    function ActivityPartyFromCallBack(result) {
    //ActivityParty To Callback
    function ActivityPartyToCallBack(result) {
    GetReportId('Quotation');
    //Create attachment for the created email
    function CreateEmailAttachment() {
    //get reporting session and use the params to convert a report in PDF
    var params = getReportingSession();
    //Email attachment parameters
    var activitymimeattachment = Object();
    activitymimeattachment.ObjectId = Object();
    activitymimeattachment.ObjectId.LogicalName = "email";
    activitymimeattachment.ObjectId.Id = email.ActivityId;
    activitymimeattachment.ObjectTypeCode = "email",
    activitymimeattachment.Subject = "File Attachment";
    activitymimeattachment.Body = encodePdf(params);
    activitymimeattachment.FileName = "Report.pdf";
    activitymimeattachment.MimeType = "application/pdf";
    //Attachment call
    SDK.JScriptRESTDataOperations.Create(activitymimeattachment, "ActivityMimeAttachment", ActivityMimeAttachmentCallBack, function (error) { alert(error.message); });
    //ActivityMimeAttachment CallBack function
    function ActivityMimeAttachmentCallBack(result) {
    var features = "location=no,menubar=no,status=no,toolbar=no,resizable=yes";
    var width = "800px";
    var height = "600px";
    window.open(Xrm.Page.context.getServerUrl() + "main.aspx?etc=" + 4202 + "&pagetype=entityrecord&id=" + email.ActivityId, "_blank", features);
    // To open window which works in outlook and IE both
    //openStdWin(Xrm.Page.context.getServerUrl() + "main.aspx?etc=" + 4202 + "&pagetype=entityrecord&id=" + email.ActivityId, "_blank", width, height, features);
    //This method will get the reportId based on a report name that will be used in getReportingSession() function
    function GetReportId(reportName) {
    var oDataSetName = "ReportSet";
    var columns = "ReportId";
    var filter = "Name eq '" + reportName + "'";
    retrieveMultiple(oDataSetName, columns, filter, onSuccess);
    function retrieveMultiple(odataSetName, select, filter, successCallback) {
    var serverUrl = Xrm.Page.context.getServerUrl();
    var ODATA_ENDPOINT = "/XRMServices/2011/OrganizationData.svc";
    var odataUri = serverUrl + ODATA_ENDPOINT + "/" + odataSetName + "?";
    if (select) {
    odataUri += "$select=" + select + "&";
    if (filter) {
    odataUri += "$filter=" + filter;
    $.ajax({
    type: "GET",
    contentType: "application/json; charset=utf-8",
    datatype: "json",
    url: odataUri,
    beforeSend: function (XMLHttpRequest) {
    XMLHttpRequest.setRequestHeader("Accept", "application/json");
    success: function (data) {
    if (successCallback) {
    if (data && data.d && data.d.results) {
    successCallback(data.d.results);
    else if (data && data.d) {
    successCallback(data.d);
    else {
    successCallback(data);
    error: function (XmlHttpRequest, errorThrown) {
    if (XmlHttpRequest && XmlHttpRequest.responseText) {
    alert("Error while retrieval ; Error – " + XmlHttpRequest.responseText);
    function onSuccess(data) {
    reportId = data[0].ReportId.replace('{', ").replace('}', ");
    CreateEmailAttachment(); // Create Email Attachment
    //Gets the report contents
    function getReportingSession() {
    var pth = Xrm.Page.context.getServerUrl() + "/CRMReports/rsviewer/reportviewer.aspx";
    var retrieveEntityReq = new XMLHttpRequest();
    var Id = Xrm.Page.data.entity.getId();
    var quotationGUID = Id.replace('{', ""); //set this to selected quotation GUID
    quotationGUID = quotationGUID.replace('}', "");
    var reportName = "Quotation"; //set this to the report you are trying to download
    var reportID = "7C39D18F-1DC6-E311-8986-D89D6765B238"; //set this to the guid of the report you are trying to download
    var rptPathString = ""; //set this to the CRMF_Filtered parameter
    var strParameterXML = "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'><entity name='quote'><all-attributes /><filter type='and'><condition attribute='quoteid' operator='eq' uitype='quote' value='" + quotationGUID + "' /> </filter></entity></fetch>";
    retrieveEntityReq.open("POST", pth, false);
    retrieveEntityReq.setRequestHeader("Accept", "*/*");
    retrieveEntityReq.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    rptPathString = "id=%7B" + reportID + "%7D&uniquename=" + Xrm.Page.context.getOrgUniqueName() + "&iscustomreport=true&reportnameonsrs=&reportName=" +
    reportName + "&isScheduledReport=false&p:CRMAF_Filteredquote=" + strParameterXML;
    //remove the part starting from &p:salesorderid if your report has no parameters
    retrieveEntityReq.send(rptPathString);
    var x = retrieveEntityReq.responseText.indexOf("ReportSession=");
    var ret = new Array();
    ret[0] = retrieveEntityReq.responseText.substr(x + 14, retrieveEntityReq.responseText.indexOf("&", x) - x - 14); //the session id
    x = retrieveEntityReq.responseText.indexOf("ControlID=");
    ret[1] = retrieveEntityReq.responseText.substr(x + 10, retrieveEntityReq.responseText.indexOf("&", x) - x - 10); //the control id
    return ret;
    var bdy = new Array();
    var bdyLen = 0;
    function concat2Bdy(x) {
    bdy[bdyLen] = x;
    bdyLen++;
    function encodePdf(params) {
    bdy = new Array();
    bdyLen = 0;
    var retrieveEntityReq = new XMLHttpRequest();
    var pth = Xrm.Page.context.getServerUrl() + "/Reserved.ReportViewerWebControl.axd?ReportSession=" + params[0] +
    "&Culture=1033&CultureOverrides=True&UICulture=1033&UICultureOverrides=True&ReportStack=1&ControlID=" + params[1] +
    "&OpType=Export&FileName=Public&ContentDisposition=OnlyHtmlInline&Format=PDF";
    retrieveEntityReq.open("GET", pth, false);
    retrieveEntityReq.setRequestHeader("Accept", "*/*");
    retrieveEntityReq.send();
    BinaryToArray(retrieveEntityReq.responseBody);
    return encode64(bdy);
    var StringMaker = function () {
    this.parts = [];
    this.length = 0;
    this.append = function (s) {
    this.parts.push(s);
    this.length += s.length;
    this.prepend = function (s) {
    this.parts.unshift(s);
    this.length += s.length;
    this.toString = function () {
    return this.parts.join('');
    var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
    function encode64(input) {
    var output = new StringMaker();
    var chr1, chr2, chr3;
    var enc1, enc2, enc3, enc4;
    var i = 0;
    while (i < input.length) {
    chr1 = input[i++];
    chr2 = input[i++];
    chr3 = input[i++];
    enc1 = chr1 >> 2;
    enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
    enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
    enc4 = chr3 & 63;
    if (isNaN(chr2)) {
    enc3 = enc4 = 64;
    } else if (isNaN(chr3)) {
    enc4 = 64;
    output.append(keyStr.charAt(enc1) + keyStr.charAt(enc2) + keyStr.charAt(enc3) + keyStr.charAt(enc4));
    return output.toString();
    </script>
    <script type="text/vbscript">
    Function BinaryToArray(Binary)
    Dim i
    ReDim byteArray(LenB(Binary))
    For i = 1 To LenB(Binary)
    byteArray(i-1) = AscB(MidB(Binary, i, 1))
    concat2Bdy(AscB(MidB(Binary, i, 1)))
    Next
    BinaryToArray = byteArray
    End Function
    </script>
    </head>
    <body>
    <input type="button" onclick="CreateEmail();" value="Attach Report" />
    </body>
    </html>
    Thank you,
    Mittal.

  • TAx Reporter Temse Files Download Automation

    Hi,
    I have a reuiqrement to download the Temse files generated in Tax Reporter. I have completed the code and it works fine if we run the program in foreground. But when I run the same program in background some Temse files downloaded have junk characters. If I download the same Temse file in foreground it works fine.
    There seems to be some issue with the FM when I run my progam in background.
    I have searched SDN and SAP Notes for any clues but did not get any.
    REPORT  ZPHOP_TEMSE  NO STANDARD PAGE HEADING
                      LINE-SIZE 1023
                      LINE-COUNT 65
                      MESSAGE-ID zz.
    DATA: BEGIN OF tape OCCURS 1,
             DATA(2000),
          END OF tape.
    DATA: force_ascii type c VALUE 'T'.
    DATA:  BEGIN OF int_msgs2 OCCURS 10,
             errnum(2) TYPE c,
             text1(8) TYPE c,
             text2(60) TYPE c,
           END OF int_msgs2.
    DATA: BEGIN OF g_int_temse OCCURS 0,
             dname    LIKE TST01-dname,
             dpart    LIKE TST01-dpart,
             dcretime LIKE TST01-DCRETIME,
             dcreater LIKE TST01-DCREATER,
          END OF g_int_temse.
    DATA: record_length  TYPE i VALUE 275,
           data_length    TYPE i,
           convert_to_ebcdic,
           filesize TYPE i,
           number_of_records TYPE i VALUE 1,
           filetype(3) VALUE 'BIN',
           conv TYPE REF TO cl_abap_conv_out_ce,
           dline TYPE REF TO data,
           dtab TYPE REF TO data,
           p_compid(4),
           p_pswd(8),
           g_str(2000),
           uc_filename TYPE string.
    DATA: l_nm_fixed_record.
    CONSTANTS: c_lpath TYPE pathintern VALUE 'ZOUT'.
    TABLES: TST01, ZPHOPFLS, ZTEMSE_LOG, V_5UXY_A.
    FIELD-SYMBOLS: <dtab> TYPE STANDARD TABLE,
                   <dline> TYPE ANY.
    INCLUDE: dbpnpcom.           " No logical database        Do not modify!
    INCLUDE: zphoptop,           " Top Include                Do not modify!
             zphopfil.           " File inlcude               Do not modify!
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE text-T01.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(30) text-001.
    SELECT-OPTIONS  s_temse FOR TST01-dname NO INTERVALS.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN END OF BLOCK B1.
    SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE text-T02.
    SELECT-OPTIONS  s_cai   FOR TST01-DCREATER NO INTERVALS.
    SELECT-OPTIONS  s_date  FOR sy-datum.
    SELECTION-SCREEN END OF BLOCK B2.
    SELECTION-SCREEN BEGIN OF BLOCK B3 WITH FRAME TITLE text-T03.
    PARAMETERS: p_ifid   LIKE t9aoa-if_id MODIF ID DIS ,
                p_fileid LIKE t9aoa-file_id MODIF ID DIS,
                p_unixf(60)  LOWER CASE MODIF ID DIS,
                p_uxdir  TYPE pathextern LOWER CASE MODIF ID DIS,
                p_dstfil(45) LOWER CASE MODIF ID DIS.
    SELECTION-SCREEN END OF BLOCK B3.
    PARAMETERS: p_skip AS CHECKBOX.
    DATA: ws_unixr LIKE p_unixf,
          ws_trans LIKE p_unixf.
    AT SELECTION-SCREEN OUTPUT.
      LOOP AT SCREEN.
        IF screen-group1 = 'DIS'.
          screen-output = '1'.
          screen-input  = '0'.
          MODIFY SCREEN.
        ENDIF.
      ENDLOOP.
    INITIALIZATION.
      p_ifid = 'PAYFLS'.
      p_compid = 'HR00'.
      p_fileid = '01'.
      p_unixf = 'AFS'.
      p_pswd = 'chevr123'.
      p_skip = 'X'.
    -End of Initialization--
      PERFORM get_physical_path.
      FORMAT COLOR COL_HEADING.
      WRITE: /01 text-t04,
              10 sy-pagno,
              41 text-t05,
             110 text-t06,
             123 sy-datum.
      WRITE: /01 text-t08,
              14 sy-repid,
             110 text-t07,
             125 sy-uzeit.
      FORMAT COLOR OFF.
      SKIP.
      WRITE: /(20) text-T21       CENTERED COLOR COL_HEADING,
              (15) text-T22       CENTERED COLOR COL_HEADING,
              (20) text-T23       CENTERED COLOR COL_HEADING,
              (15) text-T24       CENTERED COLOR COL_HEADING,
              (40) text-T25       CENTERED COLOR COL_HEADING.
    START-OF-SELECTION.
    *Do not allow background processing
    *Check if the Temse file and CAI both are entered
    IF NOT S_TEMSE IS INITIAL AND NOT S_CAI IS INITIAL.
       MESSAGE W999 WITH TEXT-E01.
    ELSEIF S_TEMSE IS INITIAL AND S_CAI IS INITIAL.
       MESSAGE W999 WITH TEXT-E02.
    ENDIF.
    Collect all temse filenames from TST01 into an internal table.
    IF NOT s_temse IS INITIAL.
       SELECT dname dpart dcretime dcreater FROM TST01 INTO TABLE g_int_temse
              WHERE dname in s_temse
              AND   dpart EQ '1'.
    ELSE.
       SELECT * FROM TST01
              WHERE DCREATER in s_cai
              AND   DPART EQ '1'.
         IF TST01-DCRETIME(8) GE s_date-low
             AND TST01-DCRETIME(8) LE s_date-high.
            MOVE-CORRESPONDING TST01 TO g_int_temse.
            APPEND g_int_temse.
         ENDIF.
       ENDSELECT.
    ENDIF.
    SORT g_int_temse BY DNAME DPART DCRETIME.
    LOOP AT g_int_temse.
    Check if the temse file is already processed in ZTEMSE_LOG table.
      SELECT SINGLE * FROM ZTEMSE_LOG
             WHERE DNAME = g_int_temse-dname.
      IF sy-subrc EQ 0.
    error. Temse already processed
         CONTINUE.
      ENDIF.
    Check if the temse file bieng processed is the eligible temse file
      SELECT SINGLE * FROM V_5UXY_A
             WHERE TSOBJ = g_int_temse-dname.
      IF sy-subrc EQ 0.
         SELECT SINGLE * FROM ZPHOPFLS
             WHERE TAXAU = V_5UXY_A-TAXAU
             AND   TXFRM = V_5UXY_A-TXFRM.
         IF sy-subrc EQ 0.
    Generate the filename for the target destination
            CONCATENATE ZPHOPFLS-FILENAME '.' sy-datum '.' sy-uzeit INTO p_dstfil.
         ELSE.
    error. Script not maintained in ZPHOPFLS table
            CONTINUE.
         ENDIF.
      ELSE.
    error. Temse file is not the latest processed file.
         CONTINUE.
      ENDIF.
      CALL FUNCTION 'RP_TS_OPEN'
        EXPORTING
          tsobj = g_int_temse-dname
         versn = g_int_temse-dpart
          empfg = 'RPUTSVUM'.
      COMMIT WORK.
      REFRESH tape.
      CLEAR   tape.
    Einlesen von der TemSe
      CALL FUNCTION 'RSTS_READ'
        EXPORTING
           PARTS1BY1 = 'X'
        TABLES
          datatab = tape.
      CALL FUNCTION 'RSTS_CLOSE'.
    Read the 1st line which is supposed to contains info important for
    the downloading procedure. The syntax of the line is :
      SAPxxxnnnyyyy  - the 1st 3 char 'SAP' indicates this line contains
    download related info. xxx can either be 'ASC' (for ASCII) or 'EBC'
    (for EBCDIC). nnn is the length of each record, e.g. 128 for SSA disk
    format, 275 for SSA tape format etc. yyyy can either be 'CRLF' (each
    record is delimited by CRLF) or blank (no CRLF).
    After processing the 1st line, the line is deleted from the internal
    table. Downloading begins on the 2nd line.
      READ TABLE tape INDEX 1.
      IF tape-data(3) EQ 'SAP'.
        IF tape-data+3(3) EQ 'EBC'.
          convert_to_ebcdic = 'x'.
        ELSEIF tape-data+3(3) EQ 'ASC'
              AND force_ascii EQ 'T'.
          filetype = 'ASC'.
        ENDIF.
        IF tape-data+6(3) NA '*'.
          record_length = tape-data+6(3).
        ELSE.
          record_length = tape-data+13(4).
        ENDIF.
        IF tape-data+9(4) EQ 'CRLF'.
          data_length = record_length + 2.
        ELSE.
          data_length = record_length.
        ENDIF.
        DELETE tape INDEX 1.
      ELSE.
        data_length = record_length.
      ENDIF.
    Transfer the Temse file data to Unix file.
          PERFORM transfer_file.
    Update the Log table with the temse details.
          ZTEMSE_LOG-dname = g_int_temse-dname.
          ZTEMSE_LOG-txcmp = V_5UXY_A-taxau.
          ZTEMSE_LOG-txfrm = V_5UXY_A-txfrm.
          ZTEMSE_LOG-filename = ws_unixr.
          ZTEMSE_LOG-DCREATER = g_int_temse-dcreater.
          INSERT ZTEMSE_LOG.
        WRITE: /(20) ZTEMSE_LOG-dname,
                (15) ZTEMSE_LOG-txcmp,
                (20) ZTEMSE_LOG-txfrm,
                (15) ZTEMSE_LOG-dcreater,
                (40) ZTEMSE_LOG-filename.
    ENDLOOP.
    *&      Form  get_physical_path
          Get Physical directory name for the given logical path name
    FORM get_physical_path .
      CALL FUNCTION 'ZFILE_GET_PATH_NAME'
        EXPORTING
          LOGICAL_PATH               = c_lpath
        IMPORTING
          FILE_NAME_PATH             = p_uxdir
        EXCEPTIONS
          PATH_NOT_FOUND             = 1
          MISSING_PARAMETER          = 2
          OPERATING_SYSTEM_NOT_FOUND = 3
          FILE_SYSTEM_NOT_FOUND      = 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.
    ENDFORM.                    " get_physical_path
    *&      Form  TRANSFER_FILE
    FORM transfer_file.
      p_unixf = 'AFS'.
    Concatenate Date with Unix File name
      CONCATENATE p_unixf '.' p_compid '.' p_ifid  '.' sy-datum '.' sy-uzeit INTO ws_unixr.
    Concatenate Unix Directory with Unix File for Outbound
      CONCATENATE p_uxdir ws_unixr INTO p_unixf.
      PERFORM open_files USING p_unixf.
    LOOP AT tape.
         g_str = tape-data(record_length).
        TRANSFER g_str TO p_unixf LENGTH record_length.
        IF sy-subrc <> 0.
          MESSAGE ID '00' TYPE 'E' NUMBER '398' WITH 'sy-subrc:' sy-subrc
           ' Error Transferring to: ' p_unixf.
        ENDIF.
    ENDLOOP.
      PERFORM close_files USING p_unixf.
    ENDFORM.                    " TRANSFER_FILE
    Can anyone please check and tell me what I need to overcome this problem.

    Hi Bhaskar,
    I also have the same requirement to upload TemSe files in to application server.
    In FDTA tcode after we enter company code and click on enter.
    In the second screen checking and line item and go to edit and click on download button.
    Here we see a popup with default file name, and when we say ok the file will get downloaded into C:\.....
    Here our req is to upload the file automatically pick up via batch job and place it in the in to the application server and from there it should be placed in the Netwrok server (UNIX).
    Pls provide me with suitable code so that i can finish it off.I tried a lot but did not work.
    Thanks.

  • Exporting a Report to PDF

    Post Author: helfrich
    CA Forum: Crystal Reports
    I am re-writing a VB6 app to VB.NET 2005.  I have a viewer control that I use to display the reports in when I want to preview the report on the screen.  The VB6 app can also automatically export reports to PDF format silently (no user input or screen output).  I would like to do the same in VB.NET.  In the VB6 app, I simply set the viewer control's ExportOptions.PDFExportAllPages = True (I also set the DiskFileName FormatType, and DestinationType parameters).  I then display the form containing the viewer with the .Hide parameter.  This exports the report without displaying the report on the screen.  I have not been able to find any information that allows me to do the same thing in .NET with Crystal Reports XI.
    I have tried creating a ReportDocument object, but when I execute .Export(), I get a "Missing parameter values" error - absolutely no other information.
    For example:
    Dim crExportOptions As New ExportOptions
    Dim crDiskFileDestinationOptions As New DiskFileDestinationOptions()
    Dim crFormatTypeOptions As New PdfRtfWordFormatOptions()
    Dim crReport As New ReportDocument
    crDiskFileDestinationOptions.DiskFileName = "C:\Test.PDF"
    crExportOptions.ExportFormatOptions = crFormatTypeOptions
    crExportOptions.ExportDestinationType = ExportDestiniationType.DiskFile
    crExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat
    crExportOptions.ExportDestinationOptions = crDiskFileDestinationOptions
    crReport.Load("C:\Test.rpt")
    crReport.Export(crExportOptions)
    This is where the error occurs.
    I also tried setting Viewer.Visible = False followed by Viewer.ExportReport().  The viewer does not display, but this prompts for the export filename.  The whole idea is for the export to be completely invisible to the user.
    I don't care which solution I use:
    1.  How can I get rid of the "Missing parameter values" error using the ReportDocument
    or
    2. Is there a way I can use .ExportReport(), but preset the export filename so there is not prompt?
    TIA for any help anyone can offer.

    Post Author: jennm
    CA Forum: Crystal Reports
    Here's a snippet of code from one of my recent projects that should offer some help.
            Dim crOrderPrintout As CrystalDecisions.CrystalReports.Engine.ReportDocument = New rptPublicOrder
      u2018clear the dataset, give it the appropriate parameters and fill the data adapter
            Me.dsReceiptDetails.Clear()
            Me.SqlSelectReceiptDetails.Parameters.Item("@ReceiptID").Value = sReceiptID
            Me.daReceiptDetails.Fill(Me.dsReceiptDetails)
            u2018set the data source and paper size for the report
            crOrderPrintout.SetDataSource(Me.dsReceiptDetails.Tables(0))
            crOrderPrintout.PrintOptions.PaperSize = CrystalDecisions.Shared.PaperSize.PaperLetter
      u2018These are the printing options, Printer, File or Viewer
            Select Case My.Settings.PrintType
                Case "Printer"
                    crOrderPrintout.PrintToPrinter(1, False, 0, 0)
                Case "Viewer"
                    Dim frmReportViewer As New frmReportViewer
                    frmReportViewer.CrystalReportViewer1.ReportSource = crOrderPrintout
                    frmReportViewer.ShowDialog()
                Case "File"
                    crOrderPrintout.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, "C:\test.pdf")
                Case Else
                    crOrderPrintout.PrintToPrinter(1, False, 0, 0)
            End Select
      u2018close the report
            crOrderPrintout.Close()
    The file option will print directly to a file without prompting the user.  As for the missing parameter values if I had to guess either it's the dataset missing a parameter or the report requires a value.  Example:
    crOrderPrintout.SetParameterValue("ParamName", sParamValue)
    HTH,
    -Jen

  • Report in PDF format and email it to some clients, using  Database Trigger

    Hi
    Is it possible to run a report in PDF format ad email it to some clients after a specific event through Database Trigger. For example whenever a client makes an entry into order entry table (through entry form), a trigger should execute on Orders table, this trigger should execute or generate a PDF formatted report and finally mail it to Sales team?
    I have
    ORAS 10g(10.1.2.0.2)
    utl_mail configured.

    In Reportsconfig.properties file the http port is 7778,
    now the output is like this...
    SQL> /
    * WELCOME TO EVENT-BASED-REPORTING API *
    * API-Version : 9i *
    * (C) Oracle Corporation, 2000 - 2002 *
    * Debugging turned ON **************************
    *** Length of Paramlist : 1
    OK : Parameter added : GATEWAY=http://myserver.com:7778/reports/rwservlet
    *** Length of Paramlist : 2
    OK : Parameter added : SERVER=rep_myserver_oracleas2
    *** Length of Paramlist : 3
    OK : Parameter added : REPORT=D:\Reports\emp.rdf
    *** Length of Paramlist : 4
    OK : Parameter added : USERID=abc/xyz@mydb
    *** Length of Paramlist : 5
    OK : Parameter added : DESTYPE=mail
    *** Length of Paramlist : 6
    OK : Parameter added : DESFORMAT=PDF
    *** Length of Paramlist : 7
    OK : Parameter added : [email protected]
    Starting run_report: building url
    *** Building URL (RUN_REPORT)
    OK : URL built :
    http://myserver.com:7778/reports/rwservlet?SERVER=rep_myserver_oracleas2&REPO
    RT=D%3A%CReports%5Cemp.rdf&USERID=abc%2Fxyz%40mydb&DESTYPE=mail&D
    ESFORMAT=PDF&DESNAME=khan.emran84%40gmail.com&statusformat=xml
    *** Submitting HTTP Request
    *** using URL
    :http://myserver.com:7778/reports/rwservlet?SERVER=rep_myserver_oracleas2&REP
    ORT=D%3A%5CReports%5Cemp.rdf&USERID=abc%2Fxyz%40mydb&DESTYPE=mail&
    DESFORMAT=PDF&DESNAME=khan.emran84%40gmail.com&statusformat=xml
    OK : Request submitted - Return stream : <?xml version = '1.0' encoding =
    'ISO-8859-1' standalone = 'yes'?>
    <serverQueues>
    <error code="50159"
    component="REP" message="Executed successfully but there were some errors when
    distribute the output"/>
    <
    OK : Request submitted - Length of stream : 229
    *** XML-Parsed - Following Structure discovered :
    *** Checking elements!
    serverQueues ()
    *** Checking attributes!
    error
    *** Checking attributes!
    __code = 50159
    __component = REP
    __message = Executed successfully but there were some errors when distribute the
    output
    *** Finished Parsing XML
    Getting value for element: job
    Getting value for element: error
    *** Requesting value for Attribute error.component [REP]
    Getting value for element: error
    *** Requesting value for Attribute error.code [50159]
    Getting value for element: error
    *** Requesting value for Attribute error.message [Executed successfully but    
    there were some errors when distribute the output]
    REP-50159:Executed successfully but there were some errors when distribute the
    output
    declare
    ERROR at line 1:
    ORA-20999:
    ORA-06512: at "NRSP.SRW", line 264
    ORA-06512: at "NRSP.SRW", line 799
    ORA-06512: at line 15

  • CRM ONLINE 2013: On Approval Of Quotation, Run Report, Generate PDF and Send an Email With PDF as attachment

    Hi,
    I am using CRM ONLINE 2013.
    How to automate below process?
    1. On Approval Of Quotation, Run Report.
    2. Generate PDF.
    3. Send an Email With PDF as attachment.
    As i have gone through many forums for this topic, but creating a plugin code for generating Report PDF is not possible in CRM ONLINE.
    So, What is the alternate way to do this..?
    Thanks.

    This is my entire code mentioned below:-
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title></title>
        <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script>
        <script type="text/javascript">
            if (typeof (SDK) == "undefined")
            { SDK = { __namespace: true }; }
            SDK.JScriptRESTDataOperations = {
                _context: function () {
                    if (typeof GetGlobalContext != "undefined")
                    { return GetGlobalContext(); }
                    else {
                        if (typeof Xrm != "undefined") {
                            return Xrm.Page.context;
                        else { return new Error("Context is not available."); }
                _getServerUrl: function () {
                    var serverUrl = this._context().getServerUrl()
                    if (serverUrl.match(/\/$/)) {
                        serverUrl = serverUrl.substring(0, serverUrl.length - 1);
                    return serverUrl;
                _ODataPath: function () {
                    return this._getServerUrl() + "/XRMServices/2011/OrganizationData.svc/";
                _errorHandler: function (req) {
                    return new Error("Error : " +
      req.status + ": " +
      req.statusText + ": " +
      JSON.parse(req.responseText).error.message.value);
                _dateReviver: function (key, value) {
                    var a;
                    if (typeof value === 'string') {
                        a = /Date\(([-+]?\d+)\)/.exec(value);
                        if (a) {
                            return new Date(parseInt(value.replace("/Date(", "").replace(")/", ""), 10));
                    return value;
                Create: function (object, type, successCallback, errorCallback) {
                    var req = new XMLHttpRequest();
                    req.open("POST", this._ODataPath() + type + "Set", true);
                    req.setRequestHeader("Accept", "application/json");
                    req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
                    req.onreadystatechange = function () {
                        if (this.readyState == 4 /* complete */) {
                            if (this.status == 201) {
                                successCallback(JSON.parse(this.responseText, SDK.JScriptRESTDataOperations._dateReviver).d);
                            else {
                                errorCallback(SDK.JScriptRESTDataOperations._errorHandler(this));
                    req.send(JSON.stringify(object));
                Retrieve: function (id, type, successCallback, errorCallback) {
                    var req = new XMLHttpRequest();
                    req.open("GET", this._ODataPath() + type + "Set(guid'" + id + "')", true);
                    req.setRequestHeader("Accept", "application/json");
                    req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
                    req.onreadystatechange = function () {
                        if (this.readyState == 4 /* complete */) {
                            if (this.status == 200) {
                                successCallback(JSON.parse(this.responseText, SDK.JScriptRESTDataOperations._dateReviver).d);
                            else {
                                errorCallback(SDK.JScriptRESTDataOperations._errorHandler(this));
                    req.send();
                Update: function (id, object, type, successCallback, errorCallback) {
                    var req = new XMLHttpRequest();
                    req.open("POST", this._ODataPath() + type + "Set(guid'" + id + "')", true);
                    req.setRequestHeader("Accept", "application/json");
                    req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
                    req.setRequestHeader("X-HTTP-Method", "MERGE");
                    req.onreadystatechange = function () {
                        if (this.readyState == 4 /* complete */) {
                            if (this.status == 204 || this.status == 1223) {
                                successCallback();
                            else {
                                errorCallback(SDK.JScriptRESTDataOperations._errorHandler(this));
                    req.send(JSON.stringify(object));
                Delete: function (id, type, successCallback, errorCallback) {
                    var req = new XMLHttpRequest();
                    req.open("POST", this._ODataPath() + type + "Set(guid'" + id + "')", true);
                    req.setRequestHeader("Accept", "application/json");
                    req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
                    req.setRequestHeader("X-HTTP-Method", "DELETE");
                    req.onreadystatechange = function () {
                        if (this.readyState == 4 /* complete */) {
                            if (this.status == 204 || this.status == 1223) {
                                successCallback();
                            else {
                                errorCallback(SDK.JScriptRESTDataOperations._errorHandler(this));
                    req.send();
                RetrieveMultiple: function (type, filter, successCallback, errorCallback) {
                    if (filter != null) {
                        filter = "?" + filter;
                    else { filter = ""; }
                    var req = new XMLHttpRequest();
                    req.open("GET", this._ODataPath() + type + "Set" + filter, true);
                    req.setRequestHeader("Accept", "application/json");
                    req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
                    req.onreadystatechange = function () {
                        if (this.readyState == 4 /* complete */) {
                            if (this.status == 200) {
                                successCallback(JSON.parse(this.responseText, SDK.JScriptRESTDataOperations._dateReviver).d.results);
                            else {
                                errorCallback(SDK.JScriptRESTDataOperations._errorHandler(this));
                    req.send();
                __namespace: true
        </script>
        <script type="text/javascript">
            //Create Email and link it with Order as Regarding field
            var Xrm;
            var email = new Object();
            var ownerID = "";
            var CustomerId = "";
            if (window.opener) { Xrm = window.opener.Xrm; }
            else if (window.parent) { Xrm = window.parent.Xrm; }
            //Get ownerid who send email of quotation to customer
            function GetOwnerID() {
                var owner = Xrm.Page.getAttribute("ownerid").getValue();
                ownerID = owner[0].id;
                var ownerName = owner[0].name;
                var entityType = owner[0].entityType;
                GetToEmailGUID();
            //Get customerid who receive email of quotation from owner
            function GetToEmailGUID() {
                var Customer = Xrm.Page.getAttribute('customerid').getValue();
                CustomerId = Customer[0].id;
                var CustomerName = Customer[0].name;
                var entityType = Customer[0].entityType;
                //if CustomerId is type of "Account" then get Primary Contact id of that account
                if (entityType == "account") {
                    var contact = Xrm.Page.getAttribute("customerid").getValue();
                    if (contact === null) return;
                    var serverUrl = Xrm.Page.context.getClientUrl();
                    var oDataSelect = serverUrl + "/XRMServices/2011/OrganizationData.svc/AccountSet(guid'" + contact[0].id + "')?$select=PrimaryContactId";
                    var req = new XMLHttpRequest();
                    req.open("GET", oDataSelect, false);
                    req.setRequestHeader("Accept", "application/json");
                    req.setRequestHeader("Content-Type", "application/json;charset=utf-8");
                    req.onreadystatechange = function () {
                        if (req.readyState === 4) {
                            if (req.status === 200) {
                                var retrieved = JSON.parse(req.responseText).d;
                                CustomerId = retrieved.PrimaryContactId.Id;
                            else {
                                alert(this.statusText);
                    req.send();
            function CreateEmail() {
                GetOwnerID();
                email.Subject = "Email with Report Attachment";
                //Set The current order as the Regarding object
                email.RegardingObjectId = {
                    Id: Xrm.Page.data.entity.getId(),    //Get the current entity Id , here OrderId
                    LogicalName: Xrm.Page.data.entity.getEntityName()//Get the current entity name, here it will be “salesOrder”
                //Create Email Activity
                SDK.JScriptRESTDataOperations.Create(email, "Email", EmailCallBack, function (error) { alert(error.message); });
            // Email Call Back function
            function EmailCallBack(result) {
                email = result; // Set the email to result to use it later in email attachment for retrieving activity Id
                var activityPartyFrom = new Object();
                // Set the From party of the ActivityParty to relate an entity with Email From field
                activityPartyFrom.PartyId = {
                    Id: CustomerId, //"79EBDD26-FDBE-E311-8986-D89D6765B238",  // id of entity you want to associate this activity with.        
                    LogicalName: "contact"
                // Set the "activity" of the ActivityParty
                activityPartyFrom.ActivityId = {
                    Id: result.ActivityId,
                    LogicalName: "email"
                // Now set the participation type that describes the role of the party on the activity).
                activityPartyFrom.ParticipationTypeMask = { Value: 2 }; // 2 means ToRecipients
                // Create the from ActivityParty for the email
                SDK.JScriptRESTDataOperations.Create(activityPartyFrom, "ActivityParty", ActivityPartyFromCallBack, function (error) { alert(error.message); });
                var activityPartyTo = new Object();
                // Set the From party of the ActivityParty to relate an entity with Email From field
                activityPartyTo.PartyId = {
                    Id: ownerID, //"79EBDD26-FDBE-E311-8986-D89D6765B238",  // id of entity you want to associate this activity with.        
                    LogicalName: "systemuser"
                // Set the "activity" of the ActivityParty  
                activityPartyTo.ActivityId = {
                    Id: result.ActivityId,
                    LogicalName: "email"
                // Now set the participation type that describes the role of the party on the activity).    
                activityPartyTo.ParticipationTypeMask = { Value: 1 }; // 1 means Sender
                // Create the from ActivityParty
                SDK.JScriptRESTDataOperations.Create(activityPartyTo, "ActivityParty", ActivityPartyToCallBack, function (error) { alert(error.message); });
            //ActivityParty From Callback
            function ActivityPartyFromCallBack(result) {
            //ActivityParty To Callback
            function ActivityPartyToCallBack(result) {
                GetReportId('ABM_Infotech_SalesQuote');
            //Create attachment for the created email
            function CreateEmailAttachment() {
                //get reporting session and use the params to convert a report in PDF
                var params = getReportingSession();
                //Email attachment parameters
                var activitymimeattachment = Object();
                activitymimeattachment.ObjectId = Object();
                activitymimeattachment.ObjectId.LogicalName = "email";
                activitymimeattachment.ObjectId.Id = email.ActivityId;
                activitymimeattachment.ObjectTypeCode = "email",
                    activitymimeattachment.Subject = "File Attachment";
                activitymimeattachment.Body = encodePdf(params);
                activitymimeattachment.FileName = "Report1.pdf";
                activitymimeattachment.MimeType = "application/pdf";
                //Attachment call
                SDK.JScriptRESTDataOperations.Create(activitymimeattachment, "ActivityMimeAttachment", ActivityMimeAttachmentCallBack, function (error) { alert(error.message); });
            //ActivityMimeAttachment CallBack function
            function ActivityMimeAttachmentCallBack(result) {
                var features = "location=no,menubar=no,status=no,toolbar=no,resizable=yes";
                var width = "800px";
                var height = "600px";
                window.open(Xrm.Page.context.getServerUrl() + "main.aspx?etc=" + 4202 + "&pagetype=entityrecord&id=" + email.ActivityId, "_blank", features);
                // To open window which works in outlook and IE both
                //openStdWin(Xrm.Page.context.getServerUrl() + "main.aspx?etc=" + 4202 + "&pagetype=entityrecord&id=" + email.ActivityId, "_blank", width,
    height, features);
            //This method will get the reportId based on a report name that will be used in            getReportingSession() function
            function GetReportId(reportName) {
                var oDataSetName = "ReportSet";
                var columns = "ReportId";
                var filter = "Name eq '" + reportName + "'";
                retrieveMultiple(oDataSetName, columns, filter, onSuccess);
            function retrieveMultiple(odataSetName, select, filter, successCallback) {
                var serverUrl = Xrm.Page.context.getServerUrl();
                var ODATA_ENDPOINT = "/XRMServices/2011/OrganizationData.svc";
                var odataUri = serverUrl + ODATA_ENDPOINT + "/" + odataSetName + "?";
                if (select) {
                    odataUri += "$select=" + select + "&";
                if (filter) {
                    odataUri += "$filter=" + filter;
                $.ajax({
                    type: "GET",
                    contentType: "application/json; charset=utf-8",
                    datatype: "json",
                    url: odataUri,
                    beforeSend: function (XMLHttpRequest) {
                        XMLHttpRequest.setRequestHeader("Accept", "application/json");
                    success: function (data) {
                        if (successCallback) {
                            if (data && data.d && data.d.results) {
                                successCallback(data.d.results);
                            else if (data && data.d) {
                                successCallback(data.d);
                            else {
                                successCallback(data);
                    error: function (XmlHttpRequest, errorThrown) {
                        if (XmlHttpRequest && XmlHttpRequest.responseText) {
                            alert("Error while retrieval ; Error – " + XmlHttpRequest.responseText);
            function onSuccess(data) {
                reportId = data[0].ReportId.replace('{', ").replace('}', ");
                CreateEmailAttachment(); // Create Email Attachment
            //Gets the report contents
            function getReportingSession() {
                var pth = Xrm.Page.context.getServerUrl() + "/CRMReports/rsviewer/reportviewer.aspx";
                var retrieveEntityReq = new XMLHttpRequest();
                var Id = Xrm.Page.data.entity.getId();
                var quotationGUID = Id.replace('{', ""); //set this to selected quotation GUID
                quotationGUID = quotationGUID.replace('}', "");
                var reportName = "ABM_Infotech_SalesQuote"; //set this to the report you are trying to download
                var reportID = "751089AA-74B8-E211-B52F-D8D3855B253B"; //set this to the guid of the report you are trying to download
                var rptPathString = ""; //set this to the CRMF_Filtered parameter
                var strParameterXML = "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'><entity name='quote'><all-attributes /><filter type='and'><condition
    attribute='quoteid' operator='eq' uitype='quote' value='" + quotationGUID + "' /> </filter></entity></fetch>";
                retrieveEntityReq.open("POST", pth, false);
                retrieveEntityReq.setRequestHeader("Accept", "*/*");
                retrieveEntityReq.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
                rptPathString = "id=%7B" + reportID + "%7D&uniquename=" + Xrm.Page.context.getOrgUniqueName() + "&iscustomreport=true&reportnameonsrs=&reportName="
    +
                                reportName + "&isScheduledReport=false&p:ABMFilteredQuote=" + strParameterXML;
                //remove the part starting from &p:salesorderid if your report has no parameters
                retrieveEntityReq.send(rptPathString);
                var x = retrieveEntityReq.responseText.indexOf("ReportSession=");
                var ret = new Array();
                ret[0] = retrieveEntityReq.responseText.substr(x + 14, retrieveEntityReq.responseText.indexOf("&", x) - x - 14); //the session id
                x = retrieveEntityReq.responseText.indexOf("ControlID=");
                ret[1] = retrieveEntityReq.responseText.substr(x + 10, retrieveEntityReq.responseText.indexOf("&", x) - x - 10); //the control id
                return ret;
            var bdy = new Array();
            var bdyLen = 0;
            function concat2Bdy(x) {
                bdy[bdyLen] = x;
                bdyLen++;
            function encodePdf(params) {
                bdy = new Array();
                bdyLen = 0;
                var retrieveEntityReq = new XMLHttpRequest();
                var pth = Xrm.Page.context.getServerUrl() + "/Reserved.ReportViewerWebControl.axd?ReportSession=" + params[0] +
                "&Culture=1033&CultureOverrides=True&UICulture=1033&UICultureOverrides=True&ReportStack=1&ControlID=" + params[1] +
                "&OpType=Export&FileName=Public&ContentDisposition=OnlyHtmlInline&Format=PDF";
                retrieveEntityReq.open("GET", pth, false);
                retrieveEntityReq.setRequestHeader("Accept", "*/*");
                retrieveEntityReq.send();
                BinaryToArray(retrieveEntityReq.responseBody);
                return encode64(bdy);
            var StringMaker = function () {
                this.parts = [];
                this.length = 0;
                this.append = function (s) {
                    this.parts.push(s);
                    this.length += s.length;
                this.prepend = function (s) {
                    this.parts.unshift(s);
                    this.length += s.length;
                this.toString = function () {
                    return this.parts.join('');
            var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
            function encode64(input) {
                var output = new StringMaker();
                var chr1, chr2, chr3;
                var enc1, enc2, enc3, enc4;
                var i = 0;
                while (i < input.length) {
                    chr1 = input[i++];
                    chr2 = input[i++];
                    chr3 = input[i++];
                    enc1 = chr1 >> 2;
                    enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
                    enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
                    enc4 = chr3 & 63;
                    if (isNaN(chr2)) {
                        enc3 = enc4 = 64;
                    } else if (isNaN(chr3)) {
                        enc4 = 64;
                    output.append(keyStr.charAt(enc1) + keyStr.charAt(enc2) + keyStr.charAt(enc3) + keyStr.charAt(enc4));
                return output.toString();
        </script>
        <script type="text/vbscript">
        Function BinaryToArray(Binary)
               Dim i
               ReDim byteArray(LenB(Binary))
               For i = 1 To LenB(Binary)
                     byteArray(i-1) = AscB(MidB(Binary, i, 1))
                     concat2Bdy(AscB(MidB(Binary, i, 1)))
             Next
              BinaryToArray = byteArray
       End Function     
        </script>
    </head>
    <body>
        <input type="button" onclick="CreateEmail();" value="Attach Report" />
    </body>
    </html>

  • How to generate jasper report in pdf format using swing

    hi all,
    im new to swing and jasper.. can anybody provide me some example on how to generate the jasper report in pdf format? i will call the reportManager from sessionBean.. below is my code:
    1)delegate:
    public GenerateReportDto generateIntoPdfReport(String fileName, String outputFileName, Map parameters){
    GenerateReportDto generateReportDto = getAuditTrailServiceRemote().generateIntoPdfReport(fileName, outputFileName, parameters);
    return generateReportDto;
    2)sessionBean:
    public GenerateReportDto generateIntoPdfReport(String fileName, String outputFileName, Map parameters){
    //Map parameters = new HashMap();
    ReportManager reportManager = new ReportManager();
    3)ReportManager()
    public void generateIntoPdfReport(String fileName, String outputFileName, Map parameters) {
              Connection conn = null;
              try {
                   conn = dataSource.getConnection();
                   //Generate the report to bytes
                   File reportFile = new File(fileName);               
                   byte[] bytes =
                        JasperRunManager.runReportToPdf(
                             reportFile.getPath(),
                             parameters,
                             conn
              //conn.close();
              //Write the bytes to a file
              ByteBuffer buf = ByteBuffer.wrap(bytes);
              File file = new File(outputFileName);
              // (if the file exists)
              boolean append = false;
              // Create a writable file channel
              FileChannel wChannel = new FileOutputStream(file, append).getChannel();
              // Write the ByteBuffer contents; the bytes between the ByteBuffer's
              // position and the limit is written to the file
              wChannel.write(buf);
              // Close the file
              wChannel.close();
              } finally {
                   if (conn != null) {
    conn.close();
    Any help would be highly appreciated. Thanks in advance

    Hi ,
    One 'simple' way is by using the DBMS_SCHEDULER db package and the procedure CREATE_JOB(....) using as job_type the value 'EXECUTABLE'...
    Read for further info in 'PL/SQL Packages and Types Reference'.
    If you have access to OEM ... you can configure this there using wizard.....
    Other way is to use the External Procedure call capabiblity of Oracle DB Server...:
    http://www.oracle.com/pls/db102/ranked?word=external+procedure+call&remark=federated_search
    My greetings,
    Sim

  • Saving report as PDF and text file

    Currently, I saved my report as PDF. It opens in Acrobat reader automatically when the report is executed. Is there a way for me to save it as PDF and as a text file at the same time? (without having to open the file in Acrobat reader and saving it)

    You can add your PDF and TEXT file formats to a distribution list (Instead of GENERATE REPORT TO A FILE). To do this:
    1. Go to your Object Navigator and highlight your report.
    2. Right click on your report. Select Property Palette.
    3. Select Distribution
    4. You can add of of the formats that you want to print or save to the report to.
    5. You will have to add Distribution Id (any number starting with 1) where you want the file to be saved (c:\my_reports\inventory.pdf), the type of file: PDF and how many copies you want: 2
    6. Click OK after finishing...
    To make it work ... You would highlight your report from your Object Navigator and then choose FILE-DISTRIBUTE and this will save it to all the files your specified and/or printer.
    null

Maybe you are looking for

  • Online number is not working

    Hi, I recently bought a 02081 London online number in Skype but for two days it has been the same problem. When I call the number it says there is a high demand for this number, try later. What can I do to fix this since I am expecting calls on this

  • Converting PDF to JPEG--tiny file, not full size image.

    using photoshop cs3 End result is I want a jpeg of the same size as original. here is what i do and what happens. open pdf in photoshop; save as "jpeg" jpeg shrinks to an inch wide, from an original 8.5 inches. I've tried saving with compression off,

  • Photoshop CS5 64x partially freezes up after trying to save a file !

    Photoshop CS5 freezes up after trying to save a file.   It doesnt freeze up totally .It just leaves me about 3 choices from the drop down menu. This only happens with the installed 64 bit version and not with the installed 32 bit version? My Operatin

  • Apply Passwords To PDF Dynamically

    Hi All, I have a query. I have around 100's of PDF which need to be protected with password depending upon the users data in database. How do I proceed with this, I had a look at service available for applying password in Adobe LiveCycle ES2 but in t

  • No Home Sharing iTunes 11.0.4.4 Windows 7

    I recently replaced the hard drive in my son's laptop, which is running Windows 7. Installed iTunes 11.0.4.4 and dowloaded his purchased items through the cloud with no problem. I turned on home sharing with his apple id, but I can't see any other li