Skip to Content
0

Passing 2 parameters into Crystal Report from marketing document

Jan 26, 2017 at 07:56 AM

127

avatar image
Former Member

Dear Gurus,

I am now working to design sales invoice, delivery note, return those related document in crystal report.

As I found that most of them are similar, and would like to find out can I use 1 crystal to fulfill all the documents.

Based on my understanding, print a form would only pass out a single parameter DocKey from SAP b1.

Can I add one more parameter that indicate the form is printed from sales order e.g. SO to the crystal report? As I would like to like where is the printing action comes from.

Or can I add a default parameter that will automatic pass to crystal report to perform the same behavior?

P.S. may not consider any add-on module to handle the problem but would like to have the idea

Many thanks.

Best Regards

Daniel

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

5 Answers

Best Answer
Edy Simon Jan 26, 2017 at 08:21 AM
1

Hi Daniel,
Have you ever tried creating 1 crystal report, Add a table let's say OINV, show the DocNum and CardCode.
Import it into Invoice Layout. run the report, as expected, you will get the OINV DocNum and CardCode on the report.

Next, the same crystal report, Load it into Sales Order Layout, or even, Purchase Invoice layout.
Now run the report. You will notice that SAP will handle it for you. The report will give you the Data from ORDR or OPCH.

Regards
Edy

Show 2 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Hi Edy,

Sorry I can really get it.

Does the report using the same stored procedure to get the DocNum and CardCode?

If so, how should be the store procedure distinguish extracting from which table say OINV or ORDR?

Regards,

Daniel

0

Hi Daniel,
SAP knows which standard table belongs to Documents, in runtime, ALL DOCUMENTS table will be replaced by the scope of the printing, ie when printing invoices, ALL DOCUMENT tables will be replaced by the 'INV' tables.
However, there are 2 catch here :

  1. If you use SP, the runtime can not detect, and will leave the SP intact. Thus, you need to handle the branching in the SP yourself. ie. This will work if you design your report using the Tables as the main source.
  2. If you are printing Invoice based on another document, ie Invoice based on Order, and you need to show information from ORDR table, you can not include the ORDR table in the CR as the runtime will replace this 'ORDR' to 'OINV' table (Because ORDR is a document table, and the scope of the report is an Invoice). In order to achieve this you need to include a VIEW from ORDR table.

Lastly, there are other parameters passed into the CR during runtime.ie.

  • 'ObjectId@' for the object Type
  • printbyusername@ for the current user name
  • UserCode@ for the current user code (Only available when you import your CR as layout.

There might be other parameters not included here.

Regards
Edy

    1
    Nagarajan K Jan 26, 2017 at 09:22 AM
    0

    Hi,

    Find below answers to your question:-

    can I use 1 crystal to fulfill all the documents?

    Yes, you can use one crystal layout for all sales documents by creating single stored procedure. In this stored procedure, you have to add object type each document. Dockey should be docentry of the document.

    Regards,

    Nagarajan

    Show 1 Share
    10 |10000 characters needed characters left characters exceeded
    Former Member

    Hi,

    Could you please give me details of the object type?

    Should I use it as an parameter? Or something else?

    Regards,

    Daniel

    0
    Nagarajan K Jan 26, 2017 at 09:39 AM
    0

    Here object type details and used it as parameter,

    DECLARE @sTableID NVARCHAR(4)

    IF @ObjectId@ = '23' SELECT @sTableID = 'QUT'

    IF @ObjectId@ = '17' SELECT @sTableID = 'RDR'

    IF @ObjectId@ = '22' SELECT @sTableID = 'POR'

    IF @ObjectId@ = '13' SELECT @sTableID = 'INV'

    IF @ObjectId@ = '14' SELECT @sTableID = 'RIN'

    IF @ObjectId@ = '15' SELECT @sTableID = 'DLN'

    IF @ObjectId@ = '203' SELECT @sTableID = 'DPI'

    IF @ObjectId@ = '18' SELECT @sTableID = 'PCH'

    IF @ObjectId@ = '19' SELECT @sTableID = 'RPC'

    IF @ObjectId@ = '112'SELECT @sTableID = 'DRF'

    Show 1 Share
    10 |10000 characters needed characters left characters exceeded
    Former Member

    How about in crystal report?

    And can you give me an example say getting the BP code and Inv no. in stored procedure and in crystal report?

    Regards

    Daniel

    0
    avatar image
    Former Member Jan 26, 2017 at 09:46 PM
    0

    Hi Daniel,

    If you use one of the SAP sample reports as your base, the SAP stored procedure will already be in there and will fulfill these requirements. The SAP sample reports can be downloaded from the documentation area if you do not already have them in your database

    Share
    10 |10000 characters needed characters left characters exceeded
    avatar image
    Former Member Jan 27, 2017 at 03:00 PM
    0

    I think Crystal report itself can't give you the ability to switch tables during the runtime, but we can use store procedure to achieve it. Basically the SP will act as a Data Access Layer between DB and Crystal Report layout.


    Lan

    Show 1 Share
    10 |10000 characters needed characters left characters exceeded

    Hi Lan,

    Crystal report API allows you to change the connection and tables on runtime. That is what SAP is doing.

    On the other hand, if your crystal report source is a SP then, you need to handle it yourself in the SP.


    Regards
    Edy

    0