Catch error in javascript when using SAP script

All,
I have a issue when using Javascript to control the SAP GUI in that I get a "syntax Error" raised by Internet Explorer if I attempt to get the SAPGUI runtime object from the runtime object table if SAP is not already running.
For example:
I have a javascript function embedded in a web page as follows:
<script type="text/javascript">
function displaymessage()
var sapgui;
var application;
var connection;
if (typeof(application) == "undefined")
   sapgui      = GetObject("SAPGUI");
   application = sapgui.GetScriptingEngine();
if (typeof(connection) == "undefined")
   connection = application.children(0);
if (typeof(session) == "undefined")
   session = connection.children(0);
if (typeof(WScript) != "undefined")
   WScript.connectObject(session, "on");
   WScript.connectObject(application, "on");
session.findById("wnd[0]/tbar[0]/okcd").text = "fb50";
session.findById("wnd[0]").sendVKey(0);
session.findById("wnd[1]/usr/ctxtBKPF-BUKRS").text = "0001";
session.findById("wnd[1]/usr/ctxtBKPF-BUKRS").caretPosition = 4;
session.findById("wnd[1]").sendVKey(0);
</script>
I have a simple HTML page with a button on it that calls the function.
If I have already launched SAP GUI and logged in the code works fine and atuomatically navigates me to FB50.
If SAP is not active and logged in then I get a syntax error!  The error is raised by IE when the GetObject("SAPGUI") is executed.
Can anyone please help by either:
a) explaining how I can catch this error in javascript
b) suggesting a different way to call the GetObject
c) suggesting a way that I can auto launch SAP to log people in if it is not already active.
Note - Using VB is not an option as I need to embed the working Javascript code in a Siebel thin client application which only uses Javascript.
All help welcome. Thanks

Hey Gunter,
Thanks much, that did work.
The other error I spoke of was fixed with the new database, so apparently the two errors I spoke of weren't related.
You seem to be a good help to this forum, thank you for that.... fixing my problem relieved me from much stress.
Cheers,
Derek Miller
Dreamweaver Enthusiast

Similar Messages

  • Error when using SAP authentication for Designer

    my error is:
    [repo_proxy 13] SessionFacade::openSessionLogon with user info has failed(The
    secSAPR3 DLL could not be found or does not exist(hr=#0x80042a01)
    can you help me?
    regards

    hi,
    pls refer the link
    Error when using SAP authentication for Designer
    try re-installing BOE and check
    hope it helps,
    sundar

  • Error when including SAP Scripting Control

    Hello,
    I was using SAP Scripting Control in VB with SAPGUI 620 without any problems. I upgraded my SAPGUI to 640 (patch level 8). Now, I am not able to include the SAP Scripting Control (sapfewse.ocx) in Visual Basic. Whenever I try to include it, I get an error "Circular dependencies between modules". Am I doing something wrong?
    I also installed the patch level 20 but I still get the same error.
    Any help would be highly appreciated.
    Thanks.

    Hi Vishal,
    please upgrade to the latest 640 patch. The problem was fixed, I think patch 11 should work fine.
    Best regards,
    Christian

  • OAM Error : Enable JavaScript to use OAM Server.

    Hi Friends,
    I see following script when I try to access a resource protected using OAM in Mozillla and Safari browsers.
    <body onLoad="document.myForm.submit()"><noscript><p>JavaScript is required. Enable JavaScript to use OAM Server.</p></noscript>The same configuration works with IE.
    Could you please help me understand if any patch need to be applied to OAM or if I am missing something in the configurations?
    Note: We are using OAM 11.1.1.5.0 to protect webcenter 11.1.1.5.0.
    Thanks,
    Sachin
    Edited by: 873687 on Feb 3, 2012 2:54 AM

    Hi,
    We had a customer that ran into the same exact issue and symptoms described in this thread. The issues occurred after some upgrades were made to browsers and java. Our customer was using Forms/Reports 11.1.2.1 (11gR2), OAM/OID (11.1.1.5) and mod_osso for the Forms-OAM integration.
    The issue was caused by a bug in OAM 11.1.1.5. The problem is when OAM authentication occurs, it does some web directs within it's internal java code. The HTML/JavaScript it tries to execute fails only in Chrome/Firefox. Applying the patch, supposedly fixes that faulty HTML/Javascript generated by OAM.
    Oracle Support documents on the issue and bug:
    - There is a Oracle Support article describing the issue: 1447194.1
    - Oracle Support Bug Number: 13254371
    To fix the issue:
    - Apply OAM Patch: 13115859. Its a generic patch that will work on any environment type.
    - If you use WebGates for your application, check out patch 13453929
    I wrote an article on how to install the patch: http://pitss.com/us/2013/04/04/oam-error-enable-javascript-to-use-oam-server/
    I hope this helps!
    Thank you,
    Gavin

  • Only the last account is created when using this script in combination with a CSV

    Hi, I've got a weird problem when using this script:
    $Users = Import-Csv -Delimiter ";" -Path "......csv"  
    FOREACH ($User in $UserList) { $ User }
        $OU = $User.path
        $UPN = $User.UPN
        $Password = $User.password 
        $Detailedname = $User.firstname + " " + $User.Lastname 
        $UserFirstname = $User.Firstname 
        $FirstLetterFirstname = $UserFirstname.substring(0,1) 
        $SAM =  $User.UPN
        $Company = $User.company
        $Description = $User.description
        $AccountExpirationDate = $User.accountexpirationdate
    $params = @{ 'Name'=$Detailedname;
                 'SamAccountName'=$SAM;
                 'UserPrincipalName'=$SAM;
                 'DisplayName'=$Detailedname;
                 'GivenName'=$UserFirstname;
                 'Surname'=$User.Lastname;
                 'AccountPassword'=(ConvertTo-SecureString $Password -AsPlainText -Force);
                 'Enabled'=$True;
                 'PasswordNeverExpires'=$True;
                 'Path'=$OU;
                 'Company'=$Company;
                 'Description'=$Description;
                 'AccountExpirationDate'=$AccountExpirationDate }
    New-ADUser @params
    The CSV file has columns with the name: Lastname;Firstname;Password;Company;Description;UPN;path;AccountExpirationDate
    Script runs without errors, but only creates the last line in the CSV file. Anyone that can help me, of put me in the right direction? Should be great!
    Michiel
    the Netherlands

    Hi Michiel,
    You'll need to move $params and New-ADUser up into the foreach loop.
    EDIT: Also, remove the { $ User } that you have next to the foreach loop. You're also using $Users instead of $UserList.
    EDIT2: Here's a cleaned up version:
    $UserList = Import-Csv -Delimiter ";" -Path "......csv"
    FOREACH ($User in $UserList) {
    $OU = $User.path
    $UPN = $User.UPN
    $Password = $User.password
    $Detailedname = $User.firstname + " " + $User.Lastname
    $UserFirstname = $User.Firstname
    $FirstLetterFirstname = $UserFirstname.substring(0,1)
    $SAM = $User.UPN
    $Company = $User.company
    $Description = $User.description
    $AccountExpirationDate = $User.accountexpirationdate
    $params = @{ 'Name'=$Detailedname;
    'SamAccountName'=$SAM;
    'UserPrincipalName'=$SAM;
    'DisplayName'=$Detailedname;
    'GivenName'=$UserFirstname;
    'Surname'=$User.Lastname;
    'AccountPassword'=(ConvertTo-SecureString $Password -AsPlainText -Force);
    'Enabled'=$True;
    'PasswordNeverExpires'=$True;
    'Path'=$OU;
    'Company'=$Company;
    'Description'=$Description;
    'AccountExpirationDate'=$AccountExpirationDate
    New-ADUser @params
    Don't retire TechNet! -
    (Don't give up yet - 13,085+ strong and growing)

  • Get ORA-01031: insufficient privileges error, but only when using dbstart.

    I am getting ORA-01031: insufficient privileges error, but only when using dbstart. the listener starts but not the database. How come I can start it from SQL prompt but not from dbstart scripts as the oracle user?
    [oracle@mallard bin]$ ./dbstart
    Processing Database instance "gf44": log file /prod/oracle/10/startup.log
    [oracle@mallard bin]$
    Log file:
    Wed Aug 20 10:15:02 CDT 2008
    SQL*Plus: Release 10.2.0.1.0 - Production on Wed Aug 20 10:15:02 2008
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    SQL> ERROR:
    ORA-01031: insufficient privileges
    SQL> ORA-01031: insufficient privileges
    SQL>
    /prod/oracle/10/bin/dbstart: Database instance "gf44" warm started.
    >
    oratab file:
    gf44:/prod/oracle/10:Y
    dbstart file section:
    # See if it is a V6 or V7 database
    VERSION=undef
    if [ -f $ORACLE_HOME/bin/sqldba ] ; then
    SQLDBA=svrmgrl
    VERSION=`$ORACLE_HOME/bin/sqldba command=exit | awk '
    /SQL\*DBA: (Release|Version)/ {split($3, V, ".") ;
          print V[1]}'`
    case $VERSION in
    "6") ;;
    *) VERSION="internal" ;;
    esac
    else
    if [ -f $ORACLE_HOME/bin/svrmgrl ] ; then
    SQLDBA=svrmgrl
    VERSION="internal"
    else
    SQLDBA="sqlplus /nolog"
    fi
    fi
    Permissions of file:
    [oracle@mallard bin]$ ls -la dbstart
    -rwxrwxr-x 1 oracle oinstall 10407 Aug 19 12:27 dbstart
    [oracle@mallard bin]$
    User permissions:
    [root@mallard 10]# id oracle
    uid=503(oracle) gid=503(oinstall) groups=503(oinstall),504(dba)
    [root@mallard 10]#
    I can start the listener manually using "./lsnrctl start" and start the database manually from sql prompt using "SQL>startup" (as sysdba) with no problems. this only happens when using dbstart file. I am logged in as oracle user and all environment variables are set
    Thank you for any help you could provide.

    I have the same problem, but i don't want insert this string
    Connect sys/{password} as sysdbaI have deployed an Oracle 10g with os SunOS
    $ uname -a
    SunOS DB02 5.10 Generic_141444-09 sun4v sparc SUNW,Sun-Blade-T6320
    I can connect with sys/password, but I can't login with
    $ sqlplus /nolog
    SQL*Plus: Release 10.2.0.1.0 - Production on Thu Jan 7 15:19:50 2010
    Copyright (c) 1982, 2005, Oracle.  All rights reserved.
    SQL> connect / as sysdba
    ERROR:
    ORA-01031: insufficient privilegesthe the startup and dbshut don't work.
    Someone maybe help me?
    Thanks,
    Regards.
    Lain

  • Display data vertically using sap script

    Hi Developers,
    Is there any way to display data vertically in a form using sap script?
    thanx in advance,
    binu

    Hi Binu,
    It is not possible to rotate text in SAPscript.  The usual work-around, provided this is static text and not from a variable, is to scan an image of the text and include it as a graphic.
    Regards,
    Nick

  • Commenting a Line in ABAP Editor when using SAP GUI for java

    Hi,
    In ABAP editor we can highlight the line which are to be comment and use cmd+< sign to comment those lines. What will be the command to be used to achieve the same functionality when using SAP GUI for JAVA on an iMac.

    Hello Kedar,
    please check with SAP GUI for Java 7.20 rev 5 before submitting a bug report.
    Also please verify, that cmd-< and cmd-> are not assigned as "Keyboard Shortcuts" in the "Keyboard" control panel of "System Preferences".
    Bug reports can be submitted with the [SAP Message Wizard|http://service.sap.com/message], for SAP GUI for Java please use component BC-FES-JAV.
    Best regards
    Rolf-Martin

  • Customer Statement using SAP Script and Standard print program RFKORD10

    Using sap script and standard print program RFKORD10 I need to create a customer statement where the main window will be as follows
    Invoice #     InvoiceDate  CustomerPO  Debit Amt  Credit Amt  Total
        6        7           8               9               10               11
        6        7           8               9               10               11
                                     Totals               12             13              14
    Where company code BKORM-KUKRS
                Invoice              BSID-BELNR
                Invoice date      BSID-BLDAT
                Customer PO    VBKD-BSTKD
    For each document number selected there will be one to many records in VBRP.  For each invoice item in VBRP:
    u2022     Select BSTKD from VBKD where
    o     VBELN = VBRP-VGBEL and
    o     POSNR = VBRP-VGPOS
    u2022     If no hits then select BSTKD from VBKD where
    o     VBELN = VBRP-VGBEL
    If there is more than one PO per invoice then list them in the Customer PO field without repeating the other fields.PO shouldnu2019t come more than once per invoice.
                 Debit Amt         if BSEG-SHKZG = S then WRBTR ELSE 0
                 Credit Amt        if BSEG-SHKZG = H then WRBTR ELSE 0
                 Total                  Debit Amt u2013 Credit Amt
                  Totals                Subtotals
    It will be of great help if some one can help me with the script and the alterations required in standard print program RFKORD10
    Points will b rewarded for sure.
    Thanks.

    Hi Suganya,
    The custom form is getting displayed properly. But the requirement is to have it as an editable PDF. So the functional team is working on configuring the settings of PDF forms with customers email address.
    But for right now, i customized the standard form F140_ACC_STAT_01 and standard print program RFKORD10_PDF and did the configuration. It is getting displayed (I tested only with the transaction FBL5N - customer open line items..)
    Please let me know any further details on this.
    Poornima

  • Error ORA-06502 When using function REPLACE in PL/SQL

    Hi,
    I have a PL/SQL procedure which gives error 'Error ORA-06502 When using function REPLACE in PL/SQL' when the string value is quite long (I noticed this with a string 9K in length)
    variable var_a is of type CLOB
    and the assignment statement where it gives the error is
    var_a := REPLACE(var_a, '^', ''',''');
    Can anyone please help!
    Thanks

    Even then that shouldn't do so:
    SQL> select overload, position, argument_name, data_type, in_out
      2  from all_arguments
      3  where package_name = 'STANDARD'
      4  and object_name = 'LPAD'
      5  order by 1,2
      6  /
    OVERLOAD   POSITION ARGUMENT_NAME                  DATA_TYPE                      IN_OUT
    1                 0                                VARCHAR2                       OUT
    1                 1 STR1                           VARCHAR2                       IN
    1                 2 LEN                            BINARY_INTEGER                 IN
    1                 3 PAD                            VARCHAR2                       IN
    2                 0                                VARCHAR2                       OUT
    2                 1 STR1                           VARCHAR2                       IN
    2                 2 LEN                            BINARY_INTEGER                 IN
    3                 0                                CLOB                           OUT
    3                 1 STR1                           CLOB                           IN
    3                 2 LEN                            NUMBER                         IN
    3                 3 PAD                            CLOB                           IN
    4                 0                                CLOB                           OUT
    4                 1 STR1                           CLOB                           IN
    4                 2 LEN                            NUMBER                         INI wonder what happened?

  • PO for item of service Level short and long text using sap script

    Please let me know how to do the PO for item of service Level short and long text using sap script.
    <MOVED BY MODERATOR TO THE CORRECT FORUM>
    Edited by: Alvaro Tejada Galindo on May 5, 2009 10:25 AM

    Hi ,
          In the transaction related to PO select the path goto->header texts and then details of the texts like ID,objectname,language,name.Pass all theses details to 'READ_TEXT '   FM. Then you will get text lines described for a perticular Po ,similarly for item also.
    Thanks,
    Suma.

  • Error 1074396120 appears when using IMQA copy

    error 1074396120 appears when using IMQA copy,when i used in vision its working but when i tried to execute in labview its showing error image not found and not valid image. pls help me regarding this .

    Have a look
    Thanks and Regards
    Himanshu Goyal | LabVIEW Engineer- Power System Automation
    Values that steer us ahead: Passion | Innovation | Ambition | Diligence | Teamwork
    It Only gets BETTER!!!

  • Hi there , Why Do I Receive Error Code -1073807253 When Using VISA

    Error Code -1073807253

    Hi ahmed,
    you can attach picture directly in the forum...
    If you would use an error indicator you could read an explanation of the error. It's a "framing error", happening sometimes when using serial connections...
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • What is the best way to display errors to users when using JSPs?

              Hello,
              Could someone suggest me the best way to display errors to users when using JSPs?
              Many thanks in advance.
              Rino
              

              Thanks for the code snippet!
              Rino
              "Deepak Vohra" <[email protected]> wrote:
              >
              >
              >The 'errorPage' attribute of the 'page' directive forwards uncaught run-time
              >exceptions
              >to an error processing page. For example:
              >
              ><%@ page errorPage="error.jsp" %>
              >
              >redirects the browser to the JSP page error.jsp if an uncaught exception
              >is encountered.
              >
              >
              >Within error.jsp, indicate that it is an error-processing page, via the
              >directive:
              >
              >
              >
              ><%@ page isErrorPage="true" %>
              >
              >The Throwable object describing the exception may be accessed within
              >the error
              >page via the 'exception' implicit object.
              >
              >
              ><% if (exception != null) { %>
              ><p> An exception was thrown: <b> <%= exception %>
              >
              ><p> With the following stack trace:
              ><pre>
              >
              ><%
              > ByteArrayOutputStream ostr = new ByteArrayOutputStream();
              > exception.printStackTrace(new PrintStream(ostr));
              > out.print(ostr);
              >%>
              ></pre>
              >
              >
              >
              >"Rino Srivastava" <[email protected]> wrote:
              >>
              >>Hello,
              >>
              >>Could someone suggest me the best way to display errors to users when
              >>using JSPs?
              >>
              >>Many thanks in advance.
              >>
              >>Rino
              >
              

  • Need help with Signature on Checks using SAP SCRIPT

    Hi,
    I am looking for some help on how to get the Printer Resident Singature on to the Check using SAP Script. We have a HP Laser 8150 Priter in which the Chip Contains the Signature ( Printer Resident Singaure ) and currentlly the ORACLE application is able to print this signature on the checks. Right now we are in Migration to SAP and we are trying to get this Signature to print on the Check using SAP Script.
    Please help us.

    There are many ways to do this, the simplest way to print the signature is using HEX ENDHEX command.
    1. Print the Printer font list from the printer configuration menu, Find the signature in the font list, next to it there'll be esacape sequence in ASCII and Hex format.
    2. Add the following command in the window of the signature:
    /: HEX TYPE PCL
    /= Enter the Hex escape sequence(begins with 1B) from first step
    /: ENDHEX
    Regards
    Sridhar

Maybe you are looking for

  • Utl file - I need to get new line for each value

    I wrote an utl_file package to generate an html file. It is working fine, however, I am having difficulty formating my output. I like to have values returned one line at a time. For instance, Name:Sam Ok area code: 407 phone: 333-4444 picture: displa

  • Changes to login screen not recognized

    Hi, I wonder if anyone can point me in the right direction. Several months ago a colleague made changes to the standard login screen for Oracle BI Answers. The change was a warning notice about a power outage that would shut down our servers in the f

  • How to enable create folder Icon

    Hi, When I am using the setSaveDialog() method of JFileChooser to select the location, the default directory which appears if no argument is passed is "My Documents". In Windows XP professional edition the create folder icon in this dialog gets disab

  • Changed name by automator now no pictures in iphoto?

    hi everybody, i changed the picture name by automator and i think the link between the pics and iphoto is no more there? what shall i do thanks

  • Is There a Text Tool in Photoshop Elements?

    I have probably overlooked this somewhere, but before purchasing I need to know if you can add text to a photo in Photoshop Elements for Mac. Thanks,