Call Event Function from Another Method in Controller in SAP

Nancy Den
Updated on 18-Dec-2019 10:02:35

667 Views

It is advised not to call the event function from any other function but what you can do is refactor the event function implementation in a separate function and call that from any other function as shown below:ExampleBtnPress: function(oEvent) {    // Separate the implementation in the helper function    this.btnPressHelper(); } // Define the helper btnPressHelper: function() {    //logic here } // call the helper from whichever function you want to get the desired output PerformSomething: function() {    this.btnTapHelper(); }

Find Length of the Longest Consecutive Path in C++

Arnab Chakraborty
Updated on 18-Dec-2019 10:01:27

180 Views

A matrix of different characters is given. Starting from one character we have to find longest path by traversing all characters which are greater than the current character. The characters are consecutive to each other.Starts from E.To find longest path, we will use the Depth First Search algorithm. During DFS, some sub problems may arise multiple times. To avoid the computation of that sub problems again and again, we will use dynamic programming approach.Example Live Demo#include #define ROW 3 #define COL 3 using namespace std; // tool matrices to recur for adjacent cells. int x[] = {0, 1, 1, -1, 1, ... Read More

Comparing Two Strings in C++

Arnab Chakraborty
Updated on 18-Dec-2019 09:56:31

453 Views

Here we will see how to compare two strings in C++. The C++ has string class. It also has the compare() function in the standard library to compare strings. This function checks the string characters one by one, if some mismatches are there, it returns the non-zero values. Let us see the code to get better idea.Example Live Demo#include using namespace std; void compareStrings(string s1, string s2) {    int compare = s1.compare(s2);    if (compare != 0)       cout

Find Length of Longest Subsequence of One String Which is Substring of Another String in C++

Arnab Chakraborty
Updated on 18-Dec-2019 09:40:29

2K+ Views

Suppose, we have two strings X and Y, and we have to find the length of longest subsequence of string X, which is substring in sequence Y. So if X = “ABCD” and Y = “BACDBDCD”, then output will be 3. As “ACD” is the longest sub-sequence of X, which is substring of Y.Here we will use the dynamic programming approach to solve this problem. So if the length of X is n, and length of Y is m, then create DP array of order (m+1)x(n+1). Value of DP[i, j] is maximum length of subsequence of X[0…j], which is substring ... Read More

Find Largest Special Prime Less Than or Equal to a Given Number in C++

Arnab Chakraborty
Updated on 18-Dec-2019 09:36:11

468 Views

Suppose we have a number n. We have to find the largest special prime which is less than or equal to N. The special prime is a number, which can be created by placing digits one after another, so all the resultant numbers are prime.Here we will use Sieve Of Eratosthenes. We will create the sieve array up to the number n. Then start iteratively back from the number N, by checking if the number is prime. When this is prime, check whether this is special prime or not.Example Live Demo#include using namespace std; bool isSpecialPrime(bool sieve[], int num) {   ... Read More

Find Index of 0 to Replace with 1 for Longest Sequence of 1s in Binary Array

Arnab Chakraborty
Updated on 18-Dec-2019 09:27:13

257 Views

Suppose, we have an array of N elements. These elements are either 0 or 1. Find the position of 0 to be replaced with 1 to get longest contiguous sequence of 1s. Suppose the array is like arr = [1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1], the output index is 9. Replacing 0 with 1 at index 9 cause the maximum contiguous sequence of 1sWe have to keep track of three indexes. current index(curr), previous zero index(pz), and previous to previous zero index (ppz). Now traverse the array when array element is 0, then ... Read More

Reach the End Through Given Transitions in C++

Arnab Chakraborty
Updated on 18-Dec-2019 09:22:29

135 Views

Suppose we have n points on x-axis and the list of allowed translation between the points. Find if it is possible to reach the end from starting point through these transactions only. So if there is a translation between points x1 and x2, then we can move from point x to any intermediate points between x1 and x2, or directly to x2. So if n = 5. And transactions are 0 to 2, 2 to 4, and 3 to 5. Then output will be YES. There is a path from 0→2→3→5.We have to sort the list according to the first ... Read More

Find First Non-Matching Leaves in Two Binary Trees in C++

Arnab Chakraborty
Updated on 18-Dec-2019 09:20:24

148 Views

Suppose we have two binary trees. We have to find first leaf of two trees, that does not match. If there are no non-matching leaves, then display nothing.If these are two trees, then the first non-matching leaves are 11 and 15.Here we will use the iterative preorder traversal of both of the trees simultaneously using stack. We will use different stack for different trees. We will push nodes into the stack till the top node is the leaf node. Compare two top, if they are same, then do further checking, otherwise show two stack top elements.Example Live Demo#include #include ... Read More

Find Equal or Middle Point in a Sorted Array with Duplicates in C++

Arnab Chakraborty
Updated on 18-Dec-2019 09:14:58

168 Views

Suppose we have one sorted array with n elements. The array is sorted. We have to find whether an element exists in an array from where the number of smaller element is same as the number of larger elements. If the equal point appears multiple times in the array, return the index of first occurrence. If no such point is present, then return -1. Suppose the elements are like A = [1, 1, 2, 3, 3, 3, 3, 3], then the equal point is at index 2, the element is A[2] = 2. As it has only one smaller element ... Read More

Communicate with SAP System using PHP

Rishi Rathor
Updated on 18-Dec-2019 08:44:34

997 Views

You can communicated with any SAP system from PHP in many ways, but the preferred standard available choices areRFC (remote function call)Web ServicesPHP has got one RFC library to communicate with SAP. But the main job in your problem statement lies with your partner as they are the one dealing with SAP component. You need to check with them what they prefer services or RFC. Don’t forget to double check with them in case they already have any existing API (can be anything) which can serve your purpose. Because it entirely depends on them as in how they want you ... Read More

Advertisements