OnInit Method Not Called When Navigating in SAPUI5

Anil SAP Gupta
Updated on 17-Feb-2020 12:39:18

805 Views

You have identified the correct use case as it is by design as you have navigated back and forth, it renders the last version rendered and OnInit() does not gets called. But if you want to override this behavior, SAP lets you do it.You can delegate to the patternMatched event of router, so that wheever the view is rendered the OnInit() method is invoked.this.getOwnerComponent().getRouter().getRoute("").attachPatternMatched(, this);You need to attach the even handler to the router in the init method of the controller. Hope it helps and sorts out your requirement.

Hide and Show a Column in SAP Detail Window

Anil SAP Gupta
Updated on 17-Feb-2020 12:37:46

674 Views

You just need to set the expression which binds to the visibility propert. Go to Data window and select your desired column which you need to show/hide. Then go to properties and look out for the “Visible” checkbox and click on the highlighted button.Now write the expression which should drive its visibility. Hope it helps.

Show Only One View at a Time in Wizard in SAP UI5

Anil SAP Gupta
Updated on 17-Feb-2020 12:35:22

414 Views

I will say not it is not a big out of box requirement. You can easily get it done. What you need to do is to hook up your requirement in the complete event of the wizard which gets invoked on each step completion. You just need to hide the completed view and show the next view. So you will be viewing only one view at a time.onComplete: function(oEvent) {                 var wdStep = oEvent.getSource();                 wdStep.setVisible(false);             }

Call Another Function within Initialize Method of Controller in SAP UI5

Anil SAP Gupta
Updated on 17-Feb-2020 12:34:32

546 Views

Yes, you are absolutely correct. It is very basic thing, you just need to use this operator for making the function call.onInit: function() {    //Your logic    this.CustomFunction(); } CustomFunction : function () {   // some logic }

Refer Class Interface with Namespace in SAP .NET

Anil SAP Gupta
Updated on 17-Feb-2020 12:33:59

89 Views

Note that you have to ensure that you are using .NET framework and not .NET 4.0 client. Refer this link and you would get an idea:SAP Discussion

View Valid Values of Profit Center Groups in SAP ABAP

Anil SAP Gupta
Updated on 17-Feb-2020 12:31:53

332 Views

You need to select SETNAME from table SETLEAF with SETCLASS value 0106. To reduce number of values in search you can pass a Controlling area in field SUBCLASS or value of Profit center in VALFROM field.For more details, refer this SAP discussion: How to find profit center group for any profit centerSAP DiscussionOpen the Table SETLEAF, and follow below steps:Pass in field SETCLASS as '0106'.Pass in field SUBCLASS with controlling area.Pass Profit center in Field VALFROM.You will get Group name in Field SETNAME.

Rows with No Data Visible After Search in SAP UI5 Grid

Anil SAP Gupta
Updated on 17-Feb-2020 10:56:18

478 Views

The “No Data” rows are being shown in the grid irrespective of having no data is because of the “VisibleRowCount” attribute of the control. It controls the number of visible rows. So, once you are binding the table again after applying the filters, you need to update it dynamically to the number of rows in the matched result.Something similar to this −onBindingChange: function(oEvent) {     this.getView().byId("").setVisibleRowCount(oEvent.getSource().getLength()); }

Count All Sub-Sequences Having Product K - Recursive Approach in C++

Ayush Gupta
Updated on 17-Feb-2020 10:49:05

245 Views

In this tutorial, we will be discussing a program to find the number of sub-sequences having product k) {       discard_count += power(2, n - i);       return;    }    if (i == n)       return;       float rem = prefix[n - 1] - prefix[i];    if (sum + a[i] + rem > k)       solve(i + 1, n, sum + a[i], k, a, prefix);    if (sum + rem > k)       solve(i + 1, n, sum, k, a, prefix); } int countSubsequences(const int* arr, ... Read More

Count All Possible Walks with Exactly K Edges in C++

Ayush Gupta
Updated on 17-Feb-2020 10:45:04

169 Views

In this tutorial, we will be discussing a program to find the number of walks from a source to a destination with exactly k edges.For this we will be provided with a graph and the values of source and destination. Our task is to find all the possible paths starting from the source to the destination having exactly k edges.Example Live Demo#include using namespace std; #define V 4 //counting walks using recursion int countwalks(int graph[][V], int u, int v, int k){    if (k == 0 && u == v)       return 1;    if (k == 1 && graph[u][v])       return 1;    if (k

Count Prefixes of Binary Array Divisible by X in C++

Ayush Gupta
Updated on 17-Feb-2020 10:40:52

130 Views

In this tutorial, we will be discussing a program to find the number of prefixes of the binary array which are divisible by x.For this we will be provided with binary array and a value x. Our task is to find the number of elements whose prefixes are divisible by given value x.Example Live Demo#include using namespace std; //counting the elements with prefixes //divisible by x int count_divx(int arr[], int n, int x){    int number = 0;    int count = 0;    for (int i = 0; i < n; i++) {       number = number ... Read More

Advertisements