Wednesday, August 29, 2012

How to Implement Application Integrator and Use SSO through User Mapping


How to Implement Application Integrator and Use SSO through User Mapping


Following are the steps to achieve SSO(Single sign on) with User Maping using Application Integrator.

Step1:
Download the AppIntegrator zip file from the SAP Service Market Place .
Here Go to the quick link "solutions" and advance search for the words "using the application integrator" with quotes.Right click on the zip icon of the document named Using the Application Integratorand save it to the local directory. 

Step2:
Upload the com.sap.portal.howtos.webapp.par file into the SAP Enterprise Portal
System Administration -> Support -> Portal Runtime -> Administration Console.
Browse till the location and then Upload.


Step3:
Now, create a new System Template from the com.sap.portal.howtos.webapp.par file
System Administration -> System Configuration -> System Landscape -> Portal Content ->(Right Click) on Any Folder and select New From PAR -> System (from PAR)


Select the radiobutton com.sap.portal.howtos.webapp PAR and then Next.


Select the WebApplication Portal Component and then NEXT.


Enter all the required fields System Name, System ID, etc., and then Next-> Finish->Finish ->Ok


Change the Property Category ‘ Is a Template ‘ to YES , to convert the created System as a System Template so that it can be reused .Save the Changes and close the wizard


Step4:
Create a new System using the above created Web Application Template
System Administration -> System Configuration -> System Landscape -> Portal Content ->Right Click on Any Folder and select New -> System(From Template) -> Refresh the list once.

Select the System Template which was just created i.e., <Name of the system u created in previous step> and then Next
Enter all the required fields System Name, System ID, etc., and then Next -> Finish -> Select Open the Object for Editing then Ok -> From the Property Category select System Definition.


Enter the following and save the changes
Name of the Server : (url for the required webpage )
Protocol of Target system : (whether it is http or https)
URI of Web Application : (login page extension for url)
Step5:

Now go to Property Category again and select UserManagement.

Enter the following and save the changes
Logon Method : UIDPW
User Mapping Type : admin, user
Step6:
From the Display dropdownlistbox select System Aliases.


Enter the System Alias name and ADD it as a default alias and Save the changes made.
And now GOTO the Personalize link and enter the User Mapping fields(Userid for that particular website and password). Save and close the window.

Step7:
Create an iView : Go to Content Administration -> Portal Content -> Portal Content ->Right Click on Any Folder and select New From PAR -> iView.
Select the com.sap.portal.appintegrator.sap PAR file and then Next. Select Generic as the Portal Component and then Next. Enter all the required fields iView Name, iView ID, etc., and then Next -> Finish -> Select Open the Object for Editing-> OK.

From the Property Category , select Content-Generic Launcher -> Enter the Following
System : your system alias name you created through previous step.
URI Template : <System.protocol>://<System.server><System.uri>?action=submitform&user=<User.LogonUid>&password=<User.LogonUid>

Here the ‘user’ , ‘password’ are the attribute names which are fetched from the view/source of the websites’ login page
Save the Changes made and Click on the Preview button in the wizard and You have entered desired site without being asked the username and password.

Hence we have achieved the Single Sign-On through User Mapping.

User Management Scheduler - Scheduler for creating Users


User Management Scheduler

Step 1: Create a Project, through: File-> New-> Other


Step 2: Navigate to Portal Application-> Create a Portal Application Object.-> Next

Step 3: Give the project name : UserManagementScheduler and choose the location where you want to create the application. → Finish


Step 4: Now, create a template for your job through → Right click on src.comp-> New-> Other


Step 5: Select Repository Framework 7.1.5 → Scheduler Task Wizard-> Next

Step 6: Give your class name, package and Eclipse Project Name → Finish



Step 7: Right click on your project → Properties

Step 8: select Java Build Path → under Libraries tab → Click Add Variable



Step 9: Select ECLIPSE_HOME → Extend → Plugins → com.sap.km.rfwizard_7.1.5 → lib → bc.crt_api.jar → OK → OK → OK and also include bc.sf.service.scheduler_api.jar file the same way.

Step 10: Open create.java file and write following code under run method:
java.util.Date currentDt = new java.util.Date();
String TimeStamp=currentDt.getDate()+"_"+(currentDt.getMonth()+1)+"_"+(currentDt.getYear()+1900+"__"+currentDt.getHours()+"_"+currentDt.getMinutes()+"_"+currentDt.getSeconds());

String month="",datee="";

if((currentDt.getMonth()+1) <=9)
{ month="0"+(currentDt.getMonth()+1); }
else
{ month=""+(currentDt.getMonth()+1); }

if((currentDt.getDate()) <=9)
{ datee="0"+(currentDt.getDate()); }
else
{ datee=""+(currentDt.getDate()); }

String tstamp=(currentDt.getYear()+1900)+""+month+""+datee;

FileOutputStream outS,outE,outEX;
PrintStream PS,PE,PEX;

String UserId = "", lineVal="",FirstName = "",LastName = "",Salution = "",Group = "",Role = "";
try
{
StringBuffer contents= new StringBuffer();
StringBuffer error= new StringBuffer();
BufferedReader input = null;
try
{
outS = new FileOutputStream("/User_Enable/AutoCreLog_"+TimeStamp+".txt");
outE = new FileOutputStream("/User_Enable/CreErrorLog_"+TimeStamp+".txt");
PS= new PrintStream(outS);
PS.println("User Log: "+ currentDt);
PS.println("User Log: "+tstamp);
String filePath="/User_Enable/AUC_"+tstamp+".txt";
String uid="";
File testFile = new File(filePath);
input = new BufferedReader( new FileReader(testFile) );
String line = null; //not declared within while loop

while (( line = input.readLine()) != null)
{
ArrayList val = new ArrayList();
contents= new StringBuffer();
contents.append(line);
uid=contents.toString();
PS.println(uid+" from "+filePath);
StringTokenizer st = new StringTokenizer(line,"\t");
while (st.hasMoreTokens())
{
val.add(st.nextToken());
}

for(int i=0; i<val.size();i=i+3)
{
UserId = val.get(i).toString().trim();
FirstName = val.get(i+1).toString().trim();
LastName = val.get(i+2).toString().trim();
try
{
IUserFactory factory = UMFactory.getUserFactory();
IUserAccountFactory accountFactory = UMFactory.getUserAccountFactory();
IUserMaint newUser = factory.newUser(UserId);
newUser.setFirstName(FirstName);
newUser.setLastName(LastName);
newUser.save();
newUser.commit();
newUser.addToGroup("GRUP.PRIVATE_DATASOURCE.un:Client ESS Users");
IUserAccount account =accountFactory.newUserAccount(UserId,newUser.getUid());
account.save();
account.setPassword("client1234");
account.setPasswordChangeRequired(true);
account.commit();
PS.println(account.getLogonUid() + " Created Successfully");
}
catch (Exception e)
{
PE = new PrintStream(outE);
PE.println("Error Log " + currentDt);
PE.println(e.getMessage() + "\n");
}
}
}
input.close();
}
catch (Exception ex)
{
try
{
outE = new FileOutputStream("/User_Enable/FileNotFoundLog_"+TimeStamp+".txt");
PE= new PrintStream(outE);
PE.println("Error Log "+currentDt+"...."+ex+"...");
}
catch(Exception ext)
{
ext.printStackTrace();
input.close();
}
}
}
catch (Exception ex)
{
ex.printStackTrace();
}

Step 11: Build your component and deploy your par and then navigate to following location in portal.
System Administration → System Configuration → Knowledge Management → Configuration → Content Management → Global Services → Scheduler Tasks.
Step 12: You will see your task. Click on it and schedule it to run at a particular time. You can define your new periodic time as well.

Select the time you want to schedule and then click on Apply and OK. In my case am running it every day as 10 am.

Work Protect Mode settings in EP 7.3: for getting rid of views getting opened in separate Windows



                            Accessing Portal Services in SAP NetWeaver Administrator


Some portal applications require specific, non-default settings to their associated services, which reside on AS Java. The configuration of services takes place in the SAP NetWeaver Administrator tool.

Note

The following procedure describes only where you find services and their properties in NetWeaver Administrator; for more detailed functional information, relating to this procedure, see Viewing Web Modules Configuration. For more information about SAP NetWeaver Administrator, see SAP NetWeaver Administrator.

In general, the properties, which are configurable in SAP NWA, belong to additional services, such as portal or Web Dynpro services. These are not to be confused with core AS Java services, which are configured in the AS Java Config Tool.

End of the note.

Procedure

Open the SAP NetWeaver Administrator to the Application Modules page as follows:

The recommended method of access is to add the quick link /app-modules to the NWA URL, (hostname:port/nwa/app-modules).

It is also possible to navigate to the Application Modules page:

Add nwa to the AS Java URL to access SAP NetWeaver Administrator. (hostname:port/nwa) and then go to  Configuration  Infrastructure  and click the Application Modules link.

The Application Modules: Overview window opens.



Search for : epcf.loader ->press enter


Portal applications are Web or application modules; they appear under the Name column in the modules lists. The corresponding Java application is listed under the Application column in the Web module details list.

In the Module List, find the desired application and select it. This updates the Web Module Details pane below, in which you can see the services of the current application (in the Components tab).

To find the application module more easily:


Click Filter to enable filtering by column (a text box appears above each column); you can now write the name of your portal application above the Name column and press ENTER.

Continue to step 4.

In the Web Module Details pane, select the desired service to view its properties in the Portal Service Details pane below.

In the Portal Service Details pane, change property values as required by typing directly in the property field.

Note

Not all the properties of any given service are editable; such property fields are inactive.

End of the note.
You can also click Restore Default to return to initial values.

After making all the desired changes, click Save in the Web Module Details pane.




Note

Saveing takes place on the Web Module level. You can, therefore, modify the properties of any number of services and save when you are finished.

Even if your only modification is to restore default value to properties, you must save the change.

End of the note.
Restart the service.

On the Module List, choose More Actions and then choose View corresponding to application.

In the displayed application list, make sure the relevant application is selected and choose Restart.



Thursday, July 12, 2012

Calling HTTPs request from HTTP





1.  Go to tools of your browser -> Internet Options


2.    Privacy -> Advanced


3.  Check Override automatic cookie handling


Saturday, June 16, 2012

System Object in the Portal for Connecting to SAP backend System

 
Portal System Landscape:

Portal system landscape is nothing but a collection of SAP or NON-SAP systems (SAP R3/CRM/BW etc), to retrieve the data from each system portal needs to create system object.
System Object: System Object is a set of connection properties to represent an external or SAP systems (SAP R3, /CRM/BW) used to retrieve data into portal iViews. We can create a System Object in any one of the three ways
 
The system object can be created from either of the following:
  • Based on System Template (Template)
  • Based on Portal Content      (PAR)
  • Coping Existing Systems     (System)
The Required Steps to Create a System Object in the portal are as :
  •           System Alias settings
  •         Connector settings
  •         ITS settings
  •         WAS settings
  •     User Management Settings

     
    Procedure to Create System Object in the Portal
  1. Login to the portal as Administrator.
  2.  Go to System Administration -> System Configuration -> System Landscape -> Browse -> Portal Content -> System landscape.          
     
  3. Right click on System landscape then select New in Context menu          
  4. Select System from template / from PAR, it will display Template Wizard
     
  5. Choose Template based on your Backend System either SAP or NON-SAP and click on the NEXT.
     
  6. Provide the General properties for this System Object (System name, ID, prefix, master language and description) and click on NEXT.
 
It will display the tab with System name and 3 radio button options.Select the default one is opens the object for editing and then selects the ok button. 
 
Now the name of the System name will appear under the System landscape folder in ->_Portal Content and with default display dropdown as Object and Property Category dropdown list as Showl All.
System Alias settings:
 
 In the display dropdown list select System Aliases, it display System Alias Editor, give Alias name generally CLNT ex: BI7CLNT100 and select the Add button and Save this properties by save button.
 


Connector settings:
 Select Object in the display dropdown list and then select Connector in the Property Category dropdown list and provide minimum connector properties for example  


ITS settings
 
 
ITS settings are maintained for displaying SAP transactions in the portal as an iViews.    Select Object in the display dropdown list and then select Internet Transaction Server (ITS) in the Property Category dropdown list and provide ITS properties as follows 

WAS settings
 
Web AS settings are required to display BW reports and for BSP applications in the Backend Systems such as CRM and BW/BI system.
 
Select Object in the display dropdown list and then select Web Application Server (WAS) in the Property Category dropdown list and provide  WAS properties as follows

User Management Settings
 
The following settings are required for user Management in the system object to connect to SAP backend systems.
 
Logon Method is either one of the following mechanisms
UIDPW                          -> when the PORTAL uses a user ID/PASSWORD as credentials.
SAPLOGONTICKET   -> PORTAL authenticating against the SAP backend system.
The X.509 certificate    -> PORTAL authenticating against the client certificates.   
                   
Note: Single Sign on (SSO) is required for SAP logon tickets and client certificates for SAP backend systems. 

User Mapping Type

The possible values for this property are Admin, User, and Admin/user.
 
User Mapping Type defines who can maintain the user mapping for the system.
 
If user mapping type is admin, only the administrator can maintain the user mapping.
 
If Type is User, only the end user can maintain the user mapping.
 
 
If Type is Admin/user is selected, both the administrator and the end user can maintain the user mapping.
  
Select Object in the display dropdown list and then select User Management in the Property Category dropdown list and fill User Management properties as follows    

Test the System Object

 
To logon to the portal as the common user in both portal and sap r3 system, and check the test connection whether the system object which you have created is successful or not.
 
Select the Connection Test in the display Dropdown list to test the connection with the

SAP R/3 backend system.


It displays system connection Tests screen in this select all check boxes and select the Test button.
 
If the test connection is successful it display the status column as green checks as shown above, otherwise it will display as red checks in this case please verify the connection properties like system alias, ITS, WAS and User Management properties.
 
P.S. : Taken from SCN SAP

Inherit KM Workflow steps from parent folder


Following is the code through which KM Workflow can inherit steps from Parent Folder
public boolean enableWorkflow(ICollection parentFolder,IResource childResource ) throws StatemanagementException, WcmException{
private static String NAMESPACE = "namespace.com";
private static String APP_PROPERTY_NAME = "Enable_Workflow";
boolean isWorkflowEnabled;
IPropertyName pname = PropertyName.getPN(NAMESPACE, APP_PROPERTY_NAME);
IProperty property = parentFolder.getProperty(pname);
if(null!=property){
isWorkflowEnabled=property.getBooleanValue();
}
IStatemanagementManager parentStateMgr =null;
IStatemanagementResource parentStateRes =null;
IStatemanagementUtilsResource parentStateResUtils = null;
IStepList parentStepList = null;
IStatemanagementResource childStateRes = null;
IStatemanagementUtilsResource childStateResUtils = null;
IApplicationPropertiesService appPropService = null;

IRepositoryServiceFactory repServiceFactory = ResourceFactory.getInstance().getServiceFactory();
IStatemanagementManager stateMgr = (IStatemanagementManager) repServiceFactory.getRepositoryService(childResource,IWcmConst.STATEMANAGEMENT_SERVICE);

if (isWorkflowEnabled) {
if (childResource.isCollection()) {
//set custom metadata property for child
childResource.setProperty(property);
//instantiate the statemanagement manager for parent
parentStateMgr = (IStatemanagementManager) repServiceFactory.getRepositoryService(parentFolder,IWcmConst.STATEMANAGEMENT_SERVICE);
//get the statemanagement resource for parent
parentStateRes = parentStateMgr.getStatemangementResource(parentFolder);
//get the statemanagement utils for parent
parentStateResUtils = parentStateRes.getUtils();
if(null != parentStateResUtils && parentStateResUtils.isStatemanagementEnabled()){
//read approver list
parentStepList = parentStateResUtils.readApproverList();
//get the statemanagement resource for child
childStateRes = stateMgr.getStatemangementResource(childResource);
//get the statemanagement utils instance for child resource
childStateResUtils = childStateRes.getUtils();
//enable workflow for child
childStateResUtils.setStatemanagementEnabled(true);
//add and save approver list for child
childStateResUtils.saveApproverList(parentStepList);
}else{return false;}
} else {
// setps to submit a not collection child resource for approval automatically
IStatemanagementResource sResource = stateMgr.getStatemangementResource(childResource);
IResourceTransitionList transitionList = sResource.getAllowedTransitions();
if (sResource.getUtils().readState().toString().equalsIgnoreCase("in progress")) {
IResourceTransition transition = sResource.getTransition("lbl.submit");
if(null != transition){
transition.execute();
}else{return false;}
}else{return false;}
}
}else{
return false;
}
return true;
}

Friday, June 15, 2012

Creating a resource in KM in SAP EP

Following is the Code to create any resource in Knowledge Management (KM)
propertyName = new PropertyName("http://sapportals.com/xmlns/cm","displayname");   
                   
//Creating the property map for the properties which needs to be   
//set for the KM resource being created.   
mutablePropertyMap = new MutablePropertyMap();   
  
//Creating the property and setting its display name   
mutableProperty = new MutableProperty(propertyName,"File");   
                   
//Populating the property map with the property created above.   
mutablePropertyMap.put(mutableProperty);   
                   
//Creating a resource(a file).   
resource = parent.createResource("SomeName.txt",mutablePropertyMap,null); 

Upload File into KM Repository

The report was generated in Excel file and stored in a shared drive location from where it was uploaded into the KM repository using KM API in Portal application.


//Create Excel Report in the Shared Drive
// trgtlocation is the location of the Excel report in the Shared drive
String trgtLocation ="C:\\Report\\Excel.xls";
File f = new File(trgtLocation);
//*******************************************//
// code to generate excel workbook and sheets excluded
//*******************************************//
try{
f.createNewFile();
workbook = Workbook.createWorkbook(f);
sheet = workbook.createSheet("First Sheet", 0);
}catch(Exception e){
}
File myExcel = new File("C:\\ Report\\Excel.xls");
InputStream myIS=new FileInputStream(myExcel);
IContent aContent = new Content(myIS,"byte",-1);
if(aCollection != null){
IResource aResource=( IResource)aCollection.createResource(Excel.xls,null,aContent);
myIS.close();
}//End of outer if
}catch(AccessDeniedException ex){
}
catch(NotSupportedException ex){
}
catch(ResourceException ex){
}

Extract PCD Objects from Portal

If their is any requirement where portal Administrator wants to see all the contents of Portal Content Directory and along with it wants to see Code Link (type of iView/System). They need to implement following code.


  1. Create a Par File.

    • Go to File -> New -> Other
    • Select Portal Application -> Create a Portal Application Project. -> Next
    • Give Project Name and pecify root folder path -> Finish
       
    • Again Right click on you project -> New -> Other
       
    • Select Portal Application -> Create a New Portal Application Object -> Next -> Next
       
    • Select AbstractPortalComponent  -> Next
       
    • Give Name, Location where you want to create this java file and package name. -> Finish
  2. Code:
    • Decalre following objects inside class .

    IiView iView = null;
    InitialContext ctx = null;
    DirContext dirCtx;
    IPcdContext context;
    List iViewList = null;
    String location = null;

    In DoContent Method write following code .

    InitialContext ctx = null;
    DirContext dirCtx;
    IPcdContext context;
    List iViewList = null;

    try
    {
     Hashtable env = new Hashtable();
     env.put(IPcdContext.SECURITY_PRINCIPAL, request.getUser());
     env.put(Context.INITIAL_CONTEXT_FACTORY, IPcdContext.PCD_INITIAL_CONTEXT_FACTORY);
     env.put(com.sap.portal.directory.Constants.REQUESTED_ASPECT, PcmConstants.ASPECT_SEMANTICS);
     ctx = new InitialContext(env);

     dirCtx = (DirContext) ctx.lookup("pcd:portal_content/");
     PcdSearchControls pcdSearchControls = new PcdSearchControls();
     pcdSearchControls.setReturningObjFlag(false);
     pcdSearchControls.setSearchScope(pcdSearchControls.SUBTREE_WITH_UNIT_ROOTS_SCOPE);

     dirCtx.addToEnvironment(com.sap.portal.directory.Constants.APPLY_ASPECT_TO_CONTEXTS, com.sap.portal.directory.Constants.APPLY_ASPECT_TO_CONTEXTS);
    /*
                       
     NamingEnumeration ne_role = dirCtx.search("", "(com.sap.portal.pcd.gl.ObjectClass=com.sapportals.portal.role)",  pcdSearchControls); // for Role

     NamingEnumeration ne_page = dirCtx.search("", "(com.sap.portal.pcd.gl.ObjectClass=com.sapportals.portal.page)", pcdSearchControls); // for Page

         NamingEnumeration ne_system = dirCtx.search("", "(com.sap.portal.pcd.gl.ObjectClass=com.sapportals.portal.system)", pcdSearchControls); // forSystem
     
    */
     NamingEnumeration ne_iView = dirCtx.search("", "(com.sap.portal.pcd.gl.ObjectClass=com.sapportals.portal.iview)", pcdSearchControls);
     response.write("<table border='1'>\n");
     response.write("<tr><th>Location</th>\n");
     response.write("<th>Code Link</th></tr>\n");
     response.write("</br>");
     while (ne_role.hasMoreElements())
     {
     IPcdSearchResult searchResult = (IPcdSearchResult) ne_iView.nextElement();
     String location = "pcd:portal_content/" + searchResult.getName();
     ctx = new InitialContext(env);
     IiView result =  (IiView)ctx.lookup(location);
     String codelink =  result.getAttribute("CodeLink");
     response.write("<tr><td>"+location+ "</td>\n");
     response.write("<td>"+codelink+"</td>\n");
     }
    }

    catch(Exception e)
    {
    response.write("Exception Caught:"+e);
    }

  3. In portalapp.xml file under Application tab add following sharing references.

    com.sap.portal.pcm.admin.apiservice
    com.sap.portal.ivs.api_iview
    com.sap.portal.pcm.admin.apiservice

     
  4. Save and deploy on your portal. Run the application you will get the desired list in output.




Tuesday, May 29, 2012

Enterprise Portal Administration


What is single sign on (SSO)

Once a user has authenticated to the SAP EP, he doesn't need to enter his credentials again to access all the systems and backends (SAP and Non-SAP, ESS, MSS and services) integrated into the EP. SSO can be achieved in 3 ways:
- JSESSIONID: The JSESSIONID cookie is used for achieving SSO on the Server Node
- User Mapping: The user or administrator assign for a specific backend system the userid and password. These settings will be used to achieve SSO to the specified backend. If the user is using a different userid for a backend, this is the prefered solution to achieve SSO.
- SAP Logon Ticket. This is a session cookie named MYSAPSSO2 stored in the browser cache and is used to achive SSO to the backends, using the same userid for every backend system.
When talking about SSO, normally the SAP Logon Ticket is meant.

What is the SAP Logon Ticket?


SAP Logon Ticket (token) is a session cookie, stored inside the browsers cache. It get's permanently deleted from the cache after the user logs out or the token is expired. The Logon Ticket contains:

  • Highest Authentication Scheme 
  • Validity 
  • Issuing System 
  • Digital Signature 
  • One Mapped ABAP User ID 
  • User ID 
It doesn't contain the password.


What are the types of SSO?


  • SSO with SAP Logon Ticket 
  • SSO with User ID and password (User Mapping) 
  • SSO using a 3rd party system (Microsoft Active Directory, Kerberos, etc, but the Issuing System for the SAP Logon Ticket is an SAP NetWeaver AS!) 

What are the steps for SSO?

  • Create RFC destination in SM59 
  • Create JCO-RFC destination in Visual admin 
  • Maintain the profile parameters for single sign on in RZ10 
  • login/create_sso2_ticket=2 
  • login/accept_sso2_ticket=1 

4.Export portal certificate (verify.der)
5.Import Portal certificate in STRUSTSSO2
6.Export R/3 certificate in STRUSTSSO2
7.Import R/3 certificate in keystore administration
8.Create system alias in portal
9.Check the SAPJSF user in ABAP system
10.Map the ABAP user to Portal user if it is required.
Please check the below links for Portal administration:

Saturday, May 26, 2012

Remove Preceding 0 for any String.

Wile developing an application in SAP NWDS.  I got this requirement once, like:

Problem :

There is a String having UserId concatenated with User name followed by '-'. (00001234 - Test Sap, 00000102 - Test1 sap, 00000002 - Test2 sap) . 
The requirement was to get just no. 1234, 102, 2 respectively.

Solution:

  1. Split the string followed by space into parts using:
    String pernr = "00001234 - Test Sap";
    String[] tokens = "this is a test".split("\\s");
  2. Take the substring  tokens[0] and parse it to Integer.
    int result = Integer.parseInt(tokens[0]);
  3. You will get the required value in result.
    result will have value = 1234 .

Methods of IUserFactory API and Iuser API



There are various tasks which can be perfomed by using the IUSERFACTORY API of the UME(user management engine).


Instantiate user objects
Create New Users
Delete existing users
search users
and perform mass commit/rollback operations on a set of users
Access to the users factory is possible by using the following lines of code


import com.sap.security.api.*
IUserfactory userfact = Umfactory.getUserfactory();


You can obtain a user object by using the userfactory provided you know the logon ID or the Unique ID of the user.
getUserFactory.getUser(String UniqueID);
getUserFactory.getUserbyLogonID(String LogonID);


If you want to get user and prepopulate specific attributes, use the following method
getUserFactory.getUser(String UniqueID, AttributeList AttrList);




Most of the information needed for processing in a web dynpro java application is present in the IUser Object. Information about the name of the user, their unique ID, LDAP attributes, display name, role membership, etc are available from the IUser object.It is also possible to edit the corresponding profile data with the interface IUserMaint.


Obtaining information about the current User


The user associated with current portal request can be obtained by using getUser() methos in the IPortalComponentRequest Object.


IPortalComponentRequest request  = .... ;
IUser user  = request.getUser();
String Username  = user.getDisplayName();
String depname  = user.getDepartment();


Obtaining Information about another User


You can access any user by using the getuserbyLogonID() provided you have the logon ID of the desired user
An Exception would occur if the user does not exist


String uid = "demouser";
try
{
Iuser user  = UmFactory.getuserFactory().getUserbyLogonID(uid);
String username  = user.getDisplayName();
}
cartch(UME Exception e)
{
wdComponentAPI.getMessagemanager.reportexception(e.getlocalizedmessage, false);
}


The above lines of code also are applicable if you know the unique ID of the user whose information is required. Instead of method getUserbyLogonID(), use getUserbyUniqueID().


Searching for Users
steps are :
create a search filter from the userfactory.
set the search attributes for the search.
invoke the search
iterate thourgh the results


The result of the search is of type ISearchResult and returns an iterator containing the UniqueIDs of the principals returned.
The SearchReult also contain the state of the search.
Search_Result_Incomplete
Search_Result_OK
Search_Result_UNDEFINED
Search_Result_EXCEEDED
TIME_LIMIT_EXCEEDED


IUserFActory userfact = UMFactory.getUserFactory();
IUserSearchFilter userfilt  = userfact.getUserSearchFilter();
userfilt.setLastName("bohra*");
ISearchResult result  = userfact.SearchUsers(userfilt);
if (result.getState() == ISearchResult.SEARCH_RESULT_OK)
{
while(result.hasNext())
{
String uniqID = (string) result.next();
IUser thisuser  = userfact.getuser(uniqID);
}
}
else
{
// print error or warning.
}


}

Web Dynpro Generated Folders in the DTR perstective



I can see that in the DTR perspective, I have these many folders like gen_wdp, gen_mci etc. These folders as I know are generated by the web dynpro framework. There are other DCs in the DTR which do not have these folders. They have only src folder and .dcdef file. 
These folders are not required on the DTR. These should be manually removed from the DTR as they were manually checked in to DTR at the time of Checkin. Removing web dynpro generated folders from the DTR is easy. Just go to the DTR perspective of your NWDS. Drill down to the _comp folder of your project. Right click on each of the web dynpro generated folder and choose delete->delete subtree. This will ask you to create and activity. Just create an activity. The deletion action will be catured in this Activity. Then checkin this activity, delete the project from you workspace and create it again from the inactive DCs in you DC perspective . Then go to DTR perspective again and drill down to the _comp folder of your project. You will see that web dynpro generated folders are gone.

For a project, on the DTR, only 1 folder called src and only 1 file called .dcdef is required. Everything else is generated by the web dynpro framework when you build a DC. These folders are not needed on the DTR . If they are there on the DTR perspective, your DC will appear broken to whoever creates it on his/her machine.

What is SAP ?


This article is about SAP.SAP stands for systems, applications and products in data processing.SAP should be pronounced as S A P and not saap. SAP was founded by a german company in 1972, hence it’s a german company. SAP is an ERP software. 


ERP stands for enterprise resource planning. ERP solutions is an end to end solution for a company. Enterprise consists of multiple departments, for example finance, sales, human resources, manufacturing , sales and distribution, etc. each of these departments needs a software to manage its information. So one solution is that the company can have a unique software developed from scratch for each of these departments or this company can go for an ERP solution. If this company goes for an ERP solution then this department would be using one or more modules of the same ERP software. ERP is a modulated and integrated product so ERP has multiple modules designed for different departments. These modules are integrated in terms of data sharing. This shares the data. So they share the same back-end ,the same data source and the same database. 


Transactions are automatically created in these modules, based on connectivity going on in one module the other module can automatically capture that and can create transactions. Now the ERP market looks like this with the SAP market with the maximum share with 35% with its product my SAP. ORACLE has 28% market with three of its products ORACLE e-business suites, peoplesoft and JDEdward as well. Now we have two ERP applications taking third position with 28% market share. This category includes ERP software which include Baan, epicor, infor and syspro. Microsoft accounts to 14% with its product called greatplains. This is the evolution for SAP. 


SAP had started with SAP R/2 which became SAP R/3 and which has now become my SAP ECC. SAP R/2 was mainly designed for mainframe computers ,large and huge computers then it changed to SAP R/3 which went for catering to the client server environment when machined went from large size to smaller ones and multiple machines were being used together. Now the latest offering is my SAP ECC. ECC stands for ERP central component. My SAP ECC has multiple modules. 


FI and CO are modules within my SAP. So financial and controlling modules are a part of my SAP ECC suite. My SAP has multiple suites , each suite is a group of modules, so you can see this is a family of modules and together all these families are called as my SAP. So my SAP has ERP central component, supplier relationship management(SRM), strategic enterprise management(SEM), catalogue content management, compliance management for SAO, supply hain management(SCM), product lifecycle management( PLM), customer relationship management (CRM), and business intelligence( BI). All these families are a part of my SAP. 


Hence this suite has many families or modules, so FI and CO are a part of ERP central component suite. SAP R/2 changed to SAP R/3 which changed to my SAP ECC. The company added other families as well. So initial offerings did not include these families. So these become a part of this one big giant product called my SAP.




Some SAP Terms


Most Common SAP terms are ABAP and ABAP 4, basis, variant, transaction code, parameter id , batch sessions, jobs, user menus and distributed systems (ALE)


ABAP and ABAP 4


ABAP stands for advanced business application programming 4th generation language. So ABAP is a 4 GL language stands for fourth generation language. The characteristic of 4 GL language is that the added abstraction layer to make them easy to understand. The other examples of 4 GL languages are SQL and PL/SQL. They are closer towards the human language, so if you look at the programming statement you can easily understand what the statement is trying to do. Now ABAP is also called the cousin of COBOL, though COBOL is a 3GL language. Now ABAP is the main programming language for SAP. If you really need to change the SAP software other than the customization and configuration options available on the screen, if you really need to modify under the hood you really need to understand the ABAP language. This Is the language within which SAP product is built.


Basis


Basis is a middleware that connects the SAP applications with the operating systems and the database. So the first layer is the operating system which is the hardware of course. Of the operating system we have the basis software running a swell as we have the database running. So we have choices of database but mostly ORACLE database is used with the SAP applications. So we have basis and database running on top of the system and SAP front run applications are runiing on top of the basis, so basis is the connection between the SAP applications and the operating system and as well as if the application need to talk to the database they have to go through the basis. So its called the middleware software. Now basis group is another term that is commonly used . before we talk about basis group lets see what basis administrator is. Basis administrator is the person who looks after the basis software. This person manages the basis software and security and if running properly and looks after any functional and technical problem related to the basis software while the DBA known as the database administrator looks after the health of the database. So basis administrator looks after the health of the basis software, which is the middleware and DBA looks after the health of the database. So the basis administrator and the DBA together are called a basis group which is more of a technical group looking after the health of the underlying software. So the basis group is a commonly used term as well, so that will mean DBAs and business administrators together.


Variant


When you run a program or report, you need to enter some parameter, for example you can enter January 2010 as a parameter for one of the report and display the data as January 2010. If you enter the data as February as the parameter then February as the parameter shows up. So each report has different parameters, a set of parameters that has to decode and based on those parameters you need to enter those values that are produced. Now same thing for the programs as well. You can save the settings and the saved settings is called as the variant. If you run the same report or program again and again, then you can have the settings saved as variant. Variants basically saves you time. Basically you can run routine programs without having to enter all parameters again and again. 


Transaction Codes


There are two ways to navigate to a screen in SAP. First method is to use the menu. Another method is you can enter the transaction code for that screen directly in the command field and you can go to the screen directly. Each screen has its own transaction code and there is a command field available to you all the time and you can enter in the field and you will be directed into the screen. So it’s a shortcut to go into a particular screen and it comes handy if you use one or few screens on a frequent basis, so then you would basically remember the transaction cades for that screen, then you can enter that in the command field 


Parameter ID


Parameter ID is an identifier given to some fields for example the parameter ID for the a company is BUK is considered as a parameter ID for a nickname of a field. Now what is the use. The use is that, for example if the user comes to the screen and this user work for a certain company 222 for example, then what this user can do is that he can go to the user profile screen and specify 222 as default value for parameter BUK. So you can use a parameter ID to set a default value to a particular field. Now as a result when the user is going to come to the screen, value 22 will always be defaulted. So he doesn’t have to enter 222 again and again. So, what you take home is parameter ID is a nickname to a field ,so most of the fields have parameter IDs. You can use the parameter ID to set a default value to a field so that when you come to the screen the default value is already there.


Input session


So what we see here is that a user is on the screen and is entering data into the SAP data entering screens and that this data is going into the SAP database. Other than the manual data entry, the SAP also receives data from the other non-SAP applications and other SAP installations. So how that process happens? First the data is stored as the batch input session . the batch input program could be used to read the data from the external world and save the data into batch input session. Then another program called process batch input runs which reads the data is stored under batch input session and feeds that into the SAP database. Now, something unique about this batch input session is that the data is stored in such a way that when it is read it is read as if a human being is sitting there and doing the data entry. So this data goes through the same validation process as if somebody is entering data manually in the SAP database. That’s something unique about batch input session. Its goes through the same validation process. It’s a little different concept from the interface tables. And sometimes this data is instructive as well. So if users enter this and asks the user this question then the user chooses this answer, so that is how the batch input session works. So this is how the data can be brought form an external input system to the SAP database. 


Jobs


When you run a program or report, you have two choices. Either you can run it immediately or schedule to run later. A program or report is which is scheduled to run later on is called a job. So can specify when you really want this job to run. If it’s a huge job then you can choose to run it over a night. So job is a technical term used for a program or report which is casual to run later on.


User Menus


When you log in you can see two menus in the system, standard menu and user menu. The standard menu comes with the system and it contains all the options. There is a huge list on the standard menu, but in reality the users use few options for day to-day use. So what you can do is, you can extract those options and put them in the user menu. So the standard menu will contain all the options that are in a system and user menu will contains all those options that a user frequently uses on daily basis. So when a user logs in he can go directly into the user menu and see only those options that he is interested in. so that is the concept of a user menu. 


Distributed systems (ALE)


What does ALE stand for? Application linked enabling. So what is the benefit of ALE? So lets imagine three SAP systems running individually. So they are separate SAPs , production 1, 2 and 3. Now sometimes a client may decide to go for different installations or for whatever technical reasons that happened. Now the need is whenever transaction takes place in system 2 and 3 , it should always automatically show up on system 1. And so system 1 should be in sync with system 2 and 3 in terms of the transactions. So you can use the distributed ALE technologies to achieve that. For example, if a transaction is happening in system 2 , it should automatically be flowing to system 1 , as if someone entered this transaction into system 1. So ALE could be used to keep one system in sync with the other. That’s the whole concept of ALE.