Skip to Content

Suppress warning messages in Analysis for Office

Hello All,

I have a Analysis for Office template. Which have many dimension selection. I am getting few warning messages when I am executing any operation like save, prompt. I do not want to correct the warning by side of BEx because of my query structure.

I just checked few codes of VB on sap community help portal, but I am unable to implement.

Here I am attaching the screenshot of warnings to suppress. Please help me.

First full message : Combination check: Characteristic value GLAP/M1 for 0WORKCENTER char. does not exist (RSPLS_CR-009, BDV)

Second Full Message : Chirala Line 2 Months ' is not input-ready: Data slices, characteristics relationships (RSPLS_CR-046, BDV)

Thanks in advance.

warning.jpg (64.5 kB)
Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • Best Answer
    Posted on Jul 16, 2018 at 04:12 PM

    Hi Parichay,

    Did you tried the sample described on our user guide?
    Please check the following link: https://help.sap.com/viewer/ca9c58444d64420d99d6c136a3207632/2.7.0.0/en-US/84f15aa36f1e4e8ca8108122aa7da7b2.html

    Thanks,
    Diego Ferrary

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Aug 02, 2018 at 07:28 AM

    Hi

    I found that implementing this in VBA was not that difficult.

    The very first thing is to identify all you messages you want to process. So in your workbook you use the function SAPListOfMessages to list all you messages including all the information you can use to identify them.

    =SAPListOfMessages(;TRUE)

    First you register your callback, in my case a made a sub procedure for this purpose, so that the maintenance was not in the ThisWorkbook Class.

    Public Sub Workbook_SAP_Initialize()
        ' register callbacks
        Call Register_Callbacks
    End Sub

    The procedure is was simple

    Sub Register_Callbacks()
        Call Application.Run("SAPExecuteCommand", "RegisterCallback", "BeforeMessageDisplay", "Callback_BeforeMessageDisplay")
    End Sub
    

    Now I call a procedure that can call all the stuff I wan't to run, but you can implement you logic here if you wan't.

    Sub Callback_BeforeMessageDisplay()
        Call BeforeMessageDisplay
    End Sub
    

    Then I implemented a supportive function, to simplify the suppression of messages. The messageState is only for debugging, so you can leave that out, but I found it really nice to have it print to the immediate window to follow what is done.

    'Simplify suppression of messages
    Function SuppressMessage(messages As Variant, i, Optional ByRef messageState As String)
        SuppressMessage = Application.Run("SAPSuppressMessage", messages(i, 1))
        messageState = "Suppress Message: "
    End Function
    

    Now the trick is, that the next procedure have to be a function. I found, that if it is not a function type, then it does not execute.

    But this is where I implemented the suppression logics

    Short example version

    Function BeforeMessageDisplay()
        Dim messageList As Variant
        Dim messages As Variant
        Dim lRet As Variant
        Dim messageCount As Variant, messageState As String
        Dim i As Integer
        
        Debug.Print "Start Message Processing: ", Date, Time()
        
        messageList = Application.Run("SAPListOfMessages", , "True")
        messages = GetAsTwoDimArray(messageList) ' see "Using Analysis functions"
        messageCount = UBound(messages, 1)
        
    'This is where then processing of messages go.
        For i = 1 To messageCount
            'do logic to determine action
            If messages(i, 3) = "RSPLF" Then
                If messages(i, 5) = "INFORMATION" Then
                    lRet = SuppressMessage(messages, i, messageState)
                End If
            End If
        Next i
    End Function

    Long example version of the same

    Function BeforeMessageDisplay()
        Dim messageList As Variant
        Dim messages As Variant
        Dim lRet As Variant
        Dim messageCount As Variant, messageState As String
        Dim i As Integer
        
        Debug.Print "Start Message Processing: ", Date, Time()
        
        messageList = Application.Run("SAPListOfMessages", , "True")
        messages = GetAsTwoDimArray(messageList) ' see "Using Analysis functions"
        messageCount = UBound(messages, 1)
        
    'This is where then processing of messages go.
        For i = 1 To messageCount
            messageState = "Message: "
            'Suppress Planning Function messages
            If messages(i, 3) = "RSPLF" Then
                If messages(i, 5) = "INFORMATION" Then
                    lRet = SuppressMessage(messages, i, messageState)
                End If
            End If
            If messages(i, 3) = "RSPLS" Then
                'If two users are planning ODI, then only one can have the lock on the assumptions. This suppress that message to reduced confusion.
                If messages(i, 6) = "ZFI_C03" Then
                    lRet = SuppressMessage(messages, i, messageState)
                    'Add custom message to the user regarding the lock
                    lRet = Application.Run("SAPAddMessage", "Assumptions are Locked by user " & messages(i, 7) & ".", "INFORMATION") 'INFORMATION, WARNING, ERROR or CRITICAL
                End If
            End If
            If messages(i, 3) = "BRAIN" Then
                'Data Slice Message
                If messages(i, 4) = "BRAIN-641" Then
                    lRet = SuppressMessage(messages, i, messageState)
                End If
                If messages(i, 4) = "BRAIN-109" Then
                    lRet = SuppressMessage(messages, i, messageState)
                End If
            End If
        
        'Handle if printing returns errors
        On Error Resume Next
            'Print all messages
            Debug.Print messageState, messages(i, 1), messages(i, 2), messages(i, 3), messages(i, 4), messages(i, 5), messages(i, 6), messages(i, 7), messages(i, 8), messages(i, 9), messages(i, 10)
        On Error GoTo 0
        Next i
    End Function
    

    Last I have this function to handle the array issue with return values

    'Utility functions
    Function GetAsTwoDimArray(value As Variant) As Variant
        'value is error return the error
        If IsError(value) Then
        GetAsTwoDimArray = value
        
        'value is array
        ElseIf IsArray(value) Then
        'first check if the array is two-dimensional
        'by requesting the upper bound of the 2nd dimension.
        'if this is not the case an error occurs (Err.Number <> 0).
        
        'ignore errors, handled locally
        On Error Resume Next
        Dim lIndex As Integer
        Dim lErrorCode As Integer
        lIndex = UBound(value, 2)
        lErrorCode = Err.Number
        'set error handling back to default
        On Error GoTo 0
        
        If lErrorCode = 0 Then
            'no error: array is two-dimensional
            GetAsTwoDimArray = value
        Else
            'copy one-dimensional array into a two-dimensional one
            Dim i As Integer
            Dim lArray() As Variant
            ReDim lArray(1 To 1, 1 To UBound(value))
            For i = 1 To UBound(lArray, 2)
                lArray(1, i) = value(i)
            Next
            GetAsTwoDimArray = lArray
        End If
        
        Else
        'return Empty
            GetAsTwoDimArray = Empty
        End If
    End Function
    

    I hope this helps.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Aug 07, 2018 at 06:57 PM

    Why don't you suppress the messages in the backend?

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.