Skip to Content

A video presentation on consuming external services in CAF application service

I tried searching a lot on sdn for getting some step by step procedure for consuming an external service like RFC or webservice in CAF. I got some help from here and there so I thought of putting it together at one place so that it could help the beginners in CAF. Rather than putting in words I thought of putting it in the form of video as we always say “ACTION SPEAKS MORE THAN WORDS.”

Code to be added in getUserDetails method of the application service.

java.lang.String CAF_user = sessionContext.getCallerPrincipal().getName();

java.lang.String CAF_methodHeader = ESAppServiceBean.JARM_REQUEST + “:” + “getUserDetails(java.lang.String)”; Object[] CAF_parameters = new Object[] {id};, ESAppServiceBean.JARM_REQUEST, CAF_methodHeader, ESAppServiceBean.location, CAF_parameters); retValue;

try {

//@@custom code start – getUserDetails(java.lang.String)

retValue = null;

// Create data container for Input-Parameter and fill it.


params = new BAPI__USER__GET__DETAIL();



// Get reference to the object representing the external service call.


BAPI__USER__GET__DETAILLocal bapi_local = this.getBAPI__USER__GET__DETAIL();

try {

// Call the BAPI.

// Return value of this method call contains all the data that the BAPI returns.

BAPI__USER__GET__DETAIL_dot_Response result = bapi_local.BAPI__USER__GET__DETAIL(params);


// Retrieve the address structure out of the result data container.

BAPIADDR3 addr =



// Fill the application services return structure.

retValue = new UserData();




} catch (Exception e) {


throw new ServiceException(e);


//@@custom code end – getUserDetails(java.lang.String)

return retValue;} finally {, ESAppServiceBean.JARM_REQUEST, CAF_methodHeader, ESAppServiceBean.location, CAF_parameters);



Code to be added to the webdynpro’s Submit action for the view.

QESAppServiceGetUserDetails element = ESAppServiceProxy.createGetUserDetailsQuery(); inputparameter = element.getInputParameterStructure();








1 Comment
You must be Logged on to comment or reply to a post.