0

I am working in SAP (PR2) and I have a large report that usually takes a long time (2 or more hours) to run. I have to take the output of this report and drop it into Excel to be manipulated and cleansed before bringing it into Access.

The ideal result would be a script that could launch automatically around 4am, login in to SAP, run the report, and have the results waiting for me when I come in. In short, I am missing parts 1 and 2, the automatic launch and automatic login to SAP.

I have pulled together a script that will start the report and then output the results as I want. The downside of this is that I don't get the results until about noon-ish each day, and that interrupts the workflow of those whom I support.

I have tried to run the necessary report in the background as suggested in other questions, but due to the size of the report and my limited access inside of SAP, it comes out in a way that is completely useless to me.

Thanks in advance for your help. Also, thanks for the help ya'll have given on prior questions :)

PS:As a bonus, if anyone knows how to encrypt a VBscript, that would be helpful as well.

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
Paul TIKI
  • 59
  • 2
  • 17
  • You seem to have a similar question here which you accepted? Ideally, you need to lay your questions out in a more clear and concise manner. Currently, it's a wall of text which most won't bother reading as one long paragraph. I'd recommend you read [ask] and consider providing a [mcve] to the specific problem. – user692942 Dec 16 '16 at 15:14
  • @Lankymart- Moved some stuff around to avoid the wall of text. Unfortunately, I don't really know what the start point is, so I do not have anything verifiable to give as an example of the problem. I guess you could say I'm looking for a point to begin. – Paul TIKI Dec 16 '16 at 15:30
  • Related http://stackoverflow.com/q/40429444/692942 – user692942 Dec 16 '16 at 15:40
  • That post helped me get to where I am now, which is light years beyond where I started. Automatic login would be one of the final steps to get things where I want. – Paul TIKI Dec 16 '16 at 17:42

1 Answers1

1

Use the windows task scheduler to set a run daily at time task.

VBS cannot be encrypted but can be encoded. This will only stop the casual person fiddling with the code, decoding scripts are available online for anyone who really wants to get your code.

    'ENCODE VBS TO VBE
    Set oFilesToEncode          = WScript.Arguments 
    Set oEncoder                = CreateObject("Scripting.Encoder") 
    For i                       = 0 To oFilesToEncode.Count - 1 
        file                    = oFilesToEncode(i) 
        Set oFile               = fso.GetFile(file) 
        Set oStream             = oFile.OpenAsTextStream(1) 
        sSourceFile             = oStream.ReadAll 
        oStream.Close 
        sDest                   = Encoder.EncodeScriptFile(".vbs",sSourceFile,0,"") 
        sFileOut                = Left(file, Len(file) - 3) & "vbe" 
        Set oEncFile            = fso.CreateTextFile(sFileOut) 
        oEncFile.Write sDest 
        oEncFile.Close 
    Next 
    WScript.quit

I use a software 'exescript' to convert to exe. Seems to work OK for me...

BertB
  • 108
  • 1
  • 9
  • Thanks for the help. Unfortunately, Task scheduler has been locked out by what is likely a well meaning but misguided IT department. the error comes up as "MMC cannot create the snap-in because of current user policies"...Are there other methods? I suppose I could just write a pause in the script for several hours, but that is not a preferred method for me. I have also discovered that exescript is not available to me. – Paul TIKI Dec 21 '16 at 16:12
  • Perhaps this article will help: http://stackoverflow.com/questions/19762371/vb-script-to-check-if-system-is-between-a-certain-time you could use this to run your script between some given hours? – BertB Dec 22 '16 at 10:01