Articles on Trending Technologies

Technical articles with clear explanations and examples

How can we sort a JSONObject in Java?

raja
raja
Updated on 18-Feb-2020 6K+ Views

A JSONObject is an unordered collection of a key, value pairs, and the values can be any of these types like Boolean, JSONArray, JSONObject, Number and String. The constructor of a JSONObject can be used to convert an external form JSON text into an internal form whose values can be retrieved with the get() and opt() methods or to convert values into a JSON text using the put() and toString() methods.In the below example, we can sort the values of a JSONObject in the descending order.Exampleimport org.json.*; import java.util.*; public class JSonObjectSortingTest { public static void main(String[] ...

Read More

How to access the private methods of a class from outside of the class in Java?

karthikeya Boyini
karthikeya Boyini
Updated on 18-Feb-2020 7K+ Views

You can access the private methods of a class using java reflection package.Step1 − Instantiate the Method class of the java.lang.reflect package by passing the method name of the method which is declared private.Step2 − Set the method accessible by passing value true to the setAccessible() method.Step3 − Finally, invoke the method using the invoke() method.Exampleimport java.lang.reflect.Method; public class DemoTest {    private void sampleMethod() {       System.out.println("hello");    } } public class SampleTest {    public static void main(String args[]) throws Exception {       Class c = Class.forName("DemoTest");       Object obj = c.newInstance(); ...

Read More

How many ways can get the instance of a Class class in Java?

Monica Mona
Monica Mona
Updated on 18-Feb-2020 657 Views

You can create an object of the class named Class in two ways −Using new keyword as −Class obj = new Class();Using the forName() method of the class named Class.Class obj = Class.forName("DemoTest");

Read More

How to insert a Python tuple in a PostgreSql database?

Pythonista
Pythonista
Updated on 18-Feb-2020 1K+ Views

PostgreSql database is by default installed on port number 5432. Python interface to PostgreSql is provided by installing psycopg2 module. Assuming that test database and employee table with fname, sname, age, gender and salary fields is available.First establish connection and obtain cursor object by following statements in Python script.import psycopg2 conn = psycopg2.connect(database = "test", user = "postgres", password = "pass123", host = "localhost", port = "5432") cur = conn.cursor()Data to be inserted in employee table is stored in the form of tuple objectt1=('Mac', 'Mohan', 20, 'M', 2000)Next set up the insert query using this tuplesql="insert into employee values(%s, %s, ...

Read More

How to install JDK in Windows and set up the environment variables?

mkotla
mkotla
Updated on 18-Feb-2020 2K+ Views

Download the latest version of Java from the official site. Run the .exe to install Java on your machine. Once you installed Java on your machine, you will need to set environment variables to point to correct installation directories −Setting Up the Path for Windows:Assuming you have installed Java in c:\Program Files\java\jdk directory − Right-click on 'My Computer' and select 'Properties'.Click the 'Environment variables' button under the 'Advanced' tab.Now, alter the 'Path' variable so that it also contains the path to the Java executable. Example, if the path is currently set to 'C:\WINDOWS\SYSTEM32', then change your path to read 'C:\WINDOWS\SYSTEM32;c:\Program Files\java\jdk\bin'.

Read More

Logging in SAP using command line

SAP
Nikitha N
Nikitha N
Updated on 18-Feb-2020 2K+ Views

sapshcut.exe command can be used to log in to SAP from command line as shown in below example:ProcedureAdd the directory that contains the sapshcut.exe command to your system or user path. The sapshcut.exe command is installed as part of the SAP client into the following directory: C:\Program Files\SAP\FrontEnd\SAPguiTo add additional directories to the system or user path on Windows systems, select Control Panel > System > Advanced > Environment Variables.The .bat file must be named sapshcut.bat  must be located in your default path preceding the sapshcut.exe file.The following parameters are passed to the sapshcut.bat file when called from a predefined ...

Read More

Changing program title in SAP

SAP
Priya Pallavi
Priya Pallavi
Updated on 18-Feb-2020 877 Views

SET TITLEBAR function should be called from a module that is called from PBO of your screen.The title which you are providing should be active. This can be checked by loading your program in SE80 and check the program information in the tree to the right.

Read More

Using SAP Gateway service in SAP Web project

SAP
Nikitha N
Nikitha N
Updated on 18-Feb-2020 368 Views

Please executes the below steps to get the services added −Define service in your manifest.json file?"sap.app": {    [...],    "dataSources": {       "mainService": {           "uri": "Path of your service",           "type": "OData",          "settings": {             "odataVersion": "X.X",             "localUri":             "localService/metadata.xml"          }       } }, [...]The model definition should be implemented in your manifest.json file?"models": {    [...],    "": {       "dataSource": "mainService",       "settings": {          "metadataUrlParams": {             "sap-documentation": "heading"          },         "defaultBindingMode": "TwoWay"       }    } },

Read More

Hiding SAP ABAP table control column

Swarali Sree
Swarali Sree
Updated on 18-Feb-2020 4K+ Views

You can use the structure CXTAB_CONTROL that has the following components:INVISIBLE C(1) Flag (X or blank) for visibility of entire table control.You can use sample program: RSDEMO02 that allow you to modify properties of table control and view the results.When you use this Table control INVISIBLE, this changes the content to “xxxxxxxxxxxx” like a hidden password. If you want to hide the complete column including data and header, your code should be like this −MODULE MODIFY_100 OUTPUT.  DATA wa_tabctrl TYPE cxtab_column .looping the table controlLOOP AT TABCTRL-COLS INTO WA_TABCTRL.  IF WA_TABCTRL-NAME =  'POSNR'. When you get on the desired screen you ...

Read More

Getting unauthorized exception in SAP ABAP

Samual Sam
Samual Sam
Updated on 18-Feb-2020 282 Views

To fix this issue, you need to add try/catch response to the code. When you don’t include an authorization header, it results in an error 401 from the server.try { CatalogService.CatalogChangeClient service = new CatalogService.CatalogChangeClient(); service.ClientCredentials.UserName.UserName = "username"; service.ClientCredentials.UserName.Password = "password"; service.ClientCredentials.SupportInteractive = true; ProductUpdate[] products = new ProductUpdate[1]; products[0] = new ProductUpdate(); products[0].ProductCode = "00001"; products[0].ProductDescription = "TestProduct"; string result = service.UpdateProducts(products); } catch (Exception exception) { Console.WriteLine(exception.Message); }

Read More
Showing 54931–54940 of 61,297 articles
Advertisements