Show TOC Start of Content Area

Procedure documentation Creating an OBN Link (Web Dynpro)  Locate the document in its SAP Library structure

This section describes how to create an OBN link in a Web Dynpro application.

Prerequisites

      You understand how portal navigation is triggered in Web Dynpro applications, as described in Navigating in the Portal.

      You add the following imports:

importcom.sap.portal.obn.service.IOBNMetadata;

import com.sap.portal.obn.service.IOBNService;

importcom.sap.portal.obn.service.OBNFactory;

Procedure

...

       1.      To your view, add a UI element that, when clicked, triggers navigation, such as a button element.

This graphic is explained in the accompanying text

       2.      Add an event action to the UI element.

For example, to the onAction event of the button, add an action called OBN.

This graphic is explained in the accompanying text

       3.      In the action handler method, do the following:

                            a.      Create an instance of the OBNFactory helper class.

public voidonActionOBN(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )

{

    //@@begin onActionOBN(ServerEvent)

    boolean isPost = false;

 

    IOBNService obnService = (IOBNService) WDPortalUtils
        .getServiceReference(IOBNService.
KEY);

    OBNFactory obnFactory = obnService.getObjectsFactory();

Note

You can also obtain an OBNFactory instance by using the static method OBNFactory.getInstance().

 

                            b.      Create an IOBNMetadata object for the business object and operation to which you want to navigate.

    IOBNMetadata obnMetaData = obnFactory
        .createOBNMetadata(
"myBO","","myOp",
        WDClientUser.getCurrentUser().getSAPUser());

There are many variations on creating an IOBNMetadata object. For example, you can instead specify only a business object, and the portal will navigate to the highest-priority operation for which the user has a valid implementation.

 

                            c.      Get the OBN URL for the navigation.

    String obnUrl = obnMD.getOBNUrl(false);

 

                            d.      Trigger navigation.

    try {

        WDPortalNavigation.navigateAbsolute(obnUrl,

            WDPortalNavigationMode.SHOW_INPLACE,

            null,

            null,

            WDPortalNavigationHistoryMode.NO_HISTORY,

            null,

            null,

            obnMetaData.getOBNUrlParametersString(),

            null,

            isPost,

            true);

        } catch(Exception e) {

            e.printStackTrace();

        }

   //@@end

}

End of Content Area