Connect to Dynamic URL within OData in SAP Project

SAP Developer
Updated on 13-Feb-2020 07:15:44

417 Views

You can try and create a URL in your code which you can read from config or XML.Here is a sample code snippet −String uri = // Can read from config or anywhere string odQuery = "?$format=json" var req = WebRequest.Create(uri+"/"+ odQuery); req.Method = "GET"; var streamreader = new StreamReader(stream: request.GetResponse().GetResponseStream()); string response = streamreader.ReadToEnd(); //json responseThis is a sample code snippet but you can modify it as per your use case.

MySQL Stored Function Evaluating NULL Values with Dynamic Table Values

Ramu Prasad
Updated on 13-Feb-2020 07:13:43

256 Views

In such kind of cases when a stored function got NULL values then it will return NULL as the result. It can be understood from the example below in which we have a NULL value in the records of student ‘Mohit’. Now, when we will apply the stored function ‘avg_marks’ on this data, it will return NULL as result.mysql> Select * from Student_marks; +-------+------+---------+---------+---------+ | Name  | Math | English | Science | History | +-------+------+---------+---------+---------+ | Raman |   95 |      89 |      85 |      81 | | Rahul |   90 | ... Read More

Create MySQL Stored Function Using Dynamic Data from Table

Sravani S
Updated on 13-Feb-2020 07:12:47

496 Views

MySQL Stored functions can reference tables but they cannot make use of statements that return a result set. Hence we can say that there is no SELECT query that returns result set. But we can have SELECT INTO to get rid of that. For example, we are creating a function ‘Avg_marks’ that uses the dynamic data from table named ‘Student_marks’, having following records, to calculate the average of marks.mysql> Select * from Student_marks; +-------+------+---------+---------+---------+ | Name  | Math | English | Science | History | +-------+------+---------+---------+---------+ | Raman |   95 |      89 |      85 | ... Read More

Write MySQL Stored Function to Insert Values in a Table

Giri Raju
Updated on 13-Feb-2020 07:00:24

1K+ Views

As we know that function is best used when we want to return a result. Hence, when we will create stored functions for manipulating tables like to Insert or Update values then it would be more or less like stored procedures.ExampleIn the following example we are creating a stored function named ‘tbl_insert’ which will insert the values in a table named ‘student_marks’.mysql> Create Function tbl_insert(S_name Varchar(50), M1 INT, M2 INT, M3 INT, M4 INT)     -> RETURNS INT     -> DETERMINISTIC     -> BEGIN     -> INSERT INTO student_marks values(S_name, M1, M2, M3, M4);     ... Read More

Write MySQL Stored Function to Update Table Values

mkotla
Updated on 13-Feb-2020 06:59:33

1K+ Views

As we know that function is best used when we want to return a result. Hence, when we will create stored functions for manipulating tables like to Insert or Update values then it would be more or less like stored procedures. In the following example, we are creating a stored function named ‘tbl_update’ which will update the values in a table named ‘student_marks’.mysql> Select * from student_marks// +---------+------+---------+---------+---------+ | Name    | Math | English | Science | History | +---------+------+---------+---------+---------+ | Raman   |   95 |      89 |      85 |      81 | ... Read More

Explicitly Define Datatype in a Python Function

Sarika Singh
Updated on 13-Feb-2020 06:27:43

781 Views

Yes, in Python, you can explicitly define the datatype of function parameters and return values using type hints or type annotations. Even if you specify the data types using type hints, Python will still run the code even when the wrong types are passed. The execution of the program will not be interrupted, and an error will not be raised.To find these type-related mistakes, you can use tools like mypy or pyright that check your code before it runs. Using Type Hints in Python Functions To add type hints to a parameter of a function, you need to specify the ... Read More

Create MySQL Stored Procedure to Calculate Factorial

Srinivas Gorla
Updated on 13-Feb-2020 06:13:37

435 Views

mysql> DELIMITER // mysql> CREATE PROCEDURE get_factorial(IN N INT)     -> BEGIN     ->    SET @@GLOBAL.max_sp_recursion_depth = 255;     ->    SET @@session.max_sp_recursion_depth = 255;     ->     ->    CALL factorial_recursive (N, @factorial);     ->     ->    SELECT @factorial;     -> END // Query OK, 0 rows affected (0.00 sec) mysql> DELIMITER // mysql> CREATE PROCEDURE factorial_recursive(IN N INT, OUT factorial INT)     -> BEGIN     ->    IF N = 1 THEN     ->       SET factorial := 1;     -> ... Read More

Implement Custom Python Exception with Custom Message

Manogna
Updated on 13-Feb-2020 05:11:20

298 Views

For the given code above the solution is as followsExampleclass CustomValueError(ValueError): def __init__(self, arg): self.arg = arg try: a = int(input("Enter a number:")) if not 1 < a < 10: raise CustomValueError("Value must be within 1 and 10.") except CustomValueError as e: print("CustomValueError Exception!", e.arg)OutputEnter a number:45 CustomValueError Exception! Value must be within 1 and 10. Process finished with exit code 0

Creating Custom Reports from SAP for Line Managers

SAP ABAP Expert
Updated on 13-Feb-2020 04:49:13

192 Views

To use Crystal Report, you need to buy license for the tool and then you have to learn report development for custom reporting and scheduling. Also to view reports, Line managers need to have BO read only access via Infoview however you can also set up a schedule to the reports.You can use the Publishing feature too for publishing the reports to different users via email but for that you need to have BO Enterprise installed and then you can schedule the published reports.For a list of cheap free 3rd-party Crystal Reports schedulers, you can refer to below link:3rd-party Crystal ... Read More

Writing Files in the Background in Python

Hafeezul Kareem
Updated on 12-Feb-2020 13:01:33

583 Views

In this tutorial, we will learn about the multi-threading in Python. It helps us to perform multiple tasks at a time. Python has a module called threading for multitasking.We see how it works by writing data to a file in the background while calculating the sum of elements in a list. Let's see the steps involved in the program.Import the threading module.Create a class by inheriting threading.Thread class.Write the file code inside the run method in the above class.Initialize the required data.Write the code to calculate the sum of numbers in a list.Example# importing the modules import threading # creating ... Read More

Advertisements