Skip to Content

On the use of TOKENS in Crystal Reports


I have not seen the term 'Token' in any book on Crystal Reports except in the SAP Publication entitled 'How to Work with Crystal Reports in SAP Business One'.

So maybe an explanation will be appropriate here...

A token is simply a parameter name that we use in CR, and which contains an SQL.

Tokens are used to create Selection Criteria dialog boxes similar to those generated by SQL Queries - but more powerful.

Suppose I want to create a dialog box which allows the user to select a BP CODE from a pick list.

This is how it is done:

In Field Explorer, we create a New Parameter field called:

BPCode@Select distinct CardCode from OCRD where CardType = 'C'

This is the token.

When the report is previewed in SAP B1, a Selection Criteria box pops up allowing the user to pick up a BP Code from a pick list.

Tokens can accept quite sophisticated SQL, but unfortunately their length is quite limited.

My question is:

If I have a long SQL which I would like to use to generate a dialog box, and it cannot fit in the token, where else can I put the SQL so that I get the same result? or How else I can proceed?

Best Regards

Leon Lai

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jun 02, 2012 at 12:13 PM


    Try This Link

    This is a document which contains details about tokens in B1



    Add a comment
    10|10000 characters needed characters exceeded

    • Leon Lai Kan M. Sundararaja Perumal

      Hi Sundararaja,

      Thanks for your answer.

      This is what I actually did.

      My problem was that I cannot fit a long SQL in the token in this manner.

      When the SQL is short, it works.

      But my SQL is very long, and cannot fit in the parameter name.

      And I need a long SQL because the simple one is too vague, and does not give me what I want

      Well, the good news is that I found the answer in this forum after much searching.

      We simply have to write our long SQL, convert it to a view, say VW_SQL1,

      then attach the view to our parameter like this:

      BPCode@Select * from OADM T0 cross join VW_SQL1

      And it works wonders!

      As tokens do not accept views, this method "fools" the token by making it think the view is a table.

      Best Regards

      Leon Lai

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.