$(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
0

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

Nov 30, 2016 at 11:05 PM

687

avatar image

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)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

4 Answers

Best Answer
Stefan Schnell
Dec 01, 2016 at 07:17 AM
1

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

Show 3 Share
10 |10000 characters needed characters left characters exceeded

Hello Stefan,

thank you for your help

i tried it already, but it doesn't seem to work,

i tryed it with all message types: S = Success, W = Warning, E = Error, A = Abort and I = Information

and it will go to "no error"

If session.findById("wnd[0]/sbar").MessageType = "E" Then    

     MsgBox " ERROR"

Else
     MsgBox " NO ERROR

"EndIf

i tryed saving the message type in a variable to print it in an excel sheet but it turns out beeing empty.

MT = session.findById("wnd[0]/sbar").MessageTypeRange

("A2").value= MT 

'i also tried
Range("A2").text= MT
0

in this case i have a License missing error.

the message type in this case is "E"

If session.findById("wnd[0]/sbar").MessageType = "E" Then    

     MsgBox " ERROR"

Else
  
   MsgBox " NO ERROR"

EndIf

when i run my code it will still go to NO ERROR

messagetype.jpg (43.0 kB)
0

this is how it looks when ther is no error.

0
Stefan Schnell
Dec 13, 2016 at 04:24 AM
1

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

Show 1 Share
10 |10000 characters needed characters left characters exceeded

transaction code: /SAPSLL/CUS_SGL02

0
Stefan Schnell
Dec 14, 2016 at 08:21 AM
1

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


example.jpg (202.2 kB)
Show 1 Share
10 |10000 characters needed characters left characters exceeded

thank you for that, i see in my case its a Grindview aswell

untitled.jpg (263.8 kB)
0
Stefan Schnell
Dec 15, 2016 at 07:22 AM
0

Hello Andrew,

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

Cheers
Stefan

Share
10 |10000 characters needed characters left characters exceeded