Using Macro in Excel How to open a SAP directly?

Hi,
       Can Anyone Suggest and help me to do above Code in Excel,"Using Macro in Excel  How to open SAP directly"
Example: I want to Open T.CODE: MM01 directly, without login in to SAP, Using Macro, i want to open SAP Directly, Anyone Suggest me how to do it?.............
I Tried this But it  showing Run time Error'438', Object does not support this property or method........
VBCODE:
Dim sap As Object
Dim conn As Object
Sub T_login()
Set sap = CreateObject("SAP.Functions")
Set conn = sap.Connection
conn.System = "production"
conn.client = "800"
conn.user = "SAPUSER"
conn.Password = "123456"
conn.Language = ""
conn.Tcode = "MM01"
If conn.logon(0, False) Then
MsgBox "Logon to the SAP system is not possible", vbOKOnly, "Comment"
Else
End If
If Not IsObject(SapGuiApp) Then
Set SapGuiApp = CreateObject("Sapgui.ScriptingCtrl.1")
End If
If Not IsObject(Connection) Then
Set Connection = SapGuiApp.OpenConnection("production", True)
End If
If Not IsObject(session) Then
Set session = Connection.Children(0)
End If
session.findById("wnd[0]/usr/txtRSYST-MANDT").Text = "CLIENT"
session.findById("wnd[0]/usr/txtRSYST-BNAME").Text = "USER"
session.findById("wnd[0]/usr/pwdRSYST-BCODE").Text = "PASSWORD"
session.findById("wnd[0]/usr/txtRSYST-LANGU").Text = ""
session.findById("wnd[0]/usr/txtRSYST-LANGU").SetFocus
session.findById("wnd[0]/usr/txtRSYST-LANGU").caretPosition = 2
session.findById("wnd[0]").sendVKey 0
Set wshell = CreateObject("Wscript.Shell")
wshell.Run Chr(34) & Path & "\script.vbs" & Chr(34), 1, 1
End Sub
Anyone send me the Exact code related to this.................
Its very immediate requirement.................
Regards
Karthick

Hi Karthick,
You could try the following:
Sub Test()
If Not IsObject(SAPguiApp) Then
    Set SAPguiApp = CreateObject("Sapgui.ScriptingCtrl.1")
End If
If Not IsObject(Connection) Then
    Set Connection = SAPguiApp.OpenConnection("SYSTEMNAME", True)
End If
If Not IsObject(session) Then
    Set session = Connection.Children(0)
End If
session.findById("wnd[0]/usr/txtRSYST-MANDT").Text = "123"
session.findById("wnd[0]/usr/txtRSYST-BNAME").Text = "USER"
session.findById("wnd[0]/usr/pwdRSYST-BCODE").Text = "PASSWORD"
session.findById("wnd[0]/usr/txtRSYST-LANGU").Text = "EN"
session.findById("wnd[0]/usr/txtRSYST-LANGU").SetFocus
session.findById("wnd[0]/usr/txtRSYST-LANGU").caretPosition = 2
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/tbar[0]/okcd").Text = "/nmm01"
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]").maximize
MsgBox "If you click on the OK button, the SAP session is terminated."
End Sub
SAP GUI should appear in the new design, you must do the following:
START -> All Programs -> SAP Front End -> SAP GUI Configuration -> Application -> Add -> excel.exe -> Open
If the program is started from a VBS file, it must be entered here wscript.exe.
Regards,
ScriptMan

Similar Messages

  • How to open word document directly using ole2 and ole containers

    Hello
    i am using ole conatiners....in forms 6i. i want o open word document directly when i click a button....
    i have tried host....ole but word opens .....i want the document to open at once.....
    what should i use /set
    plz tell by host command and ole2 as well
    its urgent.....
    thanks

    Try this code, Hope this will work.
    declare
    item_name varchar2(80) := 'letter';
    item_id item;
    verb_index_str VARCHAR(20);
    verb_index PLS_INTEGER;
    verb_cnt_str VARCHAR(20);
    verb_cnt NUMBER;
    verb_name VARCHAR(20);
    loop_cntr NUMBER;
    begin
    item_id := Find_Item(item_name);
    IF Id_Null(item_id)THEN
              message('No such item: '||item_name);
    ELSE
    verb_cnt_str := Forms_OLE.Get_Verb_Count(item_id);
    verb_cnt := TO_NUMBER(verb_cnt_str);
    FOR loop_cntr in 1..verb_cnt LOOP
    verb_name := Forms_OLE.Get_Verb_Name(item_id,loop_cntr);
    -- message(verb_name);
    -- message(loop_cntr|| ' '||verb_name);
    IF verb_name = 'Open' or Verb_name = '?E?'THEN
    EXEC_VERB(item_id,verb_name);
    END IF;
         end loop;
    end if;
    EXCEPTION
    WHEN OTHERS THEN
    MESSAGE('Error: '||TO_CHAR(SQLCODE)||' '||SQLERRM);
    RAISE FORM_TRIGGER_FAILURE;
    end;

  • BO Analysis for Excel – How to connect to SAP BW

    Hi Gurus,
    We recently upgrade to BO 4.1 (from 3.1).  And want to start to use Analysis for Excel.
    We are little unclear how to connect from Analysis for Excel to SAP BW 7,3.
    From Analysis select “Select Data Source” Then get a pop-up “Logon to SAP BussinessObjects BI Platform” with User, Password and Web Service URL.  All those are blank.  For the Web Service URL there is a message “Error while checking availability of SAP BussinessObjects BI Platform system”
    If choose “Skip” then get SAP Logonpad and can log on to BW.  From there I can choose the BW queries directly.
    What is the best practice to connect from Analysis for Excel to SAP BW?
    Is it not possible to connect to the BO server?  And choose OLAP connection from there to connect to BW?
    If so, is something missing in our setup?
    Regards,
    Reynir

    Yes you need to define an OLAP connection of you are connecting to BW through the BIP - see tutorial http://scn.sap.com/docs/DOC-20625
    You can also connect directly to BW without going through BIP
    I also recommend searching before you post per SCN rules - there are many posts about creating OLAP connections
    Tammy

  • How to open a SAP Transactiion Screen from a link in Email

    Hi Experts,
    Requirement: Lets say upon creation of sales order 6000001 in VA01, an email is triggered to a person. In the email there should be a hyperlink which should open the order 6000001 (VA02 screen) without asking for any authentication.
    How to achieve this SAP - Email integration. Do we have to use some groupware connector to achieve this integration? (CRM has got a connector I guess!!).
    Any suggestion is appreciated.
    Thanks & Regards,
    Shobhit

    Hi Swarup,
                     You know to tell which mail format are you using, whether is Outlook or Lotus. SAP Connectors need to be installed for the same depending upon the mail type.
    Regards,
    Abhishek Raj.

  • How to open jxl workbook directly using JSP...??

    Dear Friends,
    I have created an object for "jxl.write.WritableWorkbook" in my action class, suppose let's say "objWB"
    now I can write this object to a file using objWB.write(), If I write to a file I am able to open it using FileInputStream
    but I don't have permissions on my client machine
    so is there any way, where I can open it directly using JSP.
    Thanks in advance..
    GP
    Don't think be happy

    Don't think, be happy eh? How can you be happy if you have no capacity to register it?
    In any case, to "open" a document in any web environment, you write the binary data to the response with the correct content-type set. If for example you set the content-type to "application/ms-excel" and on the client computer a program is registered to handle that content type, the document might be opened directly in that application. If there is no application registered to handle the content-type, a download of the file is usually offered.
    Do a google search for popular content-type values. I'm sure you can also find examples on how to output a binary file to the response. You are already almost there, in stead of writing the data to the fileoutputstream, write it to the outputstream of the response object in stead.

  • Using VBA from Excel, how to send datas into a SQL server

    Hi,
    How do you use VBA to provide the connection to insert datas into a table within a database.
    What kind of statements do we need. 
    The database, and table are for example already created.
    Thanks

    Hi
    I know this is an old thread but did you come right?

  • HT1725 after purchased MOVIE, Down LOAD MAY have problem. PLS ADV HOW TO USE DOWN ROAD and HOW TO OPEN it.

    I have purchased 1 MOVIE first time from ITUNE. but maybe some problem in Downroad.
    It mentione some error and I don't Know How to solve and How to use Purchased Movie when I want watch the Movie.   Thanks.

    I have purchased 1 MOVIE first time from ITUNE. but maybe some problem in Downroad.
    It mentione some error and I don't Know How to solve and How to use Purchased Movie when I want watch the Movie.   Thanks.

  • How to open docx attachment directly if it attached in editing forward mail

    There is a mail with attachment docx file, I click forward to edit, at this moment, I want to open the attachment to check a few, but when I double-click the attachment, it always open a tmp file and ask me which application will be use. how can I disable the tmp file, just use what file is to open it?
    Jason

    You can not edit an attachment. The changes you make will be lost.

  • How to OPEN / Access .SAP files?  .SAP File extension!!

    I have downloaded SAP Classic English Training (CU44), inside the archive are a lot of .SAP files. 
    How do you open / play these files?
    .SAP  -  These are all SAP Education Content. 
    Here is label.asc
    SAP KW 4.0 - 7.0
    Content Update No. 40
    December 2008
    Classical Training Courses: DE/EN
    XML Traing Courses: DE/EN
    Number 51036048_1
    So basically we have a lot of these .SAP files, what do we do with them?  How to access the content that's in them?
    Please help Thanks

    My mistake I miss read your post... usually .SAP files are exports from SAP or shortcuts.... for example if you create a shortcut for a system in your desktop will have a .SAP extention also for example if you export a role to a file in PFCG it will create a file with a .SAP extention.
    I presume this files are meant to be uploaded in some way but you will have to explain your scenario
    Regards
    Juan

  • How to open the SAP BI report without giving prompt on the screen

    I want to open a BI report  through dashboard just by clicking on a button. I don't want user ti get the pop up screen for any login or so. Kindly suggest.

    Hi,
    You can pass the login credentials in the URL itself.
    Lets say you have dashboard "SAMPLEDSHBRD",to launch this dashboard without prompt for any login credentials you can pass the credentials in URL as follows...
    http://<>:<>/irj/........DASHBOARD=SAMPLEDSHBRDT&j_user=<Username>&j_password=<Pwd>
    Rgds,
    Murali

  • Use VBA and Excel to open Dreamweaver HTML (CS5), find and replace text, save and close

    I wish to use VBA and Excel to programmatically open numbered Dreamweaver HTML (CS5) and find and replace text in the code view of these files, save and close them.
    I have  5000 associations between Find: x0001 and Replace: y0001 in an Excel sheet.
    I have the VBA written but do not know how to open, close and save the code view of the ####.html files. Please ... and thank you...
    [email protected]

    This is actually the code view of file ####.html that I wish to find and replace programmatically where #### is a four digit number cataloguing each painting.... In 1995 I thought this was clever... maybe not so clever now :>)) Thank you for whatever you can do Rob!
    !####.jpg!
    h2. "Name####"
    Oils on acrylic foundation commercial canvas - . xx X xx (inches) Started
    Back of the Painting In Progress </p> </body> </html>
    Warmest regards,
    Phil the Forecaster, http://philtheforecaster.blogspot.ca/ and http://phils-market.blogspot.ca/

  • How to open and edit a TopLink .mwp file?

    I can not open the toplink_mappings.mwp file using JDeveloper tool.
    How to open and edit a TopLink .mwp file?
    Thank you

    Hi,
    Use JDeveloper to import the mwp project .In Jdeveloper,File->Import->ToplinkWorkbench->Select the .mwp file and can work from JDeveloper in editing the tlmap.xml and session.xml.
    Regards,
    P.Vinay Kumar

  • How to open RAC node2 usng spfile which will stay in ASM disk?

    Hi,
    I have installed oracle 11g r2 rac with asm in two nodes. OS is hp-Unix.
    I have installed oracle11g Active Data Guard using Single alone Database.
    Both RAc and Active Data Guard works fine.
    I have not configure Data Guard Broker.
    N.B Rac node1 is running using spfile which is in ASM disk (+DATA/spfiledcpdb.ora) but node2 is running using pfile.
    Question: how to open node 2 using spfile which will stay in ASM disk like node 1?
    Thanks
    Solaiman
    Edited by: 876149 on Apr 1, 2013 10:08 AM

    Modify your PFILE to specify only IFILE='location_of_spfile'
    OR
    use STARTUP PFILE='location_of_spfile'
    Ensure that the spfile does have the 2nd instance specific parameters defined correctly.
    Hemant K Chitale

  • How to open a ticket with Apple?

    Hi there, anyone knows how to open a ticket directly with Apple on Aperture 3.0.3? I am able to reproduce a problem on every occasion...
    In aperture, if you Edit a file into Photoshop CS3, close the file from Photoshop and goback to Aperture, try to adjust Exposure.... it will crash all the time... no exception...
    a force quit is necessary...
    Thank you so much in advance

    if you have a free online developer account you can use http://developer.apple.com/bugreporter/ the bug reporter where you will get direct feedback otherwise you can send a feedback http://www.apple.com/feedback/aperture.html but you will prolly not get direct feedback (altho it does get read and dealt with).
    HOWEVER
    CS3 is now "out of date". Does it still happen with CS4 or CS5? (not that I am asking you but if you have a friend who can test it it would be great)

  • HT1212 my iPhone is disabled ..... and i don't know how to open it ?

    my iPhone is disabled and i don't know how to open it

    Follow the directions in the article you linked.

Maybe you are looking for

  • Infopackage-Load Many Files from Application Server and later Archive/Move

    Hi All..   I have a doubt,   I have a requirement of take many files to load into BI 7.0..  I used the infopackage before with option: Load Binary File From Application server   I load information successfully... only with one file ...but If I can lo

  • Creative Cloud Desktop App in English

    Hi all, I don't know if this was solved before and I've been looking for a solution but didn't found a clue. My CC desktop app is installed in to my mac but everything is displayed in english and it should be in Spanish. When I install any app (Photo

  • Reinitialise logical standby

    Hi There were some gaps in the redo apply I need to know if I could apply these changes via rman rman> connect catalog ... rman> connect target primary_db rman> connect auxiliary sdby_db rman> run allocate auxiliary channel .... set archivelog destin

  • Macosx, instantclient and application bundle

    I'm facing strange problem - but it's maybe because I don't know too much about macosx internals. I have an application (Qt4/OCCI over Oracle InstantClient) and I want to redistribute it as a bundle. The bundle is built into required structure (requi

  • System info and my RD480 NEO2 FI

    could someone else that has this motherboard look and see if the amount of memory is correct in the windows system information. i have 1 gig of memory but it only shows 512. on the other hand if i go into the control panel and look in  system/general