Can't figure out what is the code

Hi
I got following macro that will help me to run certain transaction.
I just can't figure out where comments ends and where code starts so I was unable to run it for like 3 hours now.
In other words
I am trying to use Excel Macro that will get to active transaction in SAP and do waht I have recorded.
'SAPGUI Macro for updating SAP from Excel data 'Prerequisites: '1. Script Recording and Playback from the SAPGui must be enabled by admin '2. The Excel list must be set up from top left corner of a worksheet '3. The worksheet with data must be the active sheet '4. There is no error handling. Build it yourself! '5. The script will update the active (current) SAP transaction'Instructions for use 'Record a macro of your update actions. 'Paste the session.findById stuff between the <== and ==> markers'Edit the literal values and replace with Trim(CStr(objSheet.Cells(x, y).Value)) 'where x and y are the row and column counters'Open up your Excel sheet with data (row 1 is ignored here) 'Fire the macro! '===========BEGIN BOILERPLATE=================== REMSet up connection to the SAP screen: 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 Setsession = connection.Children(0) End If If IsObject(WScript) Then WScript.ConnectObject session, "on" WScript.ConnectObject application, "on" End If REMSet up connection to the Excel data to be keyed into SAP: Dim objExcel Dim objSheet, intRow, i Set objExcel = GetObject(,"Excel.Application") Set objSheet = objExcel.ActiveWorkbook.ActiveSheet session.findById("wnd[0]").maximize
'===========END BOILERPLATE=====================
'REM Example: Mark material for deletion in Plant using MM06 For i = 2 to objSheet.UsedRange.Rows.Count     'Assuming there is a header rowREM Find a cell and put its value in: REM Note: The section of the Script shown below can be recorded ' and edited to pick data from the Excel sheetstrCN = Trim(CStr(objSheet.Cells(i, 1).Value)) strWerks = Trim(CStr(objSheet.Cells(i, 2).Value)) '<== session.findById("wnd[0]/usr/ctxtRM03G-MATNR").text = strCN session.findById("wnd[0]/usr/ctxtRM03G-WERKS").text = strWerks session.findById("wnd[0]/tbar[0]/btn[0]").press session.findById("wnd[0]/usr/chkRM03G-LVOMA").selected = false session.findById("wnd[0]/usr/chkRM03G-LVOWK").selected = truesession.findById("wnd[0]/tbar[0]/btn[11]").press 'session.findById("wnd[0]/tbar[0]/btn[0]").press '==> Next

Ok macro works and triggers actions from recorder. I was doing it with hope I will select data in SAP and paste in Excel AND/OR export file from SAP with data.
If I record select column and then copy it. Script is recorded until selection . It ignores copy (i tried use mouse right click and copy AND manual alt+F12 and then copy from context menu)
When I export recorder does open export window but does not writes the line relevant to clicking save.
I found such bits
  'Choose the export format
  session.findById("wnd[1]/usr/subSUBSCREEN_STEPLOOP:SAPLSPO5:0150/sub:SAPLSPO5:0150/radSPOPLI-SELFLAG[1,0]").select
  session.findById("wnd[1]/tbar[0]/btn[0]").press
'Choose the export filename
  session.findById("wnd[1]/usr/ctxtDY_FILENAME").text = "test.txt"
  session.findById("wnd[1]/usr/ctxtDY_PATH").text = "C:\Temp\"
'Export the file
  session.findById("wnd[1]/tbar[0]/btn[0]").press
But they dont seem to be relevant to my previous macro.
Any quick fix to get data out of Excel

Similar Messages

  • Can you figure out what was the problem in this simple 3 liner code?

    Hello, below is a class to demonstrate a problem I see that I can't understand. I create an instance of the enclosing
    class at class level, another instance in static main method. Class below fails at run time with stack overflow exception. It's all fine if one of those two instantiation steps is removed, What is wrong can anyone any ideas?
    public class App
    // create instance of this class     
    App app = new App();
    public static void main( String[] args )
         // create instance of this class again.
    App app2 = new App();
    System.out.println( "Hello World!" );
    }

    As soon as a new instance of 'App' is created, 'App app = new App();' is called, which calls 'App app = new App();' etc. Hence the stack overflow.
    When you remove 'App app = new App();', obviously, the stack overflow does not occur. And when your remove 'App app2 = new App();' the 'App' class is never instantiated and therefore, the exception is also not thrown.

  • TS3694 My iPad says it has to restore to update, but it will not.  It is caught in a cycle of not being able to restore but needed to restore.  I keep getting error code 3014 but I can not figure out what this means!

    My iPad says it has to restore to update, but it will not.  It is caught in a cycle of not being able to restore but needed to restore.  I keep getting error code 3014 but I can not figure out what this means! nor can I do anything about it!  So Frutrated!

    Also...
    See Here  >  http://support.apple.com/kb/HT1808
    You may need to try this More than Once...
    But... if the Device has been Modified... this will Not necessarily work.

  • Trouble with calculating fields. Can't select (check) fields. Also can't figure out what's wrong with a division field (percent) that I created. Keep getting the pop up that format of the field doesn't allow blah blah blah... Help!

    Trouble with calculating fields. Can't select (check) fields. Also can't figure out what's wrong with a division field (percent) that I created. Keep getting the pop up that format of the field doesn't allow blah blah blah... Help!

    1. Use the mouse to select the field and then press the space bar.
    2. A null string is the same as zero. What is the result for division by zero?

  • When I put my iphone 4s into my pocket (pants or coat) and move it around, the phone beeps/makes a tone. I can't figure out what is causing the noise.

    I have a strange problem. When I put my iphone 4S into my pocket (pants or coat) and move it around, the phone makes a beep noise/tone. I can't figure out what is causing the noise. It doesn't sound like any of my regular applications. Maybe it is the lock noise but I can't tell for sure.  More movement makes more beeps.  Even walking with my phone in my pocket creates beeps.  The IOS is 7.0.4 (11B554a).  Anyone else have this crazy problem?

    Try This...
    Close All Open Apps... Sign Out of your Account... Perform a Reset...
    Reset  ( No Data will be Lost )
    Press and hold the Sleep/Wake button and the Home button at the same time for at least ten seconds, until the Apple logo appears. Release the Buttons.
    http://support.apple.com/kb/ht1430
    If the issue persists...
    Connect to iTunes on the computer you usually Sync with and Restore
    http://support.apple.com/kb/HT1414
    Make sure you have the Latest Version of iTunes (v11) Installed on your computer
    iTunes free download from www.itunes.com/download

  • I probably misclicked when I activated the security lock on the iPhone and now I can not figure out what password I entered. Moreover, I have patches and funky looking phone so I can not restore iphine pres itunes. Please advice.

    I probably misclicked when I activated the security lock on the iPhone and now I can not figure out what password I entered. Moreover, I have patches and funky looking phone so I can not restore iphine pres itunes. Please advice.

    Your only recourse is to force it into DFU mode:
    Turn your phone off and connect your cable to the computer, but not the device just yet. Start up iTunes. Now, hold down the home button on your phone and plug it in to the cable - don't let go of the button until iTunes tells you it's detected a phone in recovery mode. Now you can restore to factory settings.

  • I see "imac-54f9d5" under the "Shared" heading in my finder. I am not connected to any printers or other Mac devices. Is it possible that someone is remotely accessing my system? How can I figure out what this is?

    I see "imac-54f9d5" under the "Shared" heading in my finder. I am not connected to any printers or other Mac devices. Is it possible that someone is remotely accessing my system? How can I figure out what this is?

    is it your imac?
    is it your your router's name?
    are you by any chance connected to another wifi router then your own because the other one was open and not password protected?

  • I recently received a  WD My Book Studio external Hard drive and am installing it but can't figure out what the difference between wd turbo installer  64 and wd   turbo installer is.  Can someone tell me.  Thanks in advance for all your help.

    I recently received a  WD My Book Studio external Hard drive and am installing it but can't figure out what the difference between wd turbo installer  64 and wd   turbo installer is.  Can someone tell me.  Thanks in advance for all your help.

    Oh ok, well that was what the test said prior to reformatting the hard drive. Now, it doesn't find any trouble no matter how many times I run it. That's what has me so confused, everything seems to check out and yet...I can't do anything, not even install the software!

  • I uninstalled Firefox once, reinstalled it and it ran. I had a problem so I did it again. Now it will not run and I get an error message saying that firefox is running and you can only run one at a time. I can't figure out what is running.

    Because of a problem, I uninstalled Firefox once, reinstalled it and it ran. I had a problem so I uninstalled/reinstalled it again. Now it will not run. I get an error message saying that firefox is running and you can only run one at a time. I have uninstalled multiple times and can't figure out what is running. The is only one Firefox installed and it is not open. What does this mean and how do I fix it?

    If you use ZoneAlarm Extreme Security then try to disable Virtualization.
    *http://kb.mozillazine.org/Browser_will_not_start_up#XULRunner_error_after_an_update
    See also:
    *[[/questions/880050]]

  • Am getting message from MacPro that my start up disc is full - but I can't find it and can't figure out what to do to help situation. I've been making a number of imovies, which generates junk files. help?

    I am getting message from MacPro that my start up disc is full - but I can't find this "start up disc" and can't figure out what to do to help situation. I've been making a number of imovies, which generates junk files and material that I should toss in the trash, but it is not clear to me  what items I can toss and which items I can't toss. Can you help? Using the imovie "help" support the system showed me under the menu item "go" where the "start up disc" should be - but that wasn't actually available on my menu!  Thanks for your help!

    Disk Utility 
    Get Info on the icon on Desktop
    Try to move this to the MacBook Pro forum
    Your boot drive should be 30% free to really perform properly. 10% minimum
    Backup, clone, use TimeMachine, use another drive for your projects and movies, replace and upgrade the internal drive even.

  • Can't figure out what I'm doing wrong

    I'm using Studio 8 in Mac OS X (10.4.6). I've got some pdfs
    uploaded to my site that are accessible through links one one of
    the pages. I had to make changes to the pdfs and resave them. I
    thought I uploaded them, but when I test the links it downloads the
    old version and I can't figure out what I'm doing wrong. Here's
    what I did.
    This may be a dumb way to do things, but I saved the new
    version and then dragged into the server file in
    user-->Library-->Application
    Support-->Macromedia-->Dreamweaver
    8-->Configuration-->ServerConnections-->unnamed
    server-->public_html (this is where all the other files are).
    When I go back into Dreamweaver and open the pdf listed in the
    Files window on the right (by control-clicking and selecting Open
    with-->Acrobat) the correct version appears. I thought maybe
    there was a delay or something, but I've waited and still the old
    version is what you get from the site.
    Is there an easier way to do this, or is something wrong
    maybe? Many thanks in advance.

    > This may be a dumb way to do things, but I saved the new
    version and then
    > dragged into the server file in
    user-->Library-->Application
    > Support-->Macromedia-->Dreamweaver
    Put the files in this Site's Local Site Folder.
    If unsure of where you've specified this to be, look in this
    site definition
    (dw menu-->Sites-->Manage or Edit Sites)
    If that path you've given above above is correct, it's
    wrong....

  • Background program running and can't figure out what it is...

    I have an IMAC desktop, I just purchased the Photoshop Elements 10 software for MAC, installed it, running fine. But now I have program that is contanstly running in the background that is slowing up all of my other applications I run while I'm working. I've checked the Activity Monitor but I can't see anything out of the norm...Does anyone have any suggestions? I'm very frustrated....

    I presume you mean that the hard drive is working on something. Again, any such process would show in the Activity Monitor. Check that again, confirming that you have "all processes" set so you can see everthing that's going on. It will be easiest to spot anything unusual if you click on the "% CPU" column header to sort by the amount of CPU time each process is using. Click twice so that the arrow is pointing downwards; then the top users of CPU time will be listed at the top. Post the name of any process that's consistently or unexpectedly using a significant amount of CPU time and we can probably figure out what's happening and offer suggestions.
    Regards.

  • How can I figure out where are the heaviest volumes in order to get rid of the useless stuff?.

    How can I figure out where are the heaviest volumes in order to get rid of the useless stuff?.

    How about a few specific NOUNs to replace the vague references you have made. A little context.
    Volumes of WHAT ?
    What sort of STUFF are you trying to eliminate ?

  • How can i figure out what device downloaded apps

    how can i figure out what device downloaded certain apps?

    One way is to remove all apps and then reinstall a few at a time while watching the "Other" memory indicator, but this will cause a loss of any data the apps are storing, like files, high scores, settings, etc.
    I don't know of an 'electronic' way of find this out.

  • HT201359 how can i find out what all the charges on my checking account are for?

    how can i find out what all the charges on my checking account are for?

    If you log into your account on your computer's iTunes via the Store > View Account menu option, you should then see a Purchase History section with a 'see all' link to the right of it. Click on that and you should then see a list of your purchases - the most recent purchase is above the list. I'm not sure if that shows auto-renewing subscriptions (I don't have any so I can't check).
    If you can't find the charges and you haven't added or changed your card details on your account (when you do then a small temporary store holding charge may be applied to check that the details are correct and valid, which should disappear within a few days) then you can contact iTunes Support via this page : http://www.apple.com/support/itunes/contact/ - click on Contact iTunes Store Support on the right-hand side of the page, then Purchases, Billing & Redemption

Maybe you are looking for

  • Unlocked iPhones - How to tell if it's unlocked

    Hello, Sort of hijacked another thread with this question - my apologies. Question is, if you were buying a second hand iPhone, is there a way to look and see whether it's unlocked or not? I see on my 3Gs there's a 'locked' icon in the middle at the

  • External Monitor Issues

    Whenever I connect my external monitor (Dell 1600x12000) My laptop gets really slow and my internet connection plummets, please help!!

  • Custom Template Questions...

    I guess i should explain what we are creating first... this is our first "full length" dvd project. It is entirely in native 16:9 3CCD SD. the main title page will have 4 "titles": main feature, instruction, extras, disclaimer/credits. the instructio

  • Photos uploaded to Picasa after being adjusted in Aperture look washed out.

    I imported color pics (RAW and JPEG) from my Nikon D70 to iPhoto. I brought them into Aperture, adjusted the shadows and uploaded them to Picasa (using the Picasa Web Albums Uploader, not the "Aperture to Picasa" plugin. The pictures on Picasa are to

  • Encode the URL with space

    Hi all Ihave some content which needs to be encode with the URL.. E.G: URL is --http://localhost:8080/appname/notify? content need to encode---msgtxt=bal P0045IN I am using HttpConnector.executeGetMethod(URL_BAL, URLParameters); But it giving Error c