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.
- Form Template Group Code: Group code identifies the collection of form templates with same semantics grouped under it..
- Object Type Code: It is the type code of the business object.
- Object Node Type Code – It 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
docInst.RefreshDefaultOutputRequest(FTG);
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.
docInst.Delete();
Custom Objects:
It is simple compared to standard objects, we use the standard reuse library
OutputManagementUtilities.
GetPDF(BusinessObjectNode, FormTemplateCode, FormTemplateLanguage);
- BusinessObjectNode = Node instance of the business object , ex "this".
- FormTemplateCode = Code in the Form Template Header

- FormTemplateLanguage = Language of form template, ex ‘E’
Code snippet:
import ABSL;
import AP.Common.GDT;
import DocumentServices.Global;
import BASIS.Global;
//variables
var FormTemplateLanguage = "E";
var PDF : BinaryObject;
var FormTemplateCode : OutputRequestFormTemplateCode;
//Code is Form Template Header Code
//Could be different for Orgianal vs Patch solution.
if(Context.IsPatchSolution()){
FormTemplateCode.content = "YXXXXXXW_P00RY"; //patch solution
}else{
FormTemplateCode.content = "YXXXXXXW_P00RY"; //Orignal Solution
}
// Reuse Service Call
PDF = OutputManagementUtilities.GetPDF(this,FormTemplateCode,FormTemplateLanguage);