How to Write a trigger to hold session data

Hi Everyone,
There are 4 Weblogic Servers which are connected to the database concurrently. In the database I have Application Users table "USERS". When a user is logged to the application let us say userA(from "USERS" table) is logged into the application, whenever that same userA logged into the application from other Weblogic server(other system) it should not allow to login into the application. Is it possible to write a trigger for this. If possible, Can any body suggest how to write a trigger to hold that UserA data into one temporary table as long as that userA is active and removes the data from temporary table when userA logged off (OR) as well as that Weblogic server is goes down.
Thanks in advance.

Hi Justin,
First Thank you very much to all of you.
1. Yes Application Users are authenticated only once,
that to at the time of login to the Application.
2. We are not running any script that informing the
message like "connections
from the downed server should be reset". Do you
you think is it suggestable.
It's not mandatory to use triggers only.Can we
achieve this by maintaining any temporary table.
I have one idea is that, Lets create a table name
e "App_Users_Session_Data(User_Id,Is_Active)"
If "User A" logins into the application then User_Id
= 1A and Is_Active = 'T' will be entered
automatically into the table
"App_Users_Session_Data". When same "UserA" logins
from other Weblogic Server then Application first
check this table and informing that "UserA" already
logins and is active.
Whenever "UserA" loggsoff then this entry will be
automatically deleted.
My doubt is "UserA" logins successfully into the
application and corresponding user entry is there in
"App_Users_Session_Data". If Weblogic Server goes
down from where this UserA logins, This entry will
not be deleted. If this entry is still there then the
same UserA should not login into the application from
the same Weblogic server(which is up again). My doubt
is how to remove this entry automatically when
Weblogic server goes down. Can we achieve this by any
other way. If possible can u give some guidelines
thats enough for me.
Thank you everyone
SankarHi,
First off all and as I undeerstood you can change your application.
1- A table say weblogic_servers have to be created:
Several scenarios are possibles. If you want you can have a row per weblogic server in this table with what you want as identifier. Any way this table can have a column (sid for example) which identifies the weblogic database session. This can be managed by logon and logoff triggers for the related database user. The logoff trigger for example deletes all lines in App_users_Sessions_Data (see below) related to the same session as the weblogic server and puts the session sid in weblogic_servers to NULL.
2- Change the table App_Users_Session_Data:
You have to add a column (sid for example) linking the app user to the database session of the weblogic server. When a user connects, you can check if the databse session is always there and decide accordingly.
A good idea in my opinion is to centralize your logic by putting it in an INSERT trigger on App_Users_Session_Data.

Similar Messages

  • HOW TO CREATE A TRIGGER TO UPDATE A DATE FIELD WHEN RECORD IS MODIFIED

    Hi,
    I have a field (column)
    SalesLeadLastModifiedDate
    in the table
    SalesPipeline
    A record's field (SalesLEadLastModifiedDate) should be updated with current date and time every time any column in a record is modified. I'm new to SQL and can't figure out how to write this trigger. Could someone help me and also
    refer literature that would give me independence? Online MSDN language without matching examples is not helping.
    Tnx.,
    IJ

    Break it down into pieces.  Write a small script that updates some small (but more than 1) number of rows.  After updating the rows, write another update statement that will set your modified date column to the current date and time.  Once
    you have that working, you can easily convert that into a trigger.  Pseudo-code would be:
    begin tran;
    select * from dbo.SalesPipeline where SalesPipelineID in (45, 76);
    update dbo.SalesPipeline set <some column> = <something> where SalesPipelineID in (45, 76);
    update dbo.SalesPipeline set <your date colum> = ?? where SalesPipelineID in (45, 76);
    select * from dbo.SalesPipeline where SalesPipelineID in (45, 76);
    rollback tran;
    Notice the transaction control statements.  This will allow you to run the script, evaluate the result, and then revert all changes (leaving your database unchanged).  In turn, this will allow you to run the same script over and over and over again
    and achieve (for the most part) the same results with each execution.  You can search the forums for examples of trigger code - just beware that many "solutions" are not necessarily well-written.

  • How to write a sql query to retrieve data entered in the past 2 weeks

    Hi,
    I have file names and last accessed date(java.sql.Date format) stored in my database table, I would like to know how I can write a query to get the name of files accessed in the past 2 weeks,I use open sql server at the back end.
    Thanks in advance.

    This has essentially nothing to do with JDBC. JDBC is just an API to execute the SQL language using Java and thus interact with the databases.
    Your problem is related to the SQL language, you don't know how to write the SQL language. I suggest you to go through a SQL tutorial (there is one at w3schools.com) and to read the SQL documentation which come along with the database in question. A decent database manfacturer has a website and probably also a discussion forum / mailinglist as well.
    I'll give you a hint: you can just use equality operators in SQL like everywhere. For example: "WHERE date < somedate".

  • How to write bdc programme to load the data in table control

    Hi
    i have to write a bdc programme and the data to be filled in table control fileds can any one help me with the code how i have to write it is for cs02 tcode
    thanks and regards
    naveen

    Hi Naveen,
    See the sample code
      PERFORM bdc_dynpro      USING 'SAPLCSDI' '0100'.
      PERFORM bdc_field       USING 'BDC_CURSOR'
                                    'RC29N-DATUV'.
      PERFORM bdc_field       USING 'BDC_OKCODE'
                                    '=KALL'.
      PERFORM bdc_field       USING 'RC29N-MATNR'
                                    w_matnr.
      PERFORM bdc_field       USING 'RC29N-WERKS'
                                   w_werks.
      PERFORM bdc_field       USING 'RC29N-STLAN'
                                    '1'.
      PERFORM bdc_field       USING 'RC29N-DATUV'
                                    '01/01/2004'.
      PERFORM bdc_dynpro      USING 'SAPLCSDI' '2110'.
      PERFORM bdc_field       USING 'BDC_OKCODE'
                                    '=FCPU'.
      PERFORM bdc_field       USING 'BDC_CURSOR'
                                    'RC29K-BMENG'.
      PERFORM bdc_field       USING 'RC29K-BMENG'
                                    w_testuph.
      PERFORM bdc_dynpro      USING 'SAPLCSDI' '0150'.
      PERFORM bdc_field       USING 'BDC_CURSOR'
                                    'RC29P-MENGE(02)'.
      PERFORM bdc_field       USING 'BDC_OKCODE'
                                    '=FCBU'.
      PERFORM bdc_field       USING 'RC29P-MENGE(01)'
                                    w_testuph.
    "For raw material.
      IF NOT w_raw_mat_fg IS INITIAL.
        PERFORM bdc_field       USING 'RC29P-MENGE(02)'
                                   w_testuph.
      ENDIF.
      PERFORM bdc_dynpro      USING 'SAPLCSDI' '0130'.
      PERFORM bdc_field       USING 'BDC_OKCODE'
                                    '/00'.
      PERFORM bdc_field       USING 'BDC_CURSOR'
                                    'RC29P-POSNR'.
      PERFORM bdc_dynpro      USING 'SAPLCSDI' '0131'.
      PERFORM bdc_field       USING 'BDC_OKCODE'
                                    '/00'.
      PERFORM bdc_field       USING 'BDC_CURSOR'
                                    'RC29P-POTX1'.
      PERFORM bdc_dynpro      USING 'SAPLCSDI' '0130'.
      PERFORM bdc_field       USING 'BDC_OKCODE'
                                    '/00'.
      PERFORM bdc_field       USING 'BDC_CURSOR'
                                    'RC29P-POSNR'.
      PERFORM bdc_dynpro      USING 'SAPLCSDI' '0131'.
      PERFORM bdc_field       USING 'BDC_OKCODE'
                                    '/00'.
      PERFORM bdc_field       USING 'BDC_CURSOR'
                                    'RC29P-POTX1'.
      PERFORM bdc_dynpro      USING 'SAPLCSDI' '0150'.
      CALL TRANSACTION 'CS02' USING bdcdata MODE w_display_mode UPDATE 'S'
                 MESSAGES INTO t_message_tab.
    Prabhudas

  • How to write a procedure to load the data into a table using xml file as input to the procedure?

    Hi,
    Iam new to the xml,
    can u please anyone help me how to write procedure to load the data into a table using xml as input parameter to a procedure and xml file is as shown below which is input to me.
    <?xml version="1.0"?>
    <DiseaseCodes>
    <Entity><dcode>0</dcode><ddesc>(I87)Other disorders of veins - postphlebitic syndrome</ddesc><claimid>34543></claimid><reauthflag>0</reauthflag></Entity>
    <Entity><dcode>0</dcode><ddesc>(J04)Acute laryngitis and tracheitis</ddesc><claimid>34543></claimid><reauthflag>0</reauthflag></Entity>
    <Entity><dcode>0</dcode><ddesc>(J17*)Pneumonia in other diseases - whooping cough</ddesc><claimid>34543></claimid><reauthflag>0</reauthflag></Entity>
    </DiseaseCodes>.
    Regards,
    vikram.

    here is the your XML parse in 11g :
    select *
      from xmltable('//Entity' passing xmltype
    '<?xml version="1.0"?>
    <DiseaseCodes>
    <Entity><dcode>0</dcode><ddesc>(I87)Other disorders of veins - postphlebitic syndrome</ddesc><claimid>34543></claimid><reauthflag>0</reauthflag></Entity>
    <Entity><dcode>0</dcode><ddesc>(J04)Acute laryngitis and tracheitis</ddesc><claimid>34543></claimid><reauthflag>0</reauthflag></Entity>
    <Entity><dcode>0</dcode><ddesc>(J17*)Pneumonia in other diseases - whooping cough</ddesc><claimid>34543></claimid><reauthflag>0</reauthflag></Entity>
    </DiseaseCodes>
    ') columns
      "dcode" varchar2(4000) path '/Entity/dcode',
      "ddesc" varchar2(4000) path '/Entity/ddesc',
      "reauthflag" varchar2(4000) path '/Entity/reauthflag'
    dcode                                                                            ddesc                                                                            reauthflag
    0                                                                                (I87)Other disorders of veins - postphlebitic syndrome                           0
    0                                                                                (J04)Acute laryngitis and tracheitis                                             0
    0                                                                                (J17*)Pneumonia in other diseases - whooping cough                               0
    SQL>
    Using this parser you can create procedure as
    SQL> create or replace procedure myXMLParse(x clob) as
      2  begin
      3    insert into MyXmlTable
      4      select *
      5        from xmltable('//Entity' passing xmltype(x) columns "dcode"
      6                      varchar2(4000) path '/Entity/dcode',
      7                      "ddesc" varchar2(4000) path '/Entity/ddesc',
      8                      "reauthflag" varchar2(4000) path '/Entity/reauthflag');
      9    commit;
    10  end;
    11 
    12  /
    Procedure created
    SQL>
    SQL>
    SQL> exec myXMLParse('<?xml version="1.0"?><DiseaseCodes><Entity><dcode>0</dcode><ddesc>(I87)Other disorders of veins - postphlebitic syndrome</ddesc><claimid>34543></claimid><reauthflag>0</reauthflag></Entity><Entity><dcode>0</dcode><ddesc>(J04)Acute laryngitis and tracheitis</ddesc><claimid>34543></claimid><reauthflag>0</reauthflag></Entity><Entity><dcode>0</dcode><ddesc>(J17*)Pneumonia in other diseases - whooping cough</ddesc><claimid>34543></claimid><reauthflag>0</reauthflag></Entity></DiseaseCodes>');
    PL/SQL procedure successfully completed
    SQL> select * from MYXMLTABLE;
    dcode                                                                            ddesc                                                                            reauthflag
    0                                                                                (I87)Other disorders of veins - postphlebitic syndrome                           0
    0                                                                                (J04)Acute laryngitis and tracheitis                                             0
    0                                                                                (J17*)Pneumonia in other diseases - whooping cough                               0
    SQL>
    SQL>
    Ramin Hashimzade

  • How the hell does a person share session data between JSP page and a Servle

    1. How the hell does one share session data between a servlet and a JSP page without using a bean but rather using a normal string variable.
    2. When using session scope to access a bean the application complains about not finding the bean on the specified scope, however when I use an application scope the save the same bean, the application does find it.
    Please help!!!!!!!
    SERVLET:
    HttpSession session = request.getSession(true);
    ServletContext servletContext = session.getServletContext();
    customerID = result.getString("CustomerID");
    userName = result.getString("UserName");
    session.setAttribute("UserName",userName);
    session.setAttribute("CustomerID",customerID);
    System.out.println("Customer UserName = " + session.getAttribute("UserName"));
    response.sendRedirect("/economics/subscriptions/default.jsp");
    JSP PAGE:
    <?xml version="1.0" encoding="UTF-8"?>
    <jsp:root xmlns:jsp=http://java.sun.com/JSP/Page mlns:c="http://java.sun.com/jsp/jstl/core" xmlns:sql="http://java.sun.com/jsp/jstl/sql" version="2.0">
    <jsp:directive.page isThreadSafe="true" session="true" contentType="text/xml"/><jsp:output omit-xml-declaration="false"/><jsp:scriptlet>response.addHeader("x-xslt-nocache", "true");</jsp:scriptlet><pml>
    <page type="web" search="y">
         <pageName>Commercial Banking</pageName>
         <jsp:directive.include file="/economics/header.inc"/>
         <jsp:directive.include file="/login.inc"/>
         <jsp:directive.include file="/economics/leftMenu.inc"/>
         <!--<jsp:useBean id="UserName" type="java.lang.String" scope="session" />-->
         <content>
         <searchSum>Commercial - Main Content</searchSum>
         Value = <c:out value="${request.session.getAttribute("UserName")}"/>
         </content>
         <jsp:directive.include file="/economics/rightNav.inc"/>
         <jsp:directive.include file="/footer.inc"/>
    </page></pml></jsp:root>

    For a start, just "session" instead of "request.session" would work better. But why did you post this here and not in the JSP forum? Doesn't seem to have anything to do with Java programming.

  • How to Write Log Message in a XML Data Source Report

    Hi Friends,
    Can anyone help me out what is the process of writing a log file in the XML Data Source Report. for eg: in Plsql we use FND_LOG.PUT_LINE to print the Log message in the Concurrent Request Output. in the similar manner, when we develop a report using XML, where we write Coding in XQuery of XML, what is the process need to follow to print the logs for the XQuery.
    Any inputs/Suggestion on this Highly appreciable.
    Thanks in advance.

    Create an RMI application (for example) that writes the log, and let all logging calls call that remote application.
    Something like that is the only feasible way that doesn't require you to have a drive on the remote machine mapped to the local one (which causes its own problems as you could have multiple simultaneous write attempts...).

  • I want to how to write program to design for archived data?

    Hi,
    In my project already some z reports are there. Now some old data is archiving from the tables.
    I want read the data for the z reports . i  used below code to read the data by passing the archive document key to read the data.
    But the below code is reading entire data due to that it is taking lot of time.
    Please give some suggestions weather am i gong in right way or not?.
    LOOP AT it_arcindx1 INTO wa_arcindx1.
        v_key = wa_arcindx1-archivekey+0(6).
        CALL FUNCTION 'ARCHIVE_OPEN_FOR_READ'
          EXPORTING
            archive_document = v_key
            object           = 'MM_EKKO'
          IMPORTING
            archive_handle   = lv_handle
          EXCEPTIONS
            OTHERS           = 1.
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE 'I' NUMBER sy-msgno
                  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
          EXIT.
        ENDIF.
        DO.
          CALL FUNCTION 'ARCHIVE_GET_NEXT_OBJECT'
            EXPORTING
              archive_handle = lv_handle
            EXCEPTIONS
              end_of_file    = 1.          "nur die Ausnahmen, auf die man
          IF sy-subrc <> 0.                "wirklich reagieren will
            EXIT.
          ENDIF.
          CALL FUNCTION 'ARCHIVE_GET_TABLE'
            EXPORTING
              archive_handle        = lv_handle
              record_structure      = 'EKBE'
              all_records_of_object = 'X'
            TABLES
              table                 = git_ekbe_temp
            EXCEPTIONS
              end_of_object         = 0.
          LOOP AT git_ekbe_temp ASSIGNING <ls_ekbe>
                                 WHERE mandt = sy-mandt
                                 AND vgabe = '8'
                                 AND budat IN s_budat.
            MOVE-CORRESPONDING <ls_ekbe> TO waa_table1.
            APPEND waa_table1 TO it_table1.
          ENDLOOP.
        ENDDO.
        CALL FUNCTION 'ARCHIVE_CLOSE_FILE'
          EXPORTING
            archive_handle = lv_handle.
        CLEAR wa_arcindx1.
      ENDLOOP.
    Regards,
    Maruthi S

    Hi Maruthi,
    Try using 'ARCHIVE_GET_NEXT_RECORD' instead of 'ARCHIVE_GET_TABLE' using which you can maintain no. of records hit by the handle.
    Have a look at sample logic given in SCN.
    http://scn.sap.com/thread/1263660
    Hope this helps.
    Regards,
    Naveen

  • How can i write the trigger for Global Temporary Table

    Hi Grus,
    How can i write the trigger for Global Temporary Table.
    I was created the GTT with trigger using the below script .
    CREATE GLOBAL TEMPORARY TABLE GLOBAL_TEMP
    EMP_C_NAME VARCHAR2(20 BYTE)
    ON COMMIT PRESERVE ROWS;
    CREATE OR REPLACE TRIGGER TRI_GLOBAL_TEMP
    BEFORE DELETE OR UPDATE OR INSERT
    ON GLOBAL_TEMP
    REFERENCING NEW AS NEW OLD AS OLD
    FOR EACH ROW
    BEGIN
    INSERT INTO EMPNAME VALUES (:OLD.EMP_C_NAME);
    END;
    trigger was create successfully, but the wouldn't insert into to EMPNAME Table..
    Please guide whether am correct or not? if not kindly give a correct syntax with example
    Thanks in Advance,
    Arun M M

    BEGIN
    INSERT INTO EMPNAME VALUES (:OLD.EMP_C_NAME);
    END;
    you are referencing old value in insert stmt.
    BEGIN
    INSERT INTO EMPNAME VALUES (:new.EMP_C_NAME);
    END;then run ur application it works fine...
    CREATE GLOBAL TEMPORARY TABLE GLOBAL_TEMP
    EMP_C_NAME VARCHAR2(20 BYTE)
    ON COMMIT PRESERVE ROWS;
    CREATE OR REPLACE TRIGGER TRI_GLOBAL_TEMP
    BEFORE DELETE OR UPDATE OR INSERT
    ON GLOBAL_TEMP
    REFERENCING NEW AS NEW OLD AS OLD
    FOR EACH ROW
    BEGIN
    dbms_output.put_line(:OLD.EMP_C_NAME||'yahoo');
    INSERT INTO EMPNAME VALUES (:new.EMP_C_NAME);
    dbms_output.put_line(:OLD.EMP_C_NAME);
    END;
    create table EMPNAME as select * from GLOBAL_TEMP where 1=2
    insert into GLOBAL_TEMP values('fgfdgd');
    commit;
    select * from GLOBAL_TEMP;
    select * from EMPNAME;
    output:
    1 rows inserted
    commit succeeded.
    EMP_C_NAME          
    fgfdgd              
    1 rows selected
    EMP_C_NAME          
    fgfdgd              
    1 rows selectedgot it Arun
    Edited by: OraclePLSQL on Dec 28, 2010 6:07 PM

  • Guys, How do I write a trigger to call Calulator /Notepad???

    How do I write a trigger to call Calulator /Notepad???
    how do i make a button to call the notepad editor in windows and calculator?
    of course i know about making the button, i want the code behind the trigger....

    Kid, while you are providing more information on exactly what you are trying to do please make if clear if you are asking about a database table trigger or a Forms trigger?
    As a general rule I would think an action such as calling a Windows specific feature should be done external to the database via the application.
    HTH -- Mark D Powell --

  • How to write Coloumn level Trigger

    sir,
    using ORACLE9i..
    i want a sample code to write a coloumn level triger.plz help me in this rgard.
    thanks in advance.

    Repeated thread:
    how to write Coloumn level Trigger

  • How to write driver programming in smartforms

    hi Floks
    <i>how to write driver programmig and how many types of driver programs available to trigger smartforms what are they . how to call the url in smartforms ?
    help me  out  .thanking you ,</i>
    with regards,
    suresh

    Hi
    Try to get the Function module name from the smart form
    how to find Driver program for a smartform
    and now goto SE38 and create a progarm for calling the smartform
    smartform driver program
    Regards
    Kathirve

  • How to write conversion routine for key figure?

    Our customer has this requirment:
    we need to know the last time of some TV program in BEx report, If a TV program last 500 seconds, we need show the key figure like this:  00:08:20, If a TV program last 100000 seconds, we need show the key figure like 27:46:40 (27 hours and 46 minitues and 27 seconds), If we define a key figure as time,  BW system will report a error that say it is not acceptable time.  If we want to define a integer, but we need display it like hhmmss format.  We know we can write conversion routine for char.  but I don't how to write conversion routine for key figure.   Please give me any hint if any other solutions?
    Edited by: SY DONG on Dec 2, 2010 3:36 AM

    If you want to do in Transformation Layer :
    You can use routine ...break up the seconds into minute hour and seconds
    you will have to handle few cases in this:
    let say your variable lv_seconds holds the number of seconds you want to convert to hour min and seconds
    DATA: lv_seconds type i,
               lv_hrs  type  i,
              lv_sec type i,
              lv_min type i.
    lv_hrs = lv_seconds / 3600
    if lv_hrs >= 1.
    lv_min = (lv_hrs - trunc(lv_hrs))*60
    here again handle seconds if min >60.
    else.
    lv_hrs = '00'.
    lv_min = lv_hrs*60
    It is just hint ..how you can manipulate the seconds to get it...you will have to think about the complete algorithm
    Regards,
    RK

  • How to write a Timestamp in an Oracle table?

    Hi,
    I am pretty new to SAP IdM and therefore have a very basic question.
    I am using SAP IdM 7.2 SP8 on Oracle.
    I was creating a job where I calculated some values from the database with a 'From Database' path.
    Then I wanted to store these values in a temporary table together with the timestamp when these were stored/calculated.
    Doing this in the Destination-Tab of the 'From Database'-path I got following error message...
    java.sql.SQLException: Missing IN or OUT parameter at index::2
    I did several tests and created a little test which recreates the problem...
    1. Create a Job with a 'From Database'-path
    2. In the source statement, insert...
    select
      'Test' AS Message,
      systimestamp AS TempDate
    from dual;
    3. In the destination tab add a temp Table and two columns. Since I want to add a date/timestamp-value I create a column of type 'DATE' here.
    4. After running the Job the error appears. (Here in german)
    Doing some additional tests I am able to add the date as a varchar2 if I convert the TempDate using a to_char()-function.
    Thus it seems like I misusing the Timestamp/Date data type.
    Do you have recommendations how I can add the Timestamp as a Date/Timestamp value to my table?
    Kind Regards, Andreas

    Hi,
    I really never got this to work properly and most of what follows is just my own rant caused by the annoyance of not getting this seemingly simple thing to work and are strictly my own theories not based on facts or actual knowledge of how Oracle or JDBC works, nor representing my employer in any way. Anyhow :-)
    Its possible that cause of the problem is that the timestamp is "destroyed" by NLS/JDBC when transferred from the database to the client. This is also one of the issues that varies a bit from version to version of the jdbc driver. Also the DATE datatype does not include fractional seconds, so you need to create the column as TIMESTAMP if you want that.
    The real fun thing with Oracle (or their jdbc driver) is that you can read a timestamp in the source and jdbc/NLS will convert it according to your locality setting, but you can't write what you read from Oracle back to Oracle.
    Just the same way you can use to_char to get a timestamp in a nice enough format, but when writing it to_date may not be able to parse the date back when using the exact same conversion mask...
    Example:
         select TO_CHAR(current_timestamp,'YYYYMMDD HH24:MI:SS.FFTZHTZM') from dual;
    Gives: 20140314 12:41:03.320000+0100. But both
         select TO_DATE('20140314 12:41:03.320000+0100','YYYYMMDD HH24:MI:SS.FFTZHTZM') from dual;
    and
         select TO_TIMESTAMP('20140314 12:41:03.320000+0100','YYYYMMDD HH24:MI:SS.FFTZHTZM') from dual;
    give errors.
    Rather than argue and fight with it I usually just end up using a To Database pass, check SQL Updating and write the Create Table and update/insert statements myself. Alternativly you can create the table with a trigger that automatically adds the timestamp on inserts/updates.
    1st To Database pass has no source, creates the temp table:
    The next pass has the source to read the data and insert it into the temp table:
    Then just use the current_timestamp function in the insert statement to keep it local and unconverted in the database engine...
    Br
    Chris
    Message was edited by: Per Krabsetsve

  • How to write the exceptions in function module

    dear all,
         how to write the exceptions in function modules with example.
    thanq
    jyothi

    Hi,
    Raising Exceptions
    There are two ABAP statements for raising exceptions. They can only be used in function modules:
    RAISE except.
    und
    MESSAGE.....RAISING except.
    The effect of these statements depends on whether the calling program handles the exception or not. The calling program handles an exception If the name of the except exception or OTHERS is specified after the EXCEPTION option of the CALL FUNCTION statement.
    If the calling program does not handle the exception
    · The RAISEstatement terminates the program and switches to debugging mode.
    · The MESSAGE..... RAISING statement displays the specified message. Processing is continued in relation to the message type.
    If the calling program handles the exception, both statements return control to the program. No values are transferred. The MESSAGE..... RAISING statement does not display a message. Instead, it fills the system fields sy-msgid, sy-msgty, sy-msgno , and SY-MSGV1 to SY-MSGV4.
    Source Code of READ_SPFLI_INTO_TABLE
    The entire source code of READ_SPFLI_INTO_TABLE looks like this:
    FUNCTION read_spfli_into_table.
    ""Local Interface:
    *" IMPORTING
    *" VALUE(ID) LIKE SPFLI-CARRID DEFAULT 'LH '
    *" EXPORTING
    *" VALUE(ITAB) TYPE SPFLI_TAB
    *" EXCEPTIONS
    *" NOT_FOUND
    SELECT * FROM spfli INTO TABLE itab WHERE carrid = id.
    IF sy-subrc NE 0.
    MESSAGE e007(at) RAISING not_found.
    ENDIF.
    ENDFUNCTION.
    The function module reads all of the data from the database table SPFLI where the key field CARRID is equal to the import parameter ID and places the entries that it finds into the internal table spfli_tab. If it cannot find any entries, the exception NOT_FOUND is triggered with MESSAGE ... RAISING. Otherwise, the table is passed to the caller as an exporting parameter.
    Calling READ_SPFLI_INTO_TABLE
    The following program calls the function module READ_SPFLI_INTO_TABLE:
    REPORT demo_mod_tech_fb_read_spfli.
    PARAMETERS carrier TYPE s_carr_id.
    DATA: jtab TYPE spfli_tab,
    wa LIKE LINE OF jtab.
    CALL FUNCTION 'READ_SPFLI_INTO_TABLE'
    EXPORTING
    id = carrier
    IMPORTING
    itab = jtab
    EXCEPTIONS
    not_found = 1
    OTHERS = 2.
    CASE sy-subrc.
    WHEN 1.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno.
    WHEN 2.
    MESSAGE e702(at).
    ENDCASE.
    LOOP AT jtab INTO wa.
    WRITE: / wa-carrid, wa-connid, wa-cityfrom, wa-cityto.
    ENDLOOP.
    The actual parameters carrier and jtab have the same data types as their corresponding interface parameters in the function module. The exception NOT_FOUND is handled in the program. It displays the same message that the function module would have displayed had it handled the error.
    Or
    just have to decide what exceptions u want and under what conditions.
    then declarethese exeptions under the exceptions tab.
    in the source code of ur function module.
    if
    like this u can code .
    now when u call the function module in tme mainprogram.
    if some error occurs and u have declared a exception for this then it will set sy-subrc = value u give inthe call of this fm.
    in the fm u can program these sy-subrc values and trigger the code for ur exception.
    Please reward if useful
    Regards,
    Ravi
    Edited by: Ravikanth Alapati on Mar 27, 2008 9:36 AM

Maybe you are looking for