Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
Showing results for 
Search instead for 
Did you mean: 
In this Blog post, I am going to explain how we can call Backend Smart Form in the SAP UI5.

Here I got the data from Backend, you can see the data in the above screen. When you select any row of the table and then if you click Preview Button, You can find the Smart form(came from Backend Service) here based on Purchase Order Number. You can download also...

If you select multiple records, it will throw an error because I am displaying Smart form for single purchase order number every time.

Here you can find View code for the table control and button available in the footer section.


View Code:

		<Page class="clsPage" title="{i18n>title}">
<ScrollContainer focusable="false" vertical="true" horizontal="true" height="100%">
<Table growingScrollToLoad="true" growingThreshold="20" growing="true" id="table" items="{path:'tableModel>/data'}" class="stickyClass"
sticky="ColumnHeaders,HeaderToolbar" mode="MultiSelect">
<SearchField width="30%" id="search" placeholder="Search By Purchase Order" liveChange="onSearch22"></SearchField>
<Column hAlign="Center">
<Label text="Purchase Order No" design="Bold"></Label>
<Column hAlign="Center">
<Label text="Company Code" design="Bold"></Label>
<Column hAlign="Center">
<Label text="Vendor" design="Bold"></Label>
<Column hAlign="Center">
<Label text="Language" design="Bold"></Label>
<ColumnListItem press="onRow" type="Navigation">
<Text text="{tableModel>Ebeln}"></Text>
<Text text="{tableModel>Bukrs}"></Text>
<Text text="{tableModel>Lifnr}"></Text>
<Text text="{tableModel>Sptxt}"></Text>
<Button type="Accept" text="Preview" press="onGet"></Button>


Controller Code:

	onInit: function() {


onRead: function() {
var that = this;

var tableModel = new JSONModel();
that.getView().setModel(tableModel, "tableModel");
var oModel = this.getOwnerComponent().getModel("oDataModel");"/PoHeadSet", {
success: function(data, res) {
if (res.statusCode === "200" || res.statusCode === 200) {

that.getView().getModel("tableModel").setProperty("/data", data.results);
error: function(error) {
var errorMsg = JSON.parse(error.responseText).error.message;;

onGet: function(oEvent) {

var oValue = this.getView().byId("table").getSelectedItem().getBindingContext("tableModel").getObject().Ebeln;

var selItems = this.getView().byId("table").getSelectedItems();
if (selItems.length === 1) {

var oModel = this.getOwnerComponent().getModel("oDataModel").sServiceUrl;

var sSource = oModel + "/SformSet('" + oValue + "')/$value";
this._pdfViewer = new sap.m.PDFViewer();
this._pdfViewer.setTitle("Smart Form");;
} else {
MessageBox.error("Please Select Single Record Only");



These steps I followed to achieve this requirement, Hope this is helpful. Any feedback will be appreciated. Do follow me for more content.


Thanks for Reading.
Labels in this area