cancel
Showing results for 
Search instead for 
Did you mean: 

Authorization for "preview layout" and blocking export option in crystal report

Former Member
0 Kudos

Dear Experts

How we can give access to "file -->preview layout " we need to block this access for some users for all documents.

What is the option to block export function to excel/word or pdf.

I will be thank-full to you if you share your experience with me to sort out above 2 issues.

Thanks & Best Regards,


V.Gobi.

Accepted Solutions (0)

Answers (4)

Answers (4)

kothandaraman_nagarajan
Active Contributor
0 Kudos

Hi,

It is not possible to block from SAP B1 application. Please create new discussion at Crystal forum.

Thanks

Former Member
0 Kudos

There are no authorizations in SAP B1 to block export of crystal report. It may be possible with SDK.


Try this following code for blocking export functionality using SDK.


using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;

using CrystalDecisions.CrystalReports.Engine;

using CrystalDecisions.Shared;

using System.Drawing.Printing;

namespace WindowsFormsApplication1

{

    public partial class Form1 : Form

    {

        CrystalReport1 cr;

        public Form1()

        {

            InitializeComponent();

        }

        private void Form1_Load(object sender, EventArgs e)

        {

            ToolStrip ts;

            ts = (ToolStrip)crystalReportViewer1 .Controls[3];

            ToolStripButton printbutton = new ToolStripButton();

            printbutton.Image = ts.Items[1].Image;

            ts.Items.Remove(ts.Items[1]);

            ts.Items.Insert(1, printbutton);

            ts.Items[1].Click += new EventHandler(this.CaptureEvent);                

            cr = new CrystalReport1();

            this.crystalReportViewer1.ReportSource = cr;

                       

        }

        private void CaptureEvent(Object Sender, EventArgs e)

        {

            try

            {        // Create a Print Dialog              

                PrintDialog printDialog1 = new PrintDialog();

                // Create a Print Document

                PrintDocument pd = new PrintDocument();

                printDialog1.Document = pd;

                printDialog1.ShowNetwork = true;

                printDialog1.AllowSomePages = true;

                DialogResult result = printDialog1.ShowDialog();

                if (result == DialogResult.OK)

                {

                    MessageBox.Show("Print button has been selected !!!");

                    PrintReport(printDialog1.PrinterSettings.PrinterName);

                }

                else if (result == DialogResult.Cancel)

                {

                    MessageBox.Show("Cancel button has been selected !!!");

                }

            }

            catch (Exception ex)

            {

                MessageBox.Show(ex.Message);

            }

         }

        private void PrintReport(string printerName)

        {

            // Select the printer.

            cr.PrintOptions.PrinterName = printerName;

            /* Print the report. Set the startPageN and endPageN

             parameters to 0 to print all pages.*/

            cr.PrintToPrinter(1, false, 0, 0);

        }                        

    }

}

Former Member
0 Kudos

Crystal Report Viewer has a bool Property called HasExportButton By setting this property to false, the export option get disabled. CrystalReportViewer1.HasExportButton = false; If you are using the Crystal Report Viewer in an aspx page, then in the page load place the above statement.


using Windows Application.For windows application you have use like this. crystalReportViewer1.ShowExportButton = false

Former Member
0 Kudos

Hi Edmund

This is something to do with the add-on development or any other development  no?

without going for a development, do we have any option.

Thanks

Gobi

Former Member
0 Kudos

Dear Gobi


The following property is set on crystal report (I think). If you are user, you don't have right to access the report. You can't do anything.


If you can access the report, try to find it.


Crystal Report Viewer has a bool Property called HasExportButton By setting this property to false, the export option get disabled. CrystalReportViewer1.HasExportButton = false; If you are using the Crystal Report Viewer in an aspx page, then in the page load place the above statement.


Regards

Edmund

Former Member
0 Kudos

Hi Edmund

I am a SAP B1 User as well as I have rights to developed reports and export to SAP B1 Application.

Thanks

Former Member
0 Kudos

Dear Gobi

I check that if you don't want user to export, maybe you can only set the authorization - Document Print. If the PDF icon is active, but it block user to generate the pdf.

for example, i can run the inventory audit report, but I can't view the layout.

and you should set MS-EXCEL, MS-WORD as No Authorization.

Regards

Edmund

Former Member
0 Kudos

Hi Edmund

Thanks for your reply.

I checked with the above mentioned authorization.

It didn't give solution for my issue.

Please see the below image.

My issue is export option which is available with crystal report- Not in SAP

Thanks

Gobi