Closed Thread
Results 1 to 2 of 2

Vba and Sap gui scripting

  1. #1
    Registered User
    Join Date
    10-10-2019
    Location
    poland
    MS-Off Ver
    2016
    Posts
    7

    Vba and Sap gui scripting

    hello,

    I'm new to vba and sap gui scripting, could someone point me into the right direction please?

    I think I have a problem with the error handling statement maybe. it supposed to put the icon value(Green per example) in column C if there is any and to leave column C empty and put "No icon " on column B and then go to the next cell and check again if there is an icon or now.

    I have a list of element in excel (Column A) that I want to check in sap and instead of checking one by one manually I'm working on a macro to check all the items on excel and returns the value of the icon (if green in sap, it should return the icon value and put it on column "C") if it doesn't find the icon it should put the value : no icon found on column "B".

    I tried to put on error resume next but the problem is that it only work once and then it start puting the same value in column C and B regardless if there is a green icon or not.

    if I don't put in error handling method, once there is no icon, vba shows that the problem is on the below line:

    [Code]

    session.findById("wnd[0]/usr/tblSAPDV70ATC_NAST3").Columns.elementAt(0).Width = 4

    but when I do the following it works properly (puts "no icon" )and end exit the macro:

    [Code]

    '=====================Column A contains the Numbers I want to check on sap

    on error goto msg

    For Each rng In Columns("A").Cells.SpecialCells(xlCellTypeConstants)
    Elements= Cells(Elem.Row, "A").Value
    If Elem.Value Like "?56*" Then

    '============================================

    session.findById("wnd[0]").maximize
    session.findById("wnd[0]/tbar[0]/okcd").Text = "/nvf03"
    session.findById("wnd[0]").sendVKey 0
    session.findById("wnd[0]/usr/ctxtVBRK-VBELN").Text = Elements
    session.findById("wnd[0]/usr/ctxtVBRK-VBELN").caretPosition = 10
    session.findById("wnd[0]").sendVKey 0
    session.findById("wnd[0]/mbar/menu[2]/menu[0]/menu[3]").Select
    session.findById("wnd[0]/usr/tblSAPDV70ATC_NAST3").Columns.elementAt(0).Width = 4
    session.findById("wnd[0]/usr/tblSAPDV70ATC_NAST3/lblDV70A-STATUSICON[0,1]").SetFocus
    session.findById("wnd[0]/usr/tblSAPDV70ATC_NAST3/lblDV70A-STATUSICON[0,1]").caretPosition = 0
    session.findById("wnd[0]").sendVKey 2
    session.findById("wnd[0]/usr/tblSAPDV70ATC_NAST3").Columns.elementAt(0).Width = 4
    session.findById("wnd[0]/usr/tblSAPDV70ATC_NAST3/lblDV70A-STATUSICON[0,1]").SetFocus
    session.findById("wnd[0]/usr/tblSAPDV70ATC_NAST3/lblDV70A-STATUSICON[0,1]").caretPosition = 0
    Value = session.findById("wnd[0]/usr/tblSAPDV70ATC_NAST3/lblDV70A-STATUSICON[0,1]").IconName
    session.findById("wnd[0]/tbar[0]/btn[3]").press
    session.findById("wnd[0]/tbar[0]/btn[3]").press
    session.findById("wnd[0]/tbar[0]/btn[3]").press

    Cells(rng.Row, "C") = value

    End If
    Next

    msg:

    cells(rng.row, "D").value = "No icon"
    End Sub




    [\code]

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    79,412

    Re: Vba and Sap gui scripting

    Administrative Note:

    Welcome to the forum.

    Unfortunately, this is a duplicate thread, and you are allowed only ONE thread per issue here.

    Please see Forum Rule #5 about thread duplication.

    I am closing this thread, but you may continue here in the original thread: https://www.excelforum.com/commercia...-handling.html
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Dynamic Code Generator
    By samantha_S in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-01-2013, 12:48 AM
  2. Scripting
    By prettywoman in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-20-2011, 03:21 AM
  3. scripting
    By bieganiec in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-17-2010, 04:11 AM
  4. Help with VBA scripting
    By jiminic in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-12-2006, 12:10 AM
  5. VBA Scripting Help!!
    By hnoshea in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 10-17-2006, 12:14 AM
  6. [SOLVED] SCRIPTING
    By APC25 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-28-2006, 03:35 PM
  7. [SOLVED] Is scripting the way to go here?
    By LKG in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-09-2005, 03:05 PM
  8. VB scripting
    By PeterG in forum Excel General
    Replies: 1
    Last Post: 02-17-2005, 07:14 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1