
When creating an OBN link, you can specify that the navigation target selected at runtime is from the same role that contains the source iView.
More information: Creating an OBN Link .
When creating the IOBNMetadata object for creating an OBN link, add a parameter that specifies that you want to navigate only within the current role, that is, the role that contains the iView that contains the OBN link. For example:
// Create the OBN factory
IOBNService obnService = (IOBNService) WDPortalUtils
.getServiceReference(IOBNService.KEY);
OBNFactory obnFactory = obnService.getObjectsFactory();
// Create an OBN metadata object (valid for both technologies)
IOBNMetadata obnMetaData = obnFactory
.createOBNMetadata("myBO","","myOp",getUser());
// Create an OBN parameter for source role navigation
String navModeName = com.sap.portal.obn.service.IOBNConstants.IOBNUrl
.IParameters.NAVIGATION_PARAM_NAVIGATE_MODE;
String navModeValue = com.sap.portal.obn.service.IOBNConstants.IOBNUrl
.IParameters.IParametersValues.NAVIGATE_MODE_SOURCE_ROLE;
IOBNParameterData sourceNavModeParam = myOBNFactory
.createOBNParameterData(navModeValue);
// Add parameter to OBN metadata
myMetaData.setParameter(navModeName , sourceNavModeParam);