Wednesday, April 24, 2013

How to setup RFC Destination to SAP System



RFC Destination is one of the way to connect from an ABAP system to an external system. This weblog talks about the basic HTTP connection to external server (type G).
Business usecase from my area of expertise is connecting any R/3 system to a CE ESR (mainly for Proxy generation of Services Modeled in ESR).

Step 1:

Go to transaction SM59.
UI looks like as follows:

Step 2:

As shown in the picture above, select the HTPP connection to external server and click on the Create icon (marked in red).
RFC Connection UI will come up. Fill in the necessary details as shown below:


Note that RFC Name should be unique, connection type should be Type-G.
Other information you need to enter is the host (or IP), Port and the Context root. The following URL should match the service deployed on AS.
A good example to use the RFC destination will be to write a small ABAP code to establish connection to a servlet deployed on AS. User can use HTTP protocol to invoke it from ABAP.

Step 3:

Click on the save icon  and you will recieve an info message stating "HTTP connection may not be secure" which is true.


Press  to continue.

Step 4:

Now most of the application which the RFC destination points to will require some basic authentication. And if it is not provided part of the RFC destination, quite possible when the program uses the RFC Destination, it prompts for username-password! So lets enter the logon & security details as shown below: 

Step 5: 

Click on the save icon  and now press on the connection test button to see whether the server is available or not. Incase the entries point to the correct system, output should be somewhat similar as shown below: 
  
More info:
- Incase wrong entries are provided error message comes at the status bar:
- Connection test DO NOT check the credentials. Even if wrong credentials are passed this information is not validated.
Next steps... write small abap code to invoke a servlet...!!! Sounds simple & interesting.





Friday, April 19, 2013

Controlling number of parallel jobs based on number of available processors for JVM



//No. of processors available for JVM
private static final int NO_OF_PROCESSORS = Runtime.getRuntime().availableProcessors();
private static final String JS_FAMILY = "js_typechecking_family"; //$NON-NLS-1$


Override belongsTo method in Job.
@Override

public boolean belongsTo(Object family) {
return family == JS_FAMILY;
}


Execution call:


try {
monitor.beginTask("Project: " + project.getName(), jsModules.size());

//Create number of parallel jobs based on the number of processors available to the Java virtual machine.
IJobManager jobManager = Job.getJobManager();
for (IFile iFile : jsModules) {
Job[] find = jobManager.find(JS_FAMILY);
if (find.length == NO_OF_PROCESSORS) {
while (true) {
try {
Thread.sleep(100);//sleep for some time buddy!!
} catch (InterruptedException e) {
//nothing
}
Job[] queueJobs = jobManager.find(JS_FAMILY);
if (queueJobs.length < NO_OF_PROCESSORS) {
break;
}
}
}

if (monitor.isCanceled()) {
throw new OperationCanceledException();
}
monitor.setTaskName("Identifying xxx: " + iFile.getName());
try {
startExecution(...);//args here
} catch (Exception e) {
EditorPlugin.logError(e);
}
monitor.worked(1);
}

} finally {
monitor.done();
}






Thursday, April 18, 2013

What is SAP JCo and where can i get it ?


Setting up a SAP connection

This section describes how to set up a SAP connection, if you plan to develop mobile applications using the SAP framework.
To set up the SAP connection you must:
·  Configure the SAP connection using the SAP Java Connector (SAP JCo). SAP JCo is a toolkit that allows a Java application to communicate with any SAP system. The SAP Java Connector can be downloaded from the SAP Service Marketplace Web site by a registered SAP customer.

Configuring the SAP Java connector
1.     Open a Web browser window and enter the SAP Marketplace URL, which currently is:
2.  https://websmp204.sap-ag.de/swdc or  http://service.sap.com/connectors --> SAP Java Connector
The Client Authentication window displays.
3.     Select the certificate to use when connecting, and click OK. The Enter Network Password window displays.
4.     Enter your registered SAP customer user name and password in the User Name and Password fields, and click OK. The SAP Software Distribution Center window displays.
5.     In the You Are Here navigation bar on the left side of the page, navigate to Download | SAP Connectors | SAP Java Connector | Tools and Services. Click the link for SAP JCo Release 3.0.X to download the SAP Java Connector.
6.     Follow the installation instructions provided by SAP. When prompted, copy the .jar and .dll files to these locations:

Configuring the SAP environment for Eclipse Studio

To configure SAP Environment for IDE   Copy the following files from the SAP installation and place them in <JDK_Installation_Path>/jre/ lib/ext folder:
  1. sapjco3.dll
    sapjco3.jar
    Note: If you have a Windows OS, copy the sapjco3.dll file. If you have a Linux or Unix environment, copy the sapjco3.so file.

  2. Modify the config.ini file and add the following line at the end of the file:
    osgi.parentClassloader=ext
    This file is available at <Eclipse_Installation_Path>/configuration.

      Incase of Mac OS, keep sapjco3.dll and libsapjco3.jnilib files in the java/extensions folder.
  1.     Restart Eclipse. 



Identifying deadlocks in your Eclipse RCP

Add following parameters in eclipse.ini file


-Dcom.sun.management.jmxremote.port=1436 <any free port>
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false


Open  JConsole.exe: which can found in the following directory
C:\Program Files (x86)\Java\jdk1.6.0_31\bin


Enter the remote host and port details:
localhost:1436

We can find the thread details in Thread section.




Tuesday, April 16, 2013

Your eclipse is 32 or 64 bit ??



How can I find out if a specific Eclipse instance on my (Windows 7) PC is the 32-bit or 64-bit version?

Windows Task Manager Dialog:
Hit ctrl-alt-delete, open up task manager - look at the processes tab. 32-bit programs should be marked with a *32

eclipse.ini file:
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.2.R36x_v20101222

And also you can find in
Eclipse SDK Installation Details:> Configuration page

Monday, April 15, 2013

Order of Tags in Java comments




Order of Tags
Include tags in the following order:
  • @author (classes and interfaces only, required)
  • @version (classes and interfaces only, required.)
  • @param (methods and constructors only)
  • @return (methods only)
  • @exception (@throws is a synonym added in Javadoc 1.2)
  • @see
  • @since
  • @serial (or @serialField or @serialData)
  • @deprecated 

Tuesday, April 2, 2013

GIT: showing only list of modified files in a commit


git show --pretty="format:" --name-only  6773e94744fd6885f0737655e491f075afb8c80a

Output:

trunk/guieditor/src/com/pat/tool/keditor/editors/SAPServerDetailsDialog.java
trunk/guieditor/src/com/pat/tool/service/model/SAPServer.java
trunk/guieditor/src/com/pat/tool/service/model/SAPServerUtil.java