Home > SAP software/management Tips > SAP ABAP/Java developer tips > Authenticating a Customer Within SAP
SAP Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

SAP ABAP/JAVA DEVELOPER TIPS

Authenticating a Customer Within SAP


Austin Sincock
02.05.2002
Rating: -4.44- (out of 5)


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


Author Austin Sincock is product manager for ROBUSTA(tm), Gamma Enterprise Technologies Web sales solution for SAP.

The key to building a secure Web application is the authentication mechanism used for logging in to the system. SAP provides an authorization transaction similar to the standard SAP user login, called 'Internet User'. It can be found under the user administration tools or by going to transaction SU05.

The Internet User transaction can be used to create username/password combinations for many different types of business partners. For a customer login application, we will use the KNA1 user profile. Once we have created and initialized the Internet User, we can now use the assigned password to authenticate that user through the customer password check BAPI. To test this BAPI in SAPGUI, call transaction SE37 (Function Builder), and execute BAPI_CUSTOMER_CHECKPASSWORD. Using the newly created Internet user and password, this BAPI will return an empty return object indicating that the authentication was successful. If the authentication fails, R/3 will populate the return object with an error type of 'E' and a text message indicating the reason for the error.

In order to call this BAPI from outside of SAP, I recommend using SAP's JCo Java connector. This can be found at http://services.sap.com. Log in with your OSS ID and search for JCo to download. The code snippet included below demonstrates how to use JCo to call the check password BAPI and how to retrieve the return object to determine whether the authentication was successful.

This code is incomplete and designed solely as an example of using JCo. Please review the JCo documentation for a complete overview of the API and examples for calling SAP.

---------------------------------------
    /**
     * This method calls BAPI_CUSTOMER_CHECKPASSWORD on SAP.
     * 
     * @param customerNo SAP customer number
     * @param password SAP password
     * @return an hashtable containing the following information
* RETURN.CODE
* RETURN.TYPE
* RETURN.MESSAGE
*/ public static Hashtable checkPassword(String customerNo, String password) { JCO.Function function = createFunction("BAPI_CUSTOMER_CHECKPASSWORD"); JCO.ParameterList myParams = function.getImportParameterList(); myParams.setValue(customerNo,"CUSTOMERNO"); myParams.setValue(password,"PASSWORD"); mConnection.execute(function); JCO.ParameterList resultParams = function.getExportParameterList(); Hashtable myHashtable = new Hashtable(); myHashtable.put("RETURN.TYPE",extractField("RETURN","TYPE",resultParams)); myHashtable.put("RETURN.CODE",extractField("RETURN","CODE",resultParams)); myHashtable.put("RETURN.MESSAGE",extractField("RETURN","MESSAGE",resultParams)); return myHashtable; } ---------------------------------------

Author Austin Sincock is product manager for ROBUSTA(tm), Gamma Enterprise Technologies Web sales solution for SAP. Click here to visit the company's home page.


Rate this Tip
To rate tips, you must be a member of SearchSAP.com.
Register now to start rating these tips. Log in if you are already a member.


Submit a Tip




Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   



RELATED CONTENT
SAP ABAP/Java developer tips
How to do additional dialog processing after SAP COMMIT WORK statement
How to find a piece of SAP ABAP code without debugging
How to read an SAP transaction in an ABAP code
How to provide an SAP R/3 4.5B application server with a Web service interface
How to find owners and transports of deleted ABAP programs
Fixing a common OPEN_FORM and START_FORM error in SAPscript
Select Text fields: Case-insensitive
Is this the quickest way to find a BADI?
Easily debug error messages in SAP processes
Accessing private attributes in ABAP Objects

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary

DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



NetWeaver SAP White Papers
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 2000 - 2009, TechTarget | Read our Privacy Policy
SearchSAP.com is a search service provided by TechTarget and is completely
independent of and not affiliated with SAP AG.
  TechTarget - The IT Media ROI Experts