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);