The portal broadcast messaging feature is provided with an out-of-the-box sample UI.

Most customers would want to customize the UI to fit their framework page.

You can find more on the BCM here:

New Development: Broadcast Messages in SAP NetWeaver Portal

If you wish to use the BCM out of the box sample UI you will need to add it to your classic/afp framework page,

The application can be found under Portal Content >> com.sap.portal.broadcast.message.framework >> Sample_BroadcastMessageIview

In order to allow this we have opened a client-side API that allows developers to create their own iView and interact with the BCM service.

Prerequisites:

  1. You have installed SAP NetWeaver Portal (EP) 7.31 SP11 or above.
    • You have created a delta link for the Broadcast Message Framework iView in your framework page and set it to visible. This iView is located under Portal Content >> Portal Users >> Standard Portal Users >> iViews >> Broadcast Messages
    • BroadcastMessageFramework.png
  2. You have enabled the BCM service by setting the BCM is active property to true.

                bcmService.png

The API

The client side API is under the object window.BCM.API and contains the following methods:

isPollingActive() – this method checks if the BCM polling mechanism is active. If the mechanism is not active, the broadcast messages will be taken from the server only once.

getPollingIntervalTime() – This method returns the number of minutes between each request to the server.

getActiveMessagesForCurrentUser(success callback function, fail callback function) – This method gets all of the user’s broadcast messages (according to the user’s roles and groups) and return them to the success callback function in a JSON format (if successful) or returns a JSON with the status “fail”.

Each message in the JSON has the following attributes:

    • messageId – The message ID, which is a unique ID for the message in the server.
    • messageBody – The actual message body.
    • isRead – A boolean stating if this message has already been read by this specific user.
    • isPriority (added in SP12) – A boolean that indicates whether this message has a higher priority.

setMessageAsRead(message ID, callback function for status) – Sets the message state to “already read” for this user in the UCD.

The callback function will receive a JSON with a “success” or “fail” status.

Example:

window.BCM.API.getActiveMessagesForCurrentUser(onMessagesReceived, onNotMessagesReceived);


   function onMessagesReceived(messagesJSON){
    //check that the actual size of the messagesJSON is more than 0.
    if(messagesJSON.length > 0)
    {
     var newMessagesArrived = false;
     for(var i = 0; i < messagesJSON.length; i++)
     {
      createMessage(messagesJSON[i].messageId, messagesJSON[i].messageBody, messagesJSON[i].isRead, messagesJSON[i].isPriority);
      // check that this message was not already read and update the new messages flag.
      if(!messagesJSON[i].isRead)
      {
       newMessagesArrived = true;
      }
     }
    }
   }



——————————————————————————————————


       window.BCM.API.setMessageAsRead(messageId,function(data){
        // check if the operation has failed or succeeded.
        if(data.status !== "success"){
         if(window.console){
          window.console.log("couldn't set message: "+data.messageId+" as read");
         }
        }
        else{
         // if operation succeeded mark message as read in the user interface
         changeMessageBackground(messageId);
        }
       });


If you would like to learn more regarding the BCM API please ask for information in the comments and I will try to add it to the article.

Saar

To report this post you need to login first.

35 Comments

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

    1. Saar Dagan Post author

      Hi Sandip,

      The broadcast framework will be available as of 7.31 SP11.

      The feature for indicating a higher priority message will be available as of SP12.

      The feature is not available out of the box and you will have to add some iViews that are given since we did not want to force users to have those iViews in their framework pages

      if they didn’t want it.

      But to configure this feature is really an easy task and takes no more then 2 minutes.

      BR,

      Saar

      (0) 
        1. Saar Dagan Post author

          Hi Marcelo,

          It will be available 7.40 SP6 and the groups and priority features will be available in SP7.

          BR,

          Saar

          (0) 
  1. Arnold Gallemann

    Hello,

    I’ve added the iView Broadcast Message Framework to the AFP, but instead of the icon to the right of the welcome text , the iview is added below the greeting.

    BroadcastMessage.JPG

    Can you help me?

    Best regards,

    Arnold

    (0) 
    1. Saar Dagan Post author

      Hi Arnold,

      The framework is just the iview that provides the API above.

      In order for you not to see that blue/grey line, open the framework iview and set “show tray” to false.

      Now in the content administration go to applications –> com.sap.portal.broadcast.framework –> right click on sample ui –> paste it in your desired folder and create a delta link to your framework page. (don’t forget to also remove the tray).

      Make sure you enabled the BCM in the NWA as shown above and it should work.

      HTH,

      Saar

      (0) 
          1. Arnold Gallemann

            Hello,

            I have one more little problem.

            I can’t delete a message.

            I got the following error message:

            com.sap.tc.webdynpro.services.exceptions.CreationFailedException:
            add of choice (label: Cancel) failed! (action: null)

                at

            com.sap.tc.webdynpro.clientserver.window.ConfirmationDialogDelegate.addChoice(ConfirmationDialogDelegate.java:198)

                at

            com.sap.tc.pp.ivs.bcm.wd.comp.bcmoverview.BCMOverViewView.onActionDelete(BCMOverViewView.java:386)

                at

            com.sap.tc.pp.ivs.bcm.wd.comp.bcmoverview.wdp.InternalBCMOverViewView.wdInvokeEventHandler(InternalBCMOverViewView.java:291)

                at

            com.sap.tc.webdynpro.progmodel.generation.DelegatingView.invokeEventHandler(DelegatingView.java:142)

                at

            com.sap.tc.webdynpro.progmodel.controller.Action.fire(Action.java:75)

                …

            88 more

            We use NW 7.31 SP11.

            Regards,

            Arnold

            (0) 
            1. Saar Dagan Post author

              Hi Arnold,

              This issue requires some investigation, can you open a thread for this and I will try to help you?

              Thanks,

              Saar

              (0) 
                1. Saar Dagan Post author

                  Hi Arnold,

                  I meant open a new discussion in the Enterprise portal.

                  and please attach the traces so I can investigate them.

                  Thanks,

                  saar

                  (0) 
      1. Anil Kumar

        Hi Saar,

        I have followed all the above steps but still i cannot see the Broadcast icon in the portal.can you please suggest what else need to be checked.

         

        KR,

        Anil

         

        (0) 
  2. Marian Canciu

    Hi Saar

    We are testing this feature on one 7.3 EHp1 SP12 Portal.

    Creating a broadcast message is working but the issue is that although the message status is green (message is broacasting) the message icon is not being displayed on the right side.

    The service properties are set as follows:

    Message poling interval – 3 min

    Polling state – true

    BCM is active – true

    Restarting the services didn’t help.

    Any idea what could be the cause?

    Cheers

    Marian

    (0) 
    1. Saar Dagan Post author

      Hi Marian,

      did you create a delta link of the broadcast framework and the broadcast sample UI to the framework page?

      BR,

      Saar

      (0) 
    1. Saar Dagan Post author

      Hi Trent,

      Thanks for the feedback.

      Broadcast messaging does support translations using the translation worklist.

      BR,

      Saar

      (0) 
  3. Thomas Büttner

    Hi Saar,

    in wich container of the AFP-Framework do I put the Example-IView. I put it in the Masthead-Container, but it wont disapear. When I debug the bcm_ui.js, I can see that logic.init() execute this line:

    if (properties.isAjax){

         welcomeTextElement = jQuery(“#welcomeText”);

    }

    but at this point in the HTML-Structure their does not exist a node with this ID. This came at some point later.

    So how I get the script running, when the Desktop is renderd.

    Thanks,

    Thomas

    (0) 
      1. Thomas Büttner

        It is a customizing AFP. But the only thing we customized was the logo on the top left and we add another IView into the Hidden Technical Container.

        By the Way, we use NW 7.31. Forget we need NW 7.31 for BCM 😛

        Thanks,

        Thomas

        (0) 
        1. Saar Dagan Post author

          Hi Thomas,

          Try to see if it works in the out of the box AFP as this sample UI was tailored for AFP and classic framework page and not for costumized framework pages.

          Hi Thomas,

          You are right, I have found something that was missing.

          I will create a fix for it.

          Thanks  and BR,

          Saar

          (0) 
  4. TAMAL BISWAS

    Hi Saar,

    Is there any kind of functionality where the contents/text of the Broadcast Message does not come from Portal, but comes from some other system outside of portal?

    Thanks,

    Tamal

    (0) 
  5. Ramanathan Devanathan

    Hi Saar,

    We are in EP 7.4 SP6.

    I have enabled BCM service by setting the BCM is active property to true

    But I dont find the iview under Portal Content >> Portal Users >> Standard Portal Users >> iViews >> Broadcast Messages

    So I copied the Sample_BroadcastMessageIview from Portal applications –> com.sap.portal.broadcast.framework and added to my AJAX framework.

    But now I dont find the role for broadcast manager. How to send messages.? Please Help

    (0) 
  6. Deep Nain Kundra

    Hi Saar,

    Thanks for sharing a nice blog and able to view the broadcast messaging. Is this possible to get the broadcasting icon on the left instead of right. I mean next to Favorites menu bar.

    Menubar.jpg

    Best Regards,

    Deep

    (0) 
    1. Saar Dagan Post author

      Hi Deep,

      The BCM UI is a sample UI, It is tailored for a specific place and a specific options.

      So unfortunately it can’t be customized in any way, not even in where it lies on the document.

      The goal for the sample UI was to show the capabilities of the BCM.

      Thanks and BR,

      Saar

      (0) 
      1. Shweta Ganti

        I have followed all the steps mentioned and I am able to create  messgaes as well , but even after the time is reached the status is pending only.

        Can you please suggest?

        (0) 
  7. Roger Beach

    We hide the user name on the right hand side where it says “Welcome User”, we found the name needs to show in order for the broadcast message icon to show.  Can this be separated?

    Also, any future capability to change bullhorn icon to something else?

    (0) 
    1. Saar Dagan Post author

      Hi Navya,

      Open the iView and set the property “show tray” to false.

      This will remove the iView title, make sure that the iView sits in the masthead container.

      BR,

      Saar

      (0) 

Leave a Reply