Enterprise Resource Planning Blogs by Members
Gain new perspectives and knowledge about enterprise resource planning in blog posts from community members. Share your own comments and ERP insights today!
Showing results for 
Search instead for 
Did you mean: 
Active Contributor
Since the early ages of SAP Business One, restricting the printing of draft documents (before they were added to the database and properly validated or authorized) has been an important topic.

Yes, you can have SAP insert the "DRAFT" background image, but that is ugly, and I have also seen cases where the grayscale image is not properly printed and simply not visible. (Print Preferences... "Print Draft Watermark on Draft Documents").

In order to document my approach to solving this problem, I will leave the following option. This solution is only applicable to Crystal Reports layouts, so if you are still using PLD layouts, it won't work.


  1. Add a reference to the draft table (ODRF) to your layout

  2. Change the alias of the table from ODRF to ODRF_ONLY (do this from the "Database Expert" by right-clicking the table and choosing "Rename"). This step is important, since otherwise SAP B1 will substitute the underlying database table with the current document's "real" table, such as OINV or OPOR.

  3. Link the new table to your original table (for example, OPOR) with a LEFT JOIN, using both of these fields: OPOR.DocEntry to ODRF_ONLY.DocEntry, and OPOR.ObjType to ODRF_ONLY.ObjType

  4. Create a new formula, for example "IsDraft" with the following content
    {OPOR.DocTotal} = (if isnull({ODRF_ONLY.DocTotal}) then -1 else {ODRF_ONLY.DocTotal})​

    This will compare the DocTotal in your "current" table, such as OPOR with the one linked to the ODRF table. In case of a draft document, the "current" table is the same ODRF you are linking to in the ODRF_ONLY table reference, so all fields will be identical. If the table is different, then ODRF_ONLY.DocTotal will be Null or (highly likely) different from your current DocTotal. So the formula will return true if you are looking at a draft document and false if you are looking at a different document.

  5. Now suppress any sections or fields you do not want to be visible, based on the new formula:

Mission complete! This will hide anything you want if the document is a draft.

Of course, you might want to block printing altogether. One possibility is to provoke an error if the document is a draft. Consider the following "BlockPrinting" formula as a possible solution:
NumberVar zero := 0;
if {@IsDraft} then (1/zero)

This will produce a "division by zero" error whenever a user tries to print a draft document... Elegant? Probably not. But it works. 🙂

If anybody has an easier way to determine what is a draft document, please share in the comments!

Happy New Year!

1 Comment