How to open a pdf in a new tab – GET_STREAM

  1. Build the url
    • Generate the key of the pdf entity via createKey
    • Concatenate it with the service url
    • Don’t forget to add /$value to the url
  2. Open the url in a new tab via sap.m.URLHelper.redirect
		/**
		 * @description Generates the pdf link
		 * @param {string} sParameter - Parameter
		 * @returns {string} pdf link
		 */
		_generatePDFLink: function(sParameter) {
				var oServiceModel = this.getOwnerComponent().getModel(),
					sServiceURL = oServiceModel.sServiceUrl,
					sPath,
					sPDFURL;

				sPath = oServiceModel.createKey("/LoremIpsumSet", {
					Parameter: sParameter
				});

				sPDFURL = sServiceURL + sPath + "/$value";

				return sPDFURL;

			},
			/**
			 * @description open pdf in a new tab
			 */
			openPDFInAnNewTab: function() {
				sap.m.URLHelper.redirect(this._generatePDFLink("Parameter"), true);
			}

Related Information

Leave a Reply

Your email address will not be published. Required fields are marked *