How to add an error message to script?

Hi, every one
I got this script
function paste in place to next master
I want to add an error message to it, if there was no such thing as master B, C,D,E,F,G
instead of system error.
Teetan
var
  myDialog = app.dialogs.add({name:"Copy Selected item(s) to chosen Master",canCancel:true}),
  mStringList = ["Master A", "Master B","Master C", "Master D", "Master E","Master F", "Master G"];
with(myDialog){
  with(dialogColumns.add()){
  staticTexts.add({staticLabel:"Select a Master you want to copy to"});
  with(dialogRows.add()){
  var mySelection = dropdowns.add({stringList:mStringList, selectedIndex:0});
app.doScript('main()', ScriptLanguage.JAVASCRIPT, undefined, UndoModes.FAST_ENTIRE_SCRIPT, "Paste in place");
function main(){
  if (!app.documents.length || !app.selection.length)
  alert( "Nothing selected!" );
  exit();
  if (myDialog.show() == true)
  copy_to_next_master(); 
function copy_to_next_master() { 
var
  mChoice = mySelection.selectedIndex,
  mMsg = "Done.\rWhat you select is pasted in place to next documents - " + mStringList[mChoice],
  nSel = app.selection.length,
  mDone = false,
  i,n,nextDoc,curSel;   
for ( i = 1; i < app.documents.length; i++) {   
  nextDoc = app.documents[i];   
  targetMaster = nextDoc.masterSpreads[mChoice];
  if (!targetMaster.isValid) {
  mMsg += "\rCan't detect " + mStringList[mChoice] + " in a doc: " + nextDoc.name;
  continue;
  mDone = true;
  for ( n = 0; n < nSel; n++ ) { 
  curSel = app.selection[n]; 
  curSel.duplicate( nextDoc.masterSpreads[mChoice] ); 
mDone ? alert(mMsg) : alert("Nothing copied");

Sorry Jarek
I made a big mistake
I want add an error message in to this:
var curSel = app.selection[0]; 
for ( var i = 1; i < app.documents.length; i++) { 
    var nextDoc = app.documents[i]; 
    if (!curSel) { alert( "Nothing selected!" ); exit(); } 
    curSel.duplicate( nextDoc.masterSpreads[1] ); 
in case of I just want to paste in place to only on choice
Teetan

Similar Messages

  • How to add an error message to an Output Type.

    Hello SAPients,
    Using a User Exit I'm modifying the segments of an outbound IDoc. When certain conditions apply I trigger an exception 
    RAISE DATA_NOT_RELEVANT_FOR_SENDING.
    It's ok because the IDoc is not generated and the Output Type is set to "Incorrectly Processed" status.
    But, when the user clicks the "Processing Log" button there is no informatio of the error occurred. How can I add an error message to the Processing Log of the Output Type?
    Thanks in advance for your kind help.

    Hi,
    Try this statement..
          MESSAGE ID      sy-msgid << Your msg class
                  TYPE    sy-msgty << Your message type
                  NUMBER  sy-msgno << Your msg no.
                  WITH    sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4 << Other info
                  RAISING data_not_relevant_for_sending.
    Regards,
    Joy.

  • How to add an error message in the application module?

    Hi,
    I have some code running in the application module. I want to display error messages in the messages section of the screen if an error happens in my code.
    How could I achieve this?
    I am using JDeveloper 10G
    Thanks

    Muhammed,
    Have you tried throwing a JboException in your AM code?
    John

  • How to add custom error message in standard application log of change doc.

    Hi,
    While saving chnage document I need to add raise an error on specific condition. As Error messages is being shown in application log I added custom message in include LCRM_1O_UIF15 by using BAL_LOG_MSG_ADD FM however it is not showing in the screen. What could be the reason? Can anybody please explain?
    Rgds
    Sudhanshu

    Muhammed,
    Have you tried throwing a JboException in your AM code?
    John

  • How to add the error message into Delivery Error Log (VL10A,VL10X)

    Hi,
    I have a to add my custom message into Delivery creation error log (VBFS, VBSS)
    This message should be shown in the Collective process log (VL10X, VL10A).
    Please give me the soln to solve this problem.
    I have searched in SDN, i didnt get the proper solution
    Thanks
    Shankar

    HI,
    Make use of the BADi "LE_SHP_DELIVERY_PROC"
    Use the method DELIVERY_FINAL_CHECK.
    Pass the error messages in table CT_FINCHDEL.
    Regards,
    Ankur Parab

  • How to configure a error message

    Hello,
    I have a User bean that hold informations about a user login ( login and password ). I write a method protected String logon() that search if the login and the password entered by the user match with those stored in a database. If not, i would like to add an error message to the FacesContext and so return null value.
    My question is : how to add an error message to the FacesContext and so to get it in the current page.
    Thanks

    Hi flam70,
    well, in my opinion you should do any access to your business logic in an action class and in the invoke application phase and not in the validation phase.
    Your Action class returns e.g. "success" if the user passed the authentication and "null" if not (if jsf gets null value it returns on the same page back)
    To put the error message into context you may do following:
    In the invoke() Method of your Action class do authentication against your database.
    If it fails, use the component(s) that were wrong for the error message(ids e.g. "username" and "password").
    Add the message into context:
    context.addMessage(nameComponent, new MessageImpl(Message.SEVERITY_INFO, "Username not found !", "LoginError"));
    context.addMessage(passwordComponent, new MessageImpl(Message.SEVERITY_INFO, "Password wrong !", "LoginError"));
    On your jsp page you use the error tag:
    <h:output_errors for="username" />
    <h:output_errors for="password" />
    Greetings,
    Rene

  • How do I resolve error message R6034

    How do I resolve error message R6034 when trying to access itunes

    Go to Control Panel > Add or Remove Programs (Win XP) or Programs and Features (later)
    Remove all of these items in the following order:
    iTunes
    Apple Software Update
    Apple Mobile Device Support (if this won't uninstall move on to the next item)
    Bonjour
    Apple Application Support
    Reboot, download iTunes, then reinstall, either using an account with administrative rights, or right-clicking the downloaded installer and selecting Run as Administrator.
    The uninstall and reinstall process will preserve your iTunes library and settings, but ideally you would back up the library and your other important personal documents and data on a regular basis. See this user tip for a suggested technique.
    Please note:
    Some users may need to follow all the steps in whichever of the following support documents applies to their system. These include some additional manual file and folder deletions not mentioned above.
    HT1925: Removing and Reinstalling iTunes for Windows XP
    HT1923: Removing and reinstalling iTunes for Windows Vista, Windows 7, or Windows 8
    tt2

  • IDOC_INPUT_ORDER - How manage the custom error message ?

    Hello,
    on EXIT_SAPLVEDA_002 and EXIT_SAPLVEDA_003 I done some custom check, (I would show some custom message as a result of these check).
    My question is: How to show these custom message on the standardc idoc spool (WE02) ??
    There's DERRTAB internal table to manage the error, but is not available on there exit ...(EXIT_SAPLVEDA_002 and 3)
    Any idea ??
    thank you

    Hello,
    question is if you want to raise an error, which makes sense only if the document is not posted or just an information message.
    Please consider that you can put messages into the idoc only connected with a status. If you set status 51 thge Idoc is reprocessible, if you set status 53 it is successfully processed.
    In error case you can raise exception USER_ERROR. in exit EXIT_SAPLVEDA_002. Set SY-MSGTY, SY-MSGID, SY-MSGNO, etc before. In exit EXIT_SAPLVEDA_003 you can set changing parameter ok to space. Then SAP will add an error message.
    /Michael

  • How to show custom error message in WebADI Excel template?

    Hi,
    I've  created a custom Web ADI integrator and associated it with a 'Procedure' based custom interface.
    WebADI Interface API Returns is set to  "Error Message".
    I'm using  raise_application_error(-20001, "Actual Error Message") for invalid rows,but custom error message from PL/SQL  is not populated on the excel template.
    Instead it is showing "SQL exception occurred during PL/SQL upload".
    Am I missing anything? How to show custom error message from Pl/SQL procedure to WebADI Excel template?
    TIA
    Narasimha

    The custom API errors are visible in the BNE log but not on the Excel.
    BNE Log=>
    12/10/13 2:52 PM Web ADI Upload Job 13008 ERROR          BnePLSQLUpload.doUpload: Exception while uploading to PL/SQL API.  Error Code: 20001, Message: ORA-20001: -Please enter CONTAINER_ID -  Enter PO_NO -
    ORA-06512: at "APPS.XXPO_COSTFACTS_WEBADI_PKG", line 264
    ORA-06512: at line 1
    12/10/13 2:52 PM Web ADI Upload Job 13008 ERROR          BnePLSQLUpload.doUpload: Stack trace: java.sql.SQLException: ORA-20001: -Please enter CONTAINER_ID -  Enter PO_NO -
    ORA-06512: at "APPS.XXPO_COSTFACTS_WEBADI_PKG", line 264
    ORA-06512: at line 1
      at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:439)
      at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:395)
      at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:802)
      at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:436)
      at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:186)
      at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:521)
      at oracle.jdbc.driver.T4CCallableStatement.doOall8(T4CCallableStatement.java:202)
      at oracle.jdbc.driver.T4CCallableStatement.executeForRows(T4CCallableStatement.java:1005)
      at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1307)
      at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3449)
      at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3550)
      at oracle.jdbc.driver.OracleCallableStatement.execute(OracleCallableStatement.java:4710)
      at oracle.jdbc.driver.OraclePreparedStatementWrapper.execute(OraclePreparedStatementWrapper.java:1374)
      at oracle.apps.bne.integrator.upload.BnePLSQLUpload.doUpload(BnePLSQLUpload.java:284)
      at oracle.apps.bne.integrator.upload.BneSAXUploader.processDeepestLevel(BneSAXUploader.java:2346)
      at oracle.apps.bne.integrator.upload.BneSAXUploader.startElement(BneSAXUploader.java:1182)
      at oracle.xml.parser.v2.XMLContentHandler.startElement(XMLContentHandler.java:181)
      at oracle.xml.parser.v2.NonValidatingParser.parseElement(NonValidatingParser.java:1288)
      at oracle.xml.parser.v2.NonValidatingParser.parseRootElement(NonValidatingParser.java:336)
      at oracle.xml.parser.v2.NonValidatingParser.parseDocument(NonValidatingParser.java:303)
      at oracle.xml.parser.v2.XMLParser.parse(XMLParser.java:234)
      at oracle.apps.bne.integrator.upload.BneUploader.processUpload(BneUploader.java:301)
      at oracle.apps.bne.integrator.upload.BneAbstractUploader.processUpload(BneAbstractUploader.java:114)
      at oracle.apps.bne.integrator.upload.async.BneAsyncUploadThread.run(BneAsyncUploadThread.java:140)
    12/10/13 2:52 PM AJPRequestHandler-HTTPThreadGroup-5 WARNING        BneOracleWebAppsContext.getTimeZone CLIENT_TIMEZONE_ID has not been set
    12/10/13 2:52 PM AJPRequestHandler-HTTPThreadGroup-5 ERROR          BneOracleWebAppsContext.getExtraJDBCConnection recieved the same connection as the base connection.  There may be transaction problems.
    How to show the same error in the excel template?
    Here is the package:
    CREATE OR REPLACE PACKAGE BODY APPS.XXPO_COSTFACTS_WEBADI_PKG
    AS
       PROCEDURE upload_data (
                              P_CONTAINER_ID IN VARCHAR2
                            , P_SAIL_DATE IN DATE
                            , P_PO_NO IN VARCHAR2                     
                             ) IS
        --declare
        lv_err_msg      VARCHAR2(240);
        lf_err_flag     NUMBER := 0;
        ln_temp         NUMBER;
        BEGIN
        --------------------- checking for mandatory parameters---------------------------
          IF (P_CONTAINER_ID IS NULL) THEN
             lf_err_flag := 1;
             lv_err_msg := lv_err_msg||'-'||'Please enter CONTAINER_ID - ';
          END IF;
          -------------Validation for Sail Date Format----------------------
          IF (P_SAIL_DATE IS NULL) THEN
             lf_err_flag := 1;
             lv_err_msg := lv_err_msg || ' ' || 'Enter Sail Date - ';
          ELSE
             BEGIN
                SELECT 1
                  INTO ln_temp
                  FROM DUAL
                 WHERE P_SAIL_DATE =  TO_DATE (TO_CHAR (P_SAIL_DATE, 'DD-MON-YYYY'), 'DD-MM-YYYY');
             EXCEPTION
                WHEN NO_DATA_FOUND THEN
                   lf_err_flag := 1;
                   lv_err_msg := lv_err_msg || ' Enter Sail date in DD-MON-YYYY Format';
                WHEN OTHERS THEN
                   lf_err_flag := 1;
                   lv_err_msg := lv_err_msg || ' Enter Sail date in DD-MON-YYYY Format'|| SQLERRM;
             END;
          END IF;
          -------------Validation for PO_Number----------------------
          IF (P_PO_NO IS NULL) THEN
             lf_err_flag := 1;
             lv_err_msg := lv_err_msg || ' ' || 'Enter PO_NO - ';
          ELSE
             BEGIN
                SELECT count(1)
                  INTO ln_temp
                  FROM PO_HEADERS
                 WHERE Attribute4 =  P_PO_NO;
             EXCEPTION
                WHEN NO_DATA_FOUND THEN
                   lf_err_flag := 1;
                   lv_err_msg := lv_err_msg || ' No Oracle PO for Biceps PO#'||P_PO_NO;
                WHEN OTHERS THEN
                   lf_err_flag := 1;
                   lv_err_msg := lv_err_msg || ' Error getting the Oracle PO for Bicpes PO#'||P_PO_NO||' Error-' || SQLERRM;
             END;
          END IF;
         -----------------------Insert Record----------------------------
         IF lv_err_msg is NULL THEN
         BEGIN
             INSERT
              INTO XXP2P_HW_COST_FACTORS_STG
                     CONTAINER_ID
                    ,SAIL_DATE
                    ,PO_NO
                    , ERROR_FLAG
                    , ERROR_MSG
                   ,CREATED_BY
                    ,CREATION_DATE
                    ,LAST_UPDATED_BY
                    ,LAST_UPDATE_DATE
                    ,LAST_UPDATE_LOGIN              
                VALUES
                     P_CONTAINER_ID
                    ,P_SAIL_DATE
                    ,P_PO_NO              
                    ,lf_err_flag
                    ,lv_err_msg
                  ,FND_GLOBAL.USER_ID
                    , trunc (sysdate)
                    ,FND_GLOBAL.USER_ID
                    , trunc (sysdate)
                    ,FND_GLOBAL.LOGIN_ID              
                  --  commit;
                  DBMS_OUTPUT.put_line
                    '-' || 'After ap_invoices_interface'
            EXCEPTION
            WHEN OTHERS THEN
              ROLLBACK;
              lf_err_flag := 1;
              lv_err_msg  := lv_err_msg || ' ' || 'error loading CONTAINER_ID-' || P_CONTAINER_ID || SQLERRM;
              raise_application_error(-20001, lv_err_msg);
            END;
        ELSE
              raise_application_error(-20001, lv_err_msg);
        END IF;
      END upload_data;                        
    END XXPO_COSTFACTS_WEBADI_PKG;

  • How to customize the error messages in web analysis reports

    Does anyone know how to customize the error messages that web analysis shows ,
    I want to customize the below error message with a custom error message
    "Document does not exist or no authorization to open document.Error occurred while loading document"
    Does anyone know how to do this ?

    Rajesh,
    you may want to check these links
    How to the Change the Application Stopped Message
    How to Change the Dispatcher Running, No Server Connected Message
    http://help.sap.com/saphelp_nw70/helpdata/en/65/18fc3f9ec4e669e10000000a155106/frameset.htm
    Thanks
    Bala Duvvuri

  • How can we trigger error message in BADI PARTNER_UPDATE

    Hi All,
    I have implemented a BADI PARTNER_UPDATE. In this I have validation ( Error Message ) on saving buisness partner.
    It is giving the error message but it freeze all the fields. On pressing enter it goes for short dump.
    In short dump it gives error The COMMIT WORK processing must not be interrupted.
    Kindly suggest me that how can we pass error message and it also does not freeze the fields.
    Regards,
    Narendra Goyal

    Hi Narendra,
                          How are you trying to display message.
    Is it using message service class instance of message statement (which should not be used, as that is for GUI messages) or using collect FM or by adding to genil message class container.
      Please try different approaches and see what works for you.
    Thanks,
    Rohit

  • How to fix this error message The backup disk image "/Volumes/AirPort Disk/FARES DEL VALLE's iMac.sparsebundle" could not be accessed (error -1).

    how to fix this error message The backup disk image “/Volumes/AirPort Disk/FARES DEL VALLE’s iMac.sparsebundle” could not be accessed (error -1).

    The troubleshooting C17 is the specific article.
    http://pondini.org/TM/Troubleshooting.html
    This is generally a Lion error.. and you will need 5.6 utility to get access to the disk area.
    So download the real utility. Run it instead of v6 toy version.
    http://support.apple.com/kb/DL1482
    Go to the manual setup, disk page and click on disconnect all users.. that will unmount all users connected to the disk and allow it to start working. But there are a number of other issues that are possible cause. Pondini lists some of them.

  • While downloading add-ons error message - unable to download . want ad blocker urgently

    while installing add-ons error message appears
    " theree was an error downloading ...."
    This happened will all addons i tried within 2-3 seconds of clicking on install

    Check to see if installations are allowed in Firefox
    *Go to <code>about:config</code> like you were going to a website
    *Press the button saying you'll be careful
    *Search for <code>xpinstall.enabled</code>
    *The value of <code>xpinstall.enabled</code> should bet set to TRUE. If it's FALSE, right click it and select Reset.
    What exact error is it giving you?<br>
    Try these fixes from this article
    *https://support.mozilla.org/en-US/kb/unable-install-add-ons-or-extensions

  • How to populate a Error message in WebUI Screen

    Dear Experts,
    I have a small issue in Lead creation screen. I need to restrict the followup document if the lead end date is lesser than the system date, if the end date lesser than the system date system should through a error message in web Ui Screen and the lead follow up creation should be stoped.
    We found an enhancement spot in backend(GUI) of lead creation we raised the error message in the backend screen. Here its working fine, But we are not able to get any error message in WebUI lead creation screen.
    We written the code in CREATE_ORDER Method of lead creation in GUI ( tcode : CRMD_ORDER). We tried to debug the program using external debuger from webui but its not getting triggered.
    Pls suggest me, how to raise a error message for WEBUI lead follow up creation validation.
    Kindly do the needful.
    Reg,
    Anandhan

    HI Anandhan,
    Try this way,
    This should work.
    lr_global_messages type ref to cl_crm_genil_global_mess_cont,
            lr_core                 type ref to cl_crm_bol_core,
      "Instantiate the error message class.
      lr_core = cl_crm_bol_core=>get_instance( ).
      if lr_core is bound.
        lr_global_messages ?= lr_core->get_global_message_cont( ).
      endif.
            if lr_global_messages is bound.
              call method lr_global_messages->add_message
                exporting
                  iv_msg_type       = lv_msg_type
                  iv_msg_id         = '
                  iv_msg_number     =
                  iv_show_only_once = 'X'
                  iv_msg_v1         =
                  iv_msg_v2         =
            endif.

  • How to display an error message after validation in Formatted Search?

    Hi SBO experts,
    if an error is detected on validation in a Formatted Search, how to display an error message to the user entering the data?
    Thanks & Regards,
    Raghu Iyer

    i created a formatted search query & attached it to the field 'Quantity' at Line Item level in Sales Order screen. just for testing purpose, i eneterd the following code lines in the query validating 'Quantity'
    if $[$38.11.0] > 50
    begin
    select @error = 1
    select @error_message = 'Vendor code cannot begin to X sign.'
    end
    the system throws the error : Internal error (8180) occurred [Message 131-183]
    actually, i need to display an error message to the user if Quantity is not in multiples of the OITM.SalFactor2
    if $[$38.11.0] % (SELECT T0.[SalFactor2] FROM OITM T0 WHERE T0.[ItemCode]  = $[$38.1.0]) > 0
    begin
    select @error = 1
    select @error_message = 'Error in Quantity.'
    end
    but, this expression to get the remainder itself seems to have some error
    $[$38.11.0] % (SELECT T0.[SalFactor2] FROM OITM T0 WHERE T0.[ItemCode]  = $[$38.1.0])
    i guess, % operator is used for modulo (to find the remainder of one number divided by another.) ? am i right ?
    Regards,
    Raghu Iyer

Maybe you are looking for

  • Ejecting iphone causes Windows Explorer to crash

    Hi Guys After I've synced my iphone in itunes when I eject or remove the iphone from the dock Windows Explorer always "crashes", well it restarts and windows says there has been a problem. I've got the latest updates for both iphone and itunes. i had

  • Border on selected rectangle?

    I have a document that will have allot of rectangles in it. I would like to only select one, and put a border on that. I can get the script to work the border/stroke. but I can't figure out how to get it to use the rectangleI have selected. I've trie

  • Page down - how can I test it?

    My page has been taken down due to bandwidth excess, but I'd like to test run it so that it`s ready for uploading when the time comes. I want to ccheck that the links work, etc. Sort of like an offline version of it, but just like it would work when

  • Can you access Time Capsule From any where, or do you have to be on the same network

    Can you access Time Capsule From any where, or do you have to be on the same network

  • Itunes quits when I try to update

    My Itunes quits everytime I try to copy a song from my library to my IPod Nano. This did not happen prior to downloading the most recent version of itunes and updating my ipod with the latest updates. I have uninstalled and reinstalled the software..