If condition exit program

i want the user to input two dates, start and end date, in the format (MM/DD/YYYY) how can i add validation so that
if end date < start date then exit program
here's a sample
set verify off
accept start prompt 'Enter start time'
accept end prompt 'Enter end time'
if '&end' < '&start' then
exit program;
update table set start_date = '&start', end_date = '&end';
exit;
/

In case of emailing, there is no need to post in forums.
Coming to your case, I see three possibilites. First As stevencallen suggested, you could easily handle in the update statement itself in the case you presented.
As you said, you want to know how to exit the program as such, you have two options.
One, as Chen Shapira suggested, via exception handling, which is another good option of handling user defined exceptions.
Another, use RETURN keyword and handle your case as well as various other scenarios in which it is applied.
Any more doubts, please post your requirements completely, so that there is least chance to assume for us and to suggest appriopriately.

Similar Messages

  • How to use subroutine in user-exit program

    Hi Experts,
        I have a requirement in user-exit where i have to use some lines of code in several times. So i want to use Perform and perform inside the exit (i.e. Include ZXXX). But it is not recognizing the form part of the ubroutime and gives error.
                 Please let me know how to use the Perform and form statement in the exit or is there any way to  write repeated code once but used no of times in exit program.
    Thanks
    Ajit

    I'm sorry, I was overly harsh there. Please accept my apologies.  But I do despair sometime!
    Consider the structure of a function group and it should be clear - you need to remember that INCLUDES are just repositories of code. If you take the contents out of the include and put them into the main program, then this is what you get:
    function-pool xrsr.        
    * Global data definition.
    function exit_saplrrs0_001.
    * the source code within the zxrsru01 include.
    endfunction.
    Now, what you're trying to do, is create a form in your include. You can't do that, because you end up with:
    function-pool xrsr.        
    * Global data definition.
    function exit_saplrrs0_001.
      perform xyz.
      form xyz.
      endform.
    endfunction.
    And you can't have a FORM defined inside a function module definition. The solution is to put it outside the function module. If you follow the process suggested above, you end up with
    function-pool xrsr.        
    * Global data definition.
    function exit_saplrrs0_001.
      perform xyz.
    endfunction.
    form xyz. " This will be in LXRSRF01
    endform.
    Do you see how it works now?

  • How to use upload condition record program RV14BTCI

    Hi
    how to use upload condition record program RV14BTCI.
    kathir.

    Hi,
    To run this program we have to maintain Upload file in Application Directory,
    We have to maintain 3 levels of records in that file.. my feel you upload through BDC or LSMW.
    For your information,
    The batch input program RV14BTCI reads the parameters is necessary
    Giving sequential file and creates (depending on the data
    In the file seq) one or more batch input sessions.
    The data are seq file in the following structure expected:
    - The session a session intent (Table KOBTCI, Record 0)
    All other records until the next session, the intent
    Last session assigned to read
    - The head condition Sentence (Table KOBTCI, record 1)
    All other records until the next condition,
    Last read head appropriate rate
    This includes the corresponding condition
    Condition table
    - The key sentence of a Main (Table KOBTCI, record 2)
    It must be directly on the head set to follow
    It contains the key condition of the table
    + Detail fields
    - The season record has a subordinate clause (Table KOBTCI, record 3)
    The teams relate to the key sentence in the main
    Best Regards,
    KSK

  • Firefox will not connect to internet after upgrade. The window pops up but shows "connecting " in tab. And then it sit there. Close it down and then try to reopen it and get message " Firefox already running, Exit program or shut down computer" ???

    Firefox will not connect to internet after upgrade. The window pops up but shows "connecting " in tab. And then it sit there. Close it down and then try to reopen it and get message " Firefox already running, Exit program or shut down computer" ?????????????????

    1st problem see http://kb.mozillazine.org/Firewalls
    2nd problem, to close Firefox properly use File > Exit
    :not with the [x] in upper right corner which close window
    :see http://kb.mozillazine.org/Firefox_hangs#Hang_at_exit
    :if restarting use "Restartless Restart" extension as mentioned there.
    <br><small>Please mark "Solved" one answer that will best help others with a similar problem -- hope this was it.</small>

  • User Exit Program works Differently

    I'm trying to sync user info from HCM system to a destination system. There is a limitation in SAP HCM system, which allows only full load and not incrememental load or sync up based on events(New Joinee, Position change, Employee Exit) to happen from source to destination. So, I thought User exit could fix this issue.
    When a person inserts or changes or changes the status of an employee to quit through PA30 and saves it, the user exit program should pass the personnel number (numbers) of the user(s) as input to the report RPLDAP_EXTRACT_IDM.
    I am trying to trigger a report(RPLDAP_EXTRACT_IDM) which exports the data from HCM to a destination system(IDM) with the help of a user exit program. Using PA30 when I change the user info and when I save it, through User exit program I'm passing the personnel number of the user(whose data has been changed) as an input to the report, which inturn will replicate the change to the destination.
    Problem:
                User Exit works differently here. After configuring User exit for this tcode(PA30), once I change a user's info and click save, without saving the data, it triggers the User exit program. Usaully while chanign user info, when I click 'SAVE', i get a message 'Recod changed', but now after sonfiguring User Exit program, since the program runs immediately as soon as i click SAVE, I see the following message' Successfully exported Data to the destination' . And the change that i make is not reflected.
    Shouldn't the User Exit program be triggerred after the data is saved?
    Is there a way where I can trigger the User Exit Program after saving the record.

    Not an ABAP expert, but I remember hearing something about PAI and PBO modules and separate user exit includes depending on where you are executing it. Is it worth investigating on these lines?
    Also is it worthwhile configuring Change Pointers to capture whether a change has been made instead of coding user exits in PA30. You could code uxerexits in the ALE data transfer program to analyse the data based on change pointers and transfer data pertaining to New Joinees etc.
    Again I am not ALE epxert, I am just giving my views For what they are worth. For better results perhaps you should post in ABAP forum.

  • Conditional Exit from the script

    Hi,
    I have to code the script like the below
    --Step 1
    begin
    If <Table1 doesnot exist> then
    Display "User Defined Error Message: Table1 doesnot exit"
    EXIT FROM THE SCRIPT(Below sql should not run)
    endif
    end
    --Step 2
    spool abc.txt;
    select "should not run" from Table1;
    spool off;Step 2 should not run if table1 doesnot exist.
    Can someone please tell how to conditionally exit the script.
    Thanks & Regards,C
    CDPrasad
    Edited by: cdprasad on Aug 12, 2010 1:35 PM
    Edited by: cdprasad on Aug 12, 2010 1:36 PM
    Edited by: cdprasad on Aug 12, 2010 1:38 PM
    Edited by: cdprasad on Aug 12, 2010 1:38 PM

    Hi,
    David is right; SQL*Plus is the wrong tool for this job.
    If you really want to to this in SQL*Plus, you can achieve a crude type of branching by using sub-sripts. Instead of an IF statement, you use START or @ to run one or another of those sub-scripts, based on a substitution variable, which in turn is set by a query.
    For example:
    --     abc.sql - Test if table1 exists, and
    --                     (1) if it exists, run abc_query.sql to do a query
    --                     (2) if it does not exist, run abc_error.sql to display an error message
    --     Preliminary query, to define next_script:
    COLUMN     next_script_col        NEW_VALUE next_script
    SELECT     CASE      COUNT (*)
             WHEN  0  THEN  'abc_error'
                       ELSE  'abc_query'
         END     AS next_script_col
    FROM     all_tables
    WHERE     table_name     = 'TABLE1'
    AND     owner          = 'SCOTT'
    --     Now that we know what to do, do it:
    @&next_scriptYou would run the above script (abc.sql) and it would decide whether to run the script containing you query, or the script that prints an error message.
    Why does table1 sometimes disappear? In a good database design, tables are permanent structures, and get dropped only when they are obsolete. Perhaps you should be TRUNCATing the table, not dropping it.

  • Why wont the button on my trak pall set to close/exit programs close/exit Firefox 7.0.1?

    I have a Microsoft track ball the 5 customizable buttons.
    The the regular right and left buttons are the default right and left click.
    The outer left button is programed to do the "Enter" function.
    The wheel button is programmed to do the "Back" action.
    The outer right button is programed to "Close/Exit" programs. I have this one set up this was because I do not like tabbed browsing and it makes it easy to close multiple browser windows.
    I just installed 7.0.1, and now the ONLY program that will not close on my system when I press the outer right button is Firefox.
    Can you explain why this is happening?

    Firefox 8 will be released in a few days, that I believe includes fixes for the connections number on Windows, and a problem related to the bookmarks database.
    * meanwhile it may be worth trying the fix from this blog: http://blog.bonardo.net/2011/09/30/is-your-firefor-freezing-at-regular-intervals
    * a more speculative and unofficial suggestion is to adjust the preference ''browser.sessionstore.interval'' as suggested by ''[/questions/767246?page=2#answer-270794 frankal]'' based on http://www.techmynd.com/firefox-freezes-for-a-moment-after-every-10-sec-fix/ <br/>(In my opinion unlikely to do any harm, and easily reversible so worth a try)
    Another suggestion, not as a workaround, but as a means of demonstrating part of the cause is to use the error console to log CC & GC collections. The procedure for changing the preference is as above.
    [http://blog.mozilla.com/nnethercote/2011/10/26/memshrink-progress-week-19/ If you turn on javascript.options.mem.log in about:config you can see when GCs and CCs occur and how long they take, which is helpful for diagnosis.]
    No need to leave that on for long, just look for collections exceeding a second i.e. >1000ms if you see that you have a problem.

  • Force some statements when exiting program

    Hello,
    I have created a class,
    I want that when the program exits,
    it should have a code that will be done before the program exits.
    The following is for initialization :
    public class myClass {
    Static {
    ... do something
    // what should I put here for finalization ?
    Thanks :)

    addShutdownHook doesn't work for some conditions
    (it seems to be work for simple pure java)
    If I do :
    JOptionPane.showMessageDialog ... - doesn't work
    System.out.println ... - work !!!
    Thanks :)A quote from one of the references found by the following search
    Because shutdown hooks run as threads, you must use thread-safe programming techniques. Otherwise you risk having threads interfere with each other. Also, it's wise to design your application for simple and fast shutdown processing. For example, you might run into trouble if your application uses services during shutdown that are themselves in the processing of being shut down.
    http://www.google.com/search?q=java%2bshutdown%2bhook

  • Using JOptionPane to exit program & Using toString method

    Hello,
    In my program I have to use a toString method below
    public String toString(Hw1NCBEmployee[] e)
            String returnMe = String.format(getStoreName() + "\n" + getStoreAddress() + "\n" + getCityState() +  "\nYou have " + getEmpCount() + "employee(s)");
            return returnMe;
    }Now, at first, when I initially tested my code, it was working just fine, printing out the right way
    Point is -- now that Im practically finished with my program, and am going back and running it - calling the toString method gives me the address rather than the information . . . Can anyone help me with this issue??
    Also, Im using JOptionPane to display everything, but -- at first, it worked fine, then (around the same time I started having the above problem) it stopped exiting the do-while loop:
    while(go)
                 int option = JOptionPane.showConfirmDialog(null, "Do you want to enter employee information?", "Welcome!", JOptionPane.YES_NO_OPTION);
                     if(option == JOptionPane.NO_OPTION)
                        go = false;  //exit loop
            

    ncjb wrote:
    well, for the toString - I have to print out the info inside the array -- am I right in thinking that the only way to do this is to pass in the array ??If the array is part of the class then there is no need to pass it as a parameter. If it is being passed in from outside the class then I have to question your design. Why should class X being formatting data that is not a representation of itself?
    and i have 2 other files that go with this program . . . I just want to know if there is a way to make sure that when the user presses the NO option, it will exit the loop -- the piece of code you see if apart of an entire method (not long) -- do you want me to include this??You read that link I provided REAL quick!

  • Itunes 7.1.1 Upgrade / Exiting Program Shows ERROR message

    I installed itunes 7.1.1. Afterwards when I close itunes I get an error message saying the the program encountered a problem and needs to close down. I have two options at this point debug or send an error report to Microsoft. Have done both but it still continues to do this using file exit at Main menu or "X" at right top of screen??? How do I fix this??? Is anyone else experiencing this problem???
    Dell XPS   Windows XP  
    Dell XPS   Windows XP  

    I'm having the exact same problem. No matter how many times I uninstall and reinstall, same issue!

  • Exiting program after text file is created

    i want to close labview using the exit.vi after the text file is created....also i am using c++ to execute the labview application is there anyway to make sure labview finishes its routine in c++ before i send the text file to a motion controler
    the c++ routine to open the exe is
    int main()
      system("start C:\\greg\\g.exe");
      return 0;
    then the digital i/o command woudl execute
    anyone know what i can do before sending a digital line to tell the motion control software to pick up the text file?
    thanks
    Attachments:
    program to exe.vi ‏113 KB

    Given the amount of time it takes for LV to launch, you would probibly get better response time if you let the LV code run in a loop watching a predefined "input" directory for new files to process, and writing its results to a predefined "output" directory. The code that uses the text files would likewise sit in a loop waiting for a new text file to appear. (BTW: what will that other piece of code be written in?)
    Alternately, if you don't like the idea of polling a directory, make the main LV application event-driven with a user event that performs the processing. Then create a small VI that you run from your C++ code that simply fires that user event.
    Finally, given all the limitations of C++ perhaps the most straightforward solution might be to write the whole application in LV?
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • Exit program after new-page

    Hi,
    What could be wrong with folowing code (part of longer program) :
    FORM print_id.
      DATA: valid TYPE c,
            params LIKE pri_params.
         CALL FUNCTION 'GET_PRINT_PARAMETERS'
          EXPORTING
            destination = 'LOCL'
            immediately = 'X' "<<< add this line - immediate print
            new_list_id = 'X' "<<< add this line - new spool request
         IMPORTING
          out_parameters = params
          valid = valid.
         IF valid <> space.
          NEW-PAGE PRINT ON PARAMETERS PARAMS NO DIALOG.
           WRITE: 'dsds'.
        ENDIF.
    ENDFORM.
    I result its print a page with 'dsds' text on pritner but then program exit to main sap menu with no any error message.
    when I use:
    NEW-PAGE.
    instead of:
    NEW-PAGE PRINT ON PARAMETERS PARAMS NO DIALOG.
    new page report is display on screen with text 'dsds' but no exit occurs.

    self-solved
    I added:
    NEW-PAGE PRINT OFF.
    at the end of form and it helps.
    Without that line after executing a form, controls goes back to other screen that should ('previuos ?')

  • Close document without exiting program

    In Dreamweaver 6, before I got a new computer, I could close
    a document window and the program would go back to a blank New
    Document screen. Now the entire program closes, and I can't find
    how to close a document without exiting the program. Does anyone
    know how to do this?
    Thanks!

    PREFERENCES | General > Show Welcome Screen
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    ==================
    "JoelW" <[email protected]> wrote in message
    news:g1el7u$e7t$[email protected]..
    > In Dreamweaver 6, before I got a new computer, I could
    close a document
    > window
    > and the program would go back to a blank New Document
    screen. Now the
    > entire
    > program closes, and I can't find how to close a document
    without exiting
    > the
    > program. Does anyone know how to do this?
    >
    > Thanks!
    >

  • Exiting programs that have use the fullscreen exclusive mode

    I have lots of problems, this is one of them:
    When making a program that uses fullscreen mode, the program does not exit by itself when it comes to the end of the program. In fact the only way I can get it to exit is through System.exit(0);
    And I don't want to use that for numerous reasons.
    try
    gd.setFullScreenWindow(jw);
    gd.setDisplayMode(dm[theDisplayMode]);
    finally
    gd.setDisplayMode(oldDisplayMode);
    gd.setFullScreenWindow(null);
    end of program......
              }

    I have lots of problems, this is one of them:
    When making a program that uses fullscreen mode, the program does not exit by itself when it comes to the end of the program. In fact the only way I can get it to exit is through System.exit(0);
    And I don't want to use that for numerous reasons.
    try
    gd.setFullScreenWindow(jw);
    gd.setDisplayMode(dm[theDisplayMode]);
    finally
    gd.setDisplayMode(oldDisplayMode);
    gd.setFullScreenWindow(null);
    end of program......
              }

  • Unable to exit program from menu

    Hi,
    I have written a test program to experiment and learn about some codes.
    Been using Sun Java Studio Enterprise 8.1
    Designed the interface and added a menu.
    It is supposed to exit the program from the File > Exit menu path.
    For some reason, the program doesn't seem to exit.
    I can't figure out what's wrong with it.
    Appreciate advice.
    The program exit code used was "System.exit(0)"
    Code snippets below.
    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    jMenuItem1.setText("Exit");
    jMenuItem1.addMouseListener(new java.awt.event.MouseAdapter()
    public void mouseClicked(java.awt.event.MouseEvent evt)
    jMenuItem1MouseClicked(evt);
    private void jMenuItem1MouseClicked(java.awt.event.MouseEvent evt)
    System.exit(0);
    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    Again, thanks for advice and your time.

    However, with this comes another question.
    What's so different between the mouselistener and the
    actionperformed method such that the mouselistener
    didn't work. I guess I will have to find out more for
    myself.ActionListener are triggered by ActionEvents - whenever a component is "used" - byy keyboard or mouse or whatever. MouseListeners just creact on mouse events. Why they didn't work in your case I don't know though.

Maybe you are looking for