cancel
Showing results for 
Search instead for 
Did you mean: 

How to call a Bapi or RFC from a custom logon module

Former Member
0 Kudos

Can you provide an example of how to call a bapi or rfc from a custom logon module? (used to authenticate in portal)

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

you can use JCO to call ABAP function module from your logon page.

to do that you need to modify your logon page.

process of modifying the logon page is wel described in the following link:

[https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/371e9d90-0201-0010-c39c-fd2956154ab3]

the following link will give you the required code example for calling bapi using JCO.

[http://www.sapdevelopment.co.uk/java/jco/jco_callfunc.htm]

Regards,

Sahidur

please give points if it helps you.

sridhar_k2
Active Contributor
0 Kudos

From your EJB / JAVA Module you can call directly SAP BAPI (Which is not recommanded - ) or you can call a RFC Destination from JAVA Module. RFC Destination needs to be created in Visual Admin.

Here you see the code, how to connect to RFC.

http://help.sap.com/saphelp_nw2004s/helpdata/en/17/d609b48ea5f748b47c0f32be265935/content.htm

JCO RFC Destinations

http://help.sap.com/saphelp_nwce10/helpdata/en/44/3bd73865524903e10000000a1553f7/content.htm

Thanks,

Sridhar

Former Member
0 Kudos

Hi,

How do i get an instance of ctx?

dstService = (DestinationService) *ctx*.lookup(DestinationService.JNDI_KEY_LOCAL);

would i just do the following?

Context ctx = new InitialContext();

Former Member
0 Kudos

Hello all,

Is it possible to use SAP JRA instead?

We have a Connector deployed on the WebAS 6.40. From an EJB (Webservice) it is possible to lookup the connector, but if i try to lookup the connector from a custom LoginModule, i get the following error:

Path to object does not exist at java:comp, the whole lookup name is java:comp/env/eis/SAPJRA_CRMDC.#

The whole lookup in LoginModule looks

try 
		{
			initialcontext    = new InitialContext();
			connectionFactory = (ConnectionFactory) initialcontext.lookup("java:comp/env/eis/SAPJRA_CRM");
																		   

		} catch (Exception ex) 
		{
			location.errorT(ex.getMessage());
		}

Regards Oliver

Answers (1)

Answers (1)

Former Member
0 Kudos

oliver,

Are you saying something like this won't work?

private void getJCOfromDestinationService()
	{
		try
		{
			ctx = new InitialContext();
			dstService = (DestinationService) ctx.lookup(DestinationService.JNDI_KEY_LOCAL);
			if (dstService == null)
				throw new NamingException("Destination Service not available");
			dst = (RFCDestination) dstService.getDestination("RFC", "ECCAUTH");
		}
		catch (DestinationException e)
		{			
			e.printStackTrace();
		}
		catch (RemoteException e)
		{			
			e.printStackTrace();
		}
		catch (NamingException e)
		{			
			e.printStackTrace();
		}

		jcoProperties = dst.getJCoProperties();

	}