Skip to Content

Off late, I have received few questions on how retrieve the print preview form (PDF content) of standard business object via coding . In this blog, I would like to share the code snippet to simulate the preview action in ABSL (code). The logic for standard object and custom objects are different as explained below.

Standard Objects:

I will take Quote object as an example. Before we start to write the code, we will require following information related to form template.

  1. Form Template Group Code: Group code identifies the collection of form templates with same semantics grouped under it..
  2. Object Type Code It is the type code of the business object.
  3. Object Node Type CodeIt is the type code of the node (usually root node).

We get the above information from the repository explorer in cloud application studio. (menu options: view->repository explorer) as shown below.

Form Template Group Code: We From repository explorer, under data types, search for OutputRequestFromTemplateGroupCode:

Object Type Code: Again from repository explorer, under business object, select the business object. Under description section you will find the Object Type Code.  . Ex – CustomerQuote = 30

Object Node Type Code: Again from repository explorer, select the root node of the business object. Under description section you will find the Object Node Type Code. Ex- 3807


Now we are ready to write the code.

Code snippet:

import ABSL;
import BASIS.Global;
import AP.Common.GDT;
import DocumentServices.Global;

//To simulate Preview
var docOutReq :  elementsof  DocumentOutputRequest;

docOutReq.ReferenceObjectNodeID.content =  this.UUID.content.ToString(); // UUID of root node.
docOutReq.ReferenceObjectNodeTypeCode.content = "3807"; //Object Node Type code of Quote root node
docOutReq.ReferenceObjectTypeCode.content = "30"; //Object type code of Quote BO

var docInst = DocumentOutputRequest.Create(docOutReq);

var FTG : OutputRequestFormTemplateGroupCode;
FTG.content = "C02"; //Form Template Group Code for Quote


var DocItem = docInst.Item;
var docItem = docInst.Item.GetFirst(); // Or get based on lang, template code.

docItem.Preview(); // Execute preview action
var binCont = docItem.ItemPreview.PreviewBinaryObject; // Get the binary object of PDF.



Custom Objects:

It is simple compared to standard objects, we use the standard reuse library 🙂

OutputManagementUtilities.GetPDF(BusinessObjectNode, FormTemplateCode,    FormTemplateLanguage);

  1.  BusinessObjectNode = Node instance of the business object , ex “this”.
  2. FormTemplateCode = Code in the Form Template Header
  3. FormTemplateLanguage = Language of form template, ex ‘E’

Code snippet:

import ABSL;
import AP.Common.GDT;
import DocumentServices.Global;
import BASIS.Global;

var FormTemplateLanguage = "E";
var PDF : BinaryObject;
var FormTemplateCode : OutputRequestFormTemplateCode;

//Code is Form Template Header Code
//Could be different for Orgianal vs Patch solution.
	FormTemplateCode.content = "YXXXXXXW_P00RY"; //patch solution
	FormTemplateCode.content = "YXXXXXXW_P00RY"; //Orignal Solution
// Reuse Service Call 
PDF = OutputManagementUtilities.GetPDF(this,FormTemplateCode,FormTemplateLanguage);
To report this post you need to login first.


You must be Logged on to comment or reply to a post.

  1. Said M.

    Dear Pramodh,

    thank you for the great tutorial.
    In order to creat pdf content for custom visits programatically, i’ve following your instruction.
    But it seems, that DocumentOutputRequest not working for Custom Visits.
    my Setup :

    docOutReq.ReferenceObjectNodeTypeCode.content = "38268"; // 3631 try also with apppointmentActivity wich is deprecated
    docOutReq.ReferenceObjectTypeCode.content = "12"; // ​
    FTG.content = "C02";
    Do you have an idea what I did wrong?
    Best Regards
    1. Pramodh Patil Post author

      Hi Said,

      You mentioned that it is a custom visit. For custom objects please check the second section, there is a standard API.

      thanks & regards






Leave a Reply