$(function () { pageContext.i18n.modTalk = 'moderation talk'; pageContext.i18n.replyToComment = 'Reply'; pageContext.i18n.modTalkEmpty = 'moderation talk is empty'; pageContext.url.getModTalk = "/comments/%25ID%25/listModTalk.json"; pageContext.url.possibleCommentRecipients = "/comments/%ID%/possibleRecipients.json"; pageContext.url.commentEdit = '/comments/%25ID%25/edit.html'; pageContext.url.commentView = '/comments/%ID%/view.html'; pageContext.i18n.commentVisibility = { 'full': 'Viewable by all users', 'op': 'Viewable by the original poster', 'mod': 'Viewable by moderators', 'opAndMod': 'Viewable by moderators and the original poster', 'other': 'Advanced visibility', 'dialogTitle': 'Comment visibility', 'selectGroups': 'Visible to groups', 'selectOther': 'Other recipients', 'selectOriginalPoster': 'Original poster', 'selectModerators': 'Moderators', 'selectAssignees': 'Asked to answer users' }; pageContext.i18n.commentMenuLabels = { 'comment-edit': 'comments.menu.edit', 'comment-delete': 'comments.menu.delete', 'comment-convert': 'comments.menu.convert' };pageContext.i18n.answer= { bestAnswer: 'Best Answer', controlBar : { accept: 'Accept', unaccept: 'Unaccept', acceptCommand: 'Accept this answer as correct', cancelAcceptedCommand: 'Remove this answers accepted status' } }; window.croles = { u: false, op: false, m: false, og: false, as: false, ag: false, dc: false, doc: false, eo: false, ea: false }; tools.init({ q: { e: false, ew: false, eo: false, r: false, ro: false, d: false, dow: false, fv: false, c: false, co: false, p: false, tm: false , ms: false, mos: false }, n: { f: false, vf: false, vfo: false, vr: false, vro: false, c: false, co: false, vu: false, vd: false, w: false, wo: false, l: false }, c: { e: false, eo: false, d: false, dow: false, ta: false, tao: false, l: false }, a: { e: false, ew: false, eo: false, d: false, dow: false, a: false, aoq: false, ao: false, tc: false, tco: false, p: false, tm: false }, pc: croles }, { tc: true, nsc: true }); commandUtils.initializeLabels(); }); Skip to Content
avatar image
Former Member

How can i Capture the status bar from SAP using Excel VBScript

in this case i have a License missing code

the message type should be "E"

and it still gose to NO ERROR on the if condition

if session.findById("wnd[0]/sbar").text= "E" then
MSGBOX "ERROR"
else
MSGBOX "NO ERROR"
end if

i want to be able to identify when there's an error on the Status BAR so i can stop the macro and fix that error manually, but i'm not able to get the message type or text.

The message type indicates the seriousness of a message and is visualized by an icon.

Stop: A Cancel

Red: E Error

Yellow: W Warning

Green: I/S Information/success message

no matter what message type i put in the IF condition it will always go to the "NO ERROR " MSGBOX

messagetype.jpg (43.0 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Best Answer
    Dec 01, 2016 at 07:17 AM

    Hello Andrew,

    you can read the MessageType:

        If Not IsObject(application) Then
          Set SapGuiAuto = GetObject("SAPGUI")
          Set application = SapGuiAuto.GetScriptingEngine
        End If
    
        If Not IsObject(connection) Then
          Set connection = application.Children(0)
        End If
    
        If Not IsObject(session) Then
          Set session = connection.Children(0)
        End If
    
        If session.findById("wnd[0]/sbar").MessageType = "E" Then
          'Your code here
        End If 

    S = Success, W = Warning, E = Error, A = Abort and I = Information

    Let us know your result.

    Cheers
    Stefan

    Add comment
    10|10000 characters needed characters exceeded

  • Dec 13, 2016 at 04:24 AM

    Hello Andrew,

    thanks for your reply. As far as I can see you don't want to read status bar, it seems that it is a table. Which transaction code do you use? Please describe your proceeding until you get the table with the error entries. So I can retrace your way.

    Cheers
    Stefan

    Add comment
    10|10000 characters needed characters exceeded

  • Dec 14, 2016 at 08:21 AM

    Hello Andrew,

    sorry, but in our systems is the software component Global Trade Services not available, so I can't trace it direct.

    I use as example the SE80 with an error.

    It has a splitter, like in your case, and a table beneath. The table is in this case a GridView. Is it possible for you to use Scripting Tracker to analyze your UI?

    Cheers
    Stefan

    Add comment
    10|10000 characters needed characters exceeded

  • Dec 15, 2016 at 07:22 AM

    Hello Andrew,

    thanks for your reply. Good to hear the news, now you can get your messages.

    Cheers
    Stefan

    Add comment
    10|10000 characters needed characters exceeded