Minimizing the code in trigger

Hi All,
I've written the following code...as per the requirement... But my manager is said to minimize the code..
But i couldn't find where can i minimize it...
Could you give me suggestion on this...
Create or replace trigger G_TMO_QPP_SDY_FSDO_UAR
after update of QPP_CNTRY_ID
on TMO_QPP_SDY_T
referencing new as new old as old
for each row
WHEN (OLD.QPP_CNTRY_ID<>NEW.QPP_CNTRY_ID)
declare
voutdat varchar2(1);
vmodtp varchar2(1);
vsdy_id TMO_QPP_SDY_T.SDY_ID%type;
BEGIN
vsdy_id:=:new.SDY_ID;
INSERT into T_FSDO_D(
REPL_ID,       
DK_SDY,        
DK_DAT,        
DK_ADT,        
MOD_TMST,
MOD_TP)
SELECT
NULL,      
TMO_QPP_SDO_T.SDY_ID,        
TMO_QPP_SDO_T.DAT_ID,        
0,        
SYSDATE,
'I'
FROM TMO_QPP_SDO_T
WHERE TMO_QPP_SDO_T.SDY_ID=vsdy_id;
vsdy_id:=:OLD.SDY_ID;
INSERT into T_FSDO_D(
REPL_ID,       
DK_SDY,        
DK_DAT,        
DK_ADT,        
MOD_TMST,
MOD_TP)
SELECT
NULL,      
TMO_QPP_SDO_T.SDY_ID,        
TMO_QPP_SDO_T.DAT_ID,        
0,        
SYSDATE,
'D'
FROM TMO_QPP_SDO_T
WHERE TMO_QPP_SDO_T.SDY_ID=vsdy_id;
exception
when others then
dbms_output.put_line('error');
end;thanks

Jyothsna,
Very disappointed with your posting -> :(
Where is the indentation of your coding? Who will do it for you? You are not a novice here. You know how to post neatly in order to get quick response. :(
Hope you will maintain this from next time.
Now, Coming to your question ->
Trigger code can be reduced in two ways. Make modular approach and put al your code inside any function or procedure. That will be a secure approach, too.
And, speaking to your current coding - i think your boss might look like this ->
create or replace trigger G_TMO_QPP_SDY_FSDO_UAR
after update of QPP_CNTRY_ID on TMO_QPP_SDY_T
referencing new as new old as old
for each row WHEN (:OLD.QPP_CNTRY_ID {noformat}<{noformat}{noformat}>{noformat} :NEW.QPP_CNTRY_ID)
declare
  voutdat varchar2(1);
  vmodtp varchar2(1);
BEGIN
  INSERT into T_FSDO_D(
                        REPL_ID,
                        DK_SDY,
                        DK_DAT,
                        DK_ADT,
                        MOD_TMST,
                        MOD_TP
   SELECT REPL_ID,
          DK_SDY,
          DK_DAT,
          DK_ADT,
          MOD_TMST,
          MOD_TP
   FROM (
          SELECT NULL AS REPL_ID,
                  TMO_QPP_SDO_T.SDY_ID AS DK_SDY,
                  TMO_QPP_SDO_T.DAT_ID AS DK_DAT,
                  0 AS DK_ADT,
                  SYSDATE AS MOD_TMST,
                  'I' AS MOD_TP
          FROM TMO_QPP_SDO_T
          WHERE TMO_QPP_SDO_T.SDY_ID IN (:new.SDY_ID,:OLD.SDY_ID)
exception
  when others then
    dbms_output.put_line('error');
end;N.B.: Not Tested...
Regards.
Satyaki De.
As suggested by Williams
Edited by: Satyaki_De on Sep 28, 2008 1:15 AM

Similar Messages

  • Chekcing the code of trigger/SP

    Hi,
    I would like to know how to check the code of triggers/stored procedures that created.
    What privillge(s) do I need to do so?
    Michael

    create or replace view
    vns as
    select e.department_id,e.last_name,d.department_name
    from employees e,departments d
    where e.department_id=d.department_id;
    create or replace trigger trgg
    instead of insert on vns
    for each row
    declare
    cnt number;
    begin
    select count(*) into cnt from employees where department_id=:new.department_id;
    if cnt=0 then
    --insert into employees(department_id,last_name) values(11,'nandu');
    insert into employees(employee_id,email,hire_date,job_id,department_id,last_name)
                   values(207,'[email protected]',sysdate,'AC_MGR',11,'nandu');   --- Values you have to choose!!
    end if;
    select count(*) into cnt from departments where department_id=:new.department_id;
    if cnt>0 then
    insert into departments(department_id, department_name) values(11, 'wrestling');  -- department_id is needed
    end if;
    end;
    -- testing with existing dept id = 10
    insert into vns(department_id) values(10);
    SQL> select * from departments where department_id = 11;
    DEPARTMENT_ID DEPARTMENT_NAME                MANAGER_ID LOCATION_ID
               11 wrestlingRequirement you must be knowing well
    Just showing you, how the trigger should be as per your view and logic inside trigger or you re-create view to avoid required values in trigger body.
    thanks!

  • How can i change the code in when new form instance trigger using JDAPI

    Hi all,
    Can anyone tell me how can i use JDAPI to modify the when-new-form-instance trigger in all my forms,coz we have around 500 FMB's ,if this is possible by using jdapi it will be better for us..
    Thanks in advance..
    Najeeb

    Hi Najeeb,
    The code I've given you should cover the basic steps - you will need to have a basic knowledge of Java if you want to use the JDAPI, there's no way around that unless you go and buy one of the off-the-shelf products for this kind of thing (I think there's one called orcltoolbox..?)
    I've written an application that does all kinds of things to Forms specific to our needs, so it's a bit tricky to just pull out the code you need, but again, the basics will be:
    String formName="C:\some_dir\some_form.fmb";
    FormModule mForm=FormModule.open(formName);
    Trigger myWNFITrig=Trigger.find(mForm,"WHEN-NEW-FORM-INSTANCE");
    String myText=myWNFITrig.getTriggerText();
    And there you have your trigger text, to do with what you please. You could put this code in the main() method of one class if you want to keep things really simple - but see how you get on, if you have any more specific questions, do come back.
    Eric - that's a very good point about using Regular Expressions. I haven't used them in my JDAPI app because I wanted to keep all my .fmbs 6i-compatible for the short-term, and a posting I saw somewhere recommended sticking to Java 1.3. Which rules out the regex facility, which only appeared in Java 1.4. Now, though, I think I needn't have worried - it surely shouldn't matter which version of Java I use to make the changes to the .fmbs. My stupid!
    James

  • Repeat an action (based on different trigger) efficientl​y without repeating the code

    Hello,
    I'm trying to find an efficient and clean way to do an action tha can be triggered by different things without having to repeat the piece of code itself at various places in my VI (after the said trigger things).
    An example (because my explanation is pretty clumsy):
    - The "action" (piece of code) is reading a file displaying the results (tiny more complicated than that but that shows the idea)
    - I want that action to happen when for example I save data in the file, open an existing file or press a button
    - Right now Im using the same piece of code at each places (when I write in the file, open existing file and press the button) using local variables
    I'm trying to find a more efficient way to do that, so I can write the code only once.
    FYI the whole thing is in a big while loop. The VI Im working on is pretty huge and complex so It doesnt really make sense to share it.
    Hope my question is clear. Thanks !

    Application Design Patterns: State Machines
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Showing more than one row at the same time, trigger necessary?

    hi
    I'm an absolute beginner in oracle forms, so i have a fundamental problem. i have a forms with 3 data-tables/data-blocks with following names and columns:
    table "connection type": con_id, con_descr
    table "connection": con_con_id (foreign key to "con_id" from "connection_typ"), sales_id (foreign key to "s_id" from "sales")
    table "sales": s_id, s_descr
    now i'm trying to get the following thing: when i'll execute an execute-query on "con_id" from data-block one (table "connection") i want see all records in block two (table "connection") and at the same time for each record in block two the description from "sales". so for each record in "connection" exists a record in "sales". the current problem is that i just see the "s_descr" from the selected/current record in "connection", but not all "s_descr" of every record.
    i think i need a post-query-trigger but i don't know the code i need...
    i hope someone understand my problem and might help me. thanks!

    So, let me try to summarize:
    Connection has a foreign key to both ConnectionType and to Sales
    When you select a ConnectionType in blok1, you want to see all Connections for that type in block 2. That's a clasic Master-Detail relationship and it looks like you've got that cracked.
    If you also use a Master-Detail relationship between Connection and Sales, it will make sure Oracle Forms queries the Sales block based on the value of the current record in Connection. Hence it is showing all the Sales record for the current Connection. That's always one (or none if the sales-id is optional).
    You probably don't want to use a separate block for Sales with a relationship to Connection. Don't you want just a number of lookup fields. In the Connection block you also want to show the Description from the Sales table.
    To accomplish that, add an extra field to the Connection block to hold the Sales Description. Then write a post-query trigger on the Connection block. That trigger will fire for each record being fetched. In that trigger you can do something like:
    select description into :connection.sales_descr from sales where id=:connection.sales_id;
    Alternatively you can also base the Connection block on a query in stead of directly on the Connection table. That allows you to write a Select statement that (outer) joins Connection to Sales and use that query result as the basis for the block.

  • What exactly is happening in the code mentioned?????

    Hi all,
    I want to know the working of the below code:
    The below code is the WHEN_BUTTON_PRESSED Trigger for the ENTER_QUERY (Push Button):
    DECLARE
      IT_ID1 ITEM;
      IT_ID2 ITEM;
      IT_ID3 ITEM;
    BEGIN
      IT_ID1 := FIND_ITEM('BUTTON.EN_QUERY');
      IT_ID2 := FIND_ITEM('BUTTON.CA_QUERY');
      IT_ID3 := FIND_ITEM('BUTTON.EX_QUERY');
      SET_ITEM_PROPERTY(IT_ID3,ENABLED,PROPERTY_TRUE);
      if :system.mode<>'ENTER-QUERY' THEN
       set_item_property (it_id1,label,'CANCEL QUERY');
       GO_BLOCK(GET_APPLICATION_PROPERTY(CURRENT_FORM_NAME));
       CLEAR_BLOCK(NO_VALIDATE);
       ENTER_QUERY;
      set_item_property (it_id1,label,'ENTER QUERY');
      ELSE
      EXIT_FORM;
      END IF;
    END;
    Can You please tell me what exactly is happening in the above code?
    I want to know the working of it. Help me plz.
    Thank You.
    Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
    Oracle Forms 6i.

    what does if :system.mode<>'ENTER-QUERY' THEN mean??
    SYSTEM.MODE indicates whether the form is in Normal, Enter Query, or Fetch Processing mode. The value is always a character string.
    and what does GO_BLOCK(GET_APPLICATION_PROPERTY(CURRENT_FORM_NAME)); do?
    GET_APPLICATION_PROPERTY Returns information about the current Oracle Forms application. CURRENT_FORM_NAME Returns the name of the current form as indicated by the form module Name property.
    GO_BLOCK navigates to an indicated block. If the target block is non-enterable, an error occurs.
    As per the code, After i press the button, the label ENTER QUERY should become CANCEL QUERY, (that is when system is in ENTER_QUERY mode) .
    So when in the system is in ENTER_QUERY mode, it must display CANCEL QUERY, Right??
    in your post, you also said..
    The below code is the WHEN_BUTTON_PRESSED Trigger for the ENTER_QUERY (Push Button):
    We see 3 button in your code. How can we know which one is ENTER_QUERY button. Your code says...
    ENTER_QUERY;
      set_item_property (it_id1,label,'ENTER QUERY');
    So, it says.. BUTTON.EN_QUERY label will be ENTER QUERY
    Then why the code, (if :system.mode<>'ENTER-QUERY' THEN set_item_property (it_id1,label,'CANCEL QUERY');) ?? which says if system mode is not equal to ENTER_QUERY,
    then it tells to display CANCEL QUERY.
    it says.. BUTTON.EN_QUERY label will be CANCEL QUERY

  • How to Track the table using Trigger or any other Object

    Hi Folks
    I need to audit Inserts, deletions, updates  to inserted into other tracking table. I was planning on using a trigger to do this,
    Can you please help me how can I wright code for trigger for this. or else using any other object we can do this operation.
    can you please help me thanks in advance.
    Thank in advance.

    Also you can use an OUTPUT clause ( need to modify your DML operations)
    create table itest ( i int identity not null primary key, j int not null unique )
    create table #new ( i int not null, j int not null)
    insert into itest (j)
    output inserted.i, inserted.j into #new
    select o.object_id from sys.objects as o
    select * from #new
    drop table #new, itest;
    go
    The example below shows code that uses OUTPUT clause in UPDATE and DELETE statements to insert rows into an audit table.
    create table t ( i int not null );
    create table t_audit ( old_i int not null, new_i int null );
    insert into t (i) values( 1 );
    insert into t (i) values( 2 );
    update t
       set i  = i + 1
    output deleted.i, inserted.i into t_audit
     where i = 1;
    delete from t
    output deleted.i, NULL into t_audit
     where i = 2;
    select * from t;
    select * from t_audit;
    drop table t, t_audit;
    go
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • How to find the code in standard transaction from where event is trigered

    I have a configuration in SWEC, to trigger an event, when a PR is change
    For the Transaction ME52 (Change Purchase requisition), I want to go to the portion of the code, from where the function module for triggering the event is executed.
    I have learnt that F.Ms for trigerring events programatically are
    1.  SWE_EVENT_CREATE.
    2.  SWE_EVENT_CREATE_IN_UPD_TASK.
    3.  SWE_EVENT_CREATE_FOR_UPD_TASK
    So, I tried debugging the transaction ME52 by setting breakpoints at the following function modules.
    1.  SWE_EVENT_CREATE.
    2.  SWE_EVENT_CREATE_IN_UPD_TASK.
    3.  SWE_EVENT_CREATE_FOR_UPD_TASK.
    But none of these were encountered.

    Hi Sameer,
    Why not follow the reverse approach! First check the event getting triggered and then move backwards to the source of triggering the event.
    Activate event trace from SWELS and then check the event getting triggered in SWEL.
    I doubt if putting break-points in the FM would help...
    Check if the event is being triggered by the BO method.
    You can check the where-used list of the method and find out the source of the event triggering.
    Hope this helps!
    Regards,
    Saumya

  • How to write the code to send the report output to the local file.

    dear all,
    how to write the code to send the report output to the local file.
    Thanks & Regards,
    Jyothi.

    Hi,
    Try this , it will display report and download the file as well. Just vhange the path and execute
    TYPE-POOLS : SLIS.
    DATA : IT_SCARR TYPE TABLE OF SCARR,
           IT_FCAT  TYPE SLIS_T_FIELDCAT_ALV.
    SELECT *
    FROM SCARR
    INTO TABLE IT_SCARR.
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
    *   I_PROGRAM_NAME               =
    *   I_INTERNAL_TABNAME           =
        I_STRUCTURE_NAME             = 'SCARR'
    *   I_CLIENT_NEVER_DISPLAY       = 'X'
    *   I_INCLNAME                   =
    *   I_BYPASSING_BUFFER           =
    *   I_BUFFER_ACTIVE              =
      CHANGING
        CT_FIELDCAT                  = IT_FCAT
    * EXCEPTIONS
    *   INCONSISTENT_INTERFACE       = 1
    *   PROGRAM_ERROR                = 2
    *   OTHERS                       = 3
    IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
    *   I_INTERFACE_CHECK              = ' '
    *   I_BYPASSING_BUFFER             =
    *   I_BUFFER_ACTIVE                = ' '
    *   I_CALLBACK_PROGRAM             = ' '
    *   I_CALLBACK_PF_STATUS_SET       = ' '
    *   I_CALLBACK_USER_COMMAND        = ' '
    *   I_STRUCTURE_NAME               =
    *   IS_LAYOUT                      =
       IT_FIELDCAT                    = IT_FCAT
    *   IT_EXCLUDING                   =
    *   IT_SPECIAL_GROUPS              =
    *   IT_SORT                        =
    *   IT_FILTER                      =
    *   IS_SEL_HIDE                    =
    *   I_DEFAULT                      = 'X'
    *   I_SAVE                         = ' '
    *   IS_VARIANT                     =
    *   IT_EVENTS                      =
    *   IT_EVENT_EXIT                  =
    *   IS_PRINT                       =
    *   IS_REPREP_ID                   =
    *   I_SCREEN_START_COLUMN          = 0
    *   I_SCREEN_START_LINE            = 0
    *   I_SCREEN_END_COLUMN            = 0
    *   I_SCREEN_END_LINE              = 0
    *   IR_SALV_LIST_ADAPTER           =
    *   IT_EXCEPT_QINFO                =
    *   I_SUPPRESS_EMPTY_DATA          = ABAP_FALSE
    * IMPORTING
    *   E_EXIT_CAUSED_BY_CALLER        =
    *   ES_EXIT_CAUSED_BY_USER         =
      TABLES
        T_OUTTAB                       = IT_SCARR
    * EXCEPTIONS
    *   PROGRAM_ERROR                  = 1
    *   OTHERS                         = 2
    IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD
      EXPORTING
    *    BIN_FILESIZE              =
        FILENAME                  = 'C:\Documents and Settings\sap\Desktop\Hi.xls' " Change path
    *    FILETYPE                  = 'ASC'
    *    APPEND                    = SPACE
    *    WRITE_FIELD_SEPARATOR     = SPACE
    *    HEADER                    = '00'
    *    TRUNC_TRAILING_BLANKS     = SPACE
    *    WRITE_LF                  = 'X'
    *    COL_SELECT                = SPACE
    *    COL_SELECT_MASK           = SPACE
    *    DAT_MODE                  = SPACE
    *    CONFIRM_OVERWRITE         = SPACE
    *    NO_AUTH_CHECK             = SPACE
    *    CODEPAGE                  = SPACE
    *    IGNORE_CERR               = ABAP_TRUE
    *    REPLACEMENT               = '#'
    *    WRITE_BOM                 = SPACE
    *    TRUNC_TRAILING_BLANKS_EOL = 'X'
    *  IMPORTING
    *    FILELENGTH                =
      CHANGING
        DATA_TAB                  = IT_SCARR
    *  EXCEPTIONS
    *    FILE_WRITE_ERROR          = 1
    *    NO_BATCH                  = 2
    *    GUI_REFUSE_FILETRANSFER   = 3
    *    INVALID_TYPE              = 4
    *    NO_AUTHORITY              = 5
    *    UNKNOWN_ERROR             = 6
    *    HEADER_NOT_ALLOWED        = 7
    *    SEPARATOR_NOT_ALLOWED     = 8
    *    FILESIZE_NOT_ALLOWED      = 9
    *    HEADER_TOO_LONG           = 10
    *    DP_ERROR_CREATE           = 11
    *    DP_ERROR_SEND             = 12
    *    DP_ERROR_WRITE            = 13
    *    UNKNOWN_DP_ERROR          = 14
    *    ACCESS_DENIED             = 15
    *    DP_OUT_OF_MEMORY          = 16
    *    DISK_FULL                 = 17
    *    DP_TIMEOUT                = 18
    *    FILE_NOT_FOUND            = 19
    *    DATAPROVIDER_EXCEPTION    = 20
    *    CONTROL_FLUSH_ERROR       = 21
    *    NOT_SUPPORTED_BY_GUI      = 22
    *    ERROR_NO_GUI              = 23
    *    others                    = 24
    IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    CALL METHOD CL_GUI_FRONTEND_SERVICES=>EXECUTE
      EXPORTING
        DOCUMENT               = 'C:\Documents and Settings\sap\Desktop\Hi.xls' "Change path
    *    APPLICATION            =
    *    PARAMETER              =
    *    DEFAULT_DIRECTORY      =
    *    MAXIMIZED              =
    *    MINIMIZED              =
    *    SYNCHRONOUS            =
    *    OPERATION              = 'OPEN'
    *  EXCEPTIONS
    *    CNTL_ERROR             = 1
    *    ERROR_NO_GUI           = 2
    *    BAD_PARAMETER          = 3
    *    FILE_NOT_FOUND         = 4
    *    PATH_NOT_FOUND         = 5
    *    FILE_EXTENSION_UNKNOWN = 6
    *    ERROR_EXECUTE_FAILED   = 7
    *    SYNCHRONOUS_FAILED     = 8
    *    NOT_SUPPORTED_BY_GUI   = 9
    *    others                 = 10
    IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.

  • F9 doesn't work even after the code that I put it inside KEY-F9

    IN KEY-F9 I PUT :-
    SHOW_KEYS;
    and in run time , when i press F9 nothing happen !
    why the code didn't execute ?!
    I attached the fmb file in this link :-
    http://www.zshare.net/download/16231588ffb4d1df/
    , and it work with HR schema

    I modified the file fmrweb.res and did that :-
    from
    120 : 3 : "Shift+Ctrl+F9" : 91 : "Function 9"
    to
    120 : 3 : "F9" : 91 : "Function 9"
    and even although I programmed the KEY-F9 trigger to
    if show_lov('LOV4') then
         message('OKayyyyyyyyyyyyyyy');
    else
         message('NOOOOOOOOOOOOOOOOO');
    end if;
    but in Run Time when I press F9 nothing happened , but when I press Shift+Ctrl+F9 the LOV appear !!!!
    what's went wrong here ?

  • Does JNLP Sync up the software from the code base only at the startup?

    Does JNLP Sync up the software from the code base only at the startup?
    There appears a Source sync every time i startup the jnlp app from shortcut.
    The users of JNLP application may enable the Internet mid of the application session and fail to get the updates.
    If this case repeats for a period of time, there is a good chance of the app user being denied the code update.
    Is this case holds true. Does JNLP syncs with the code base only at the startup.
    Please explain..
    Thanks In Advance

    Are you using versions (only 'Easy solution 2' works without)?*
    No I am not using versions
    Are you thinking of a background update or an on-demand update?*
    background
    Have you got all-permissions?
    yes
    Have you tried writing a small DownloadServiceListener and calling*
    DownloadService.loadResource(myURLtojnlp, null, myDownloadServiceListener)*
    Does anything happen?*
    No. But, no problems trying it.
    Easy solution 1*
    If using versions and if you want an on-demand update you can launch and wait*
    Runtime.getRuntime.exec("javaws -wait myURLtojnlp");*
    and then you exit (need all-permissions to call exec, can try showDocument() otherwise).*
    You should just have some way to know if the jnlp has changed (you could open an URLConnection and see if LastModified is after application start time).*
    I am not using versions.
    Easy solution 2:*
    If you're just afraid of losing update, you can call BasicService.isOffline at application start, if true you set a timer that checks every 5 minutes, if you go online you call*
    Runtime.getRuntime.exec("javaws -import myURLtojnlp");*
    and you'll have resources updated, so they'll be good for next start (need all-permissions to call exec).*
    You can call it with -wait and ask the user if he wants to restart the application*
    Harder solution (here comes the bunch of code with DownloadService):*
    you open an url connection to codebase, retrieve jnlp, parse it, for each resource you see if it's cached, if not:*
    Solution 1: you tell the user you found updates and ask him to restart (or automatically restart after he pressed ok, with exec or showDocument).*
    Solution 2: you download the resource (so that you'll have it even if user doesn't restart the app).You'd better do this in a separate Thread or have an interactive DowloadServiceListener cause service waits for download to end.*
    I ll try the timer execution. Have to see weather web start puts up a downloading progress window on top of the application. I belive the DownloadService listener will be silent. I ll implement it and get back to you.
    Thanks for your kind guidence.
    I think your scenario is very difficult to happen, but I guess you must have your good reasons to ask.*
    This scenario happens to my users as they switch on the client when the start their machine and runs for the whole morning. They switch on the internet for other purposes and shuts it down in an hour. Minimal chance of connecting the internet before the startup.
    I get update towards the server through a similar timer based mechanism. I ll implement the code updates in the same mechanism.
    Thanks.

  • How to subtotal in alv? Please correct the code!!!!

    hi,
    I have an alv layout like following:
    ZZZ 300100089 1050
    ZZZ 300100089 1050
    subtoal 2100
    90256243 300100000 193410
    90256242 300100000 173250
    90256241 300100000 173250
    90256240 300100000 173250
    90256239 300100000 173250
    90256238 300100000 173250
    90256237 300100000 173250
    subtotal 1232910
    when the second numbers are the same,
    I need to sum up as
    300100089 2100
    300100000 1232910
    I write the coding as the following, but it did not work. I go dump in function module. Please
    help and correct it!!
    DATA I_SORT TYPE SLIS_T_SORTINFO_ALV.
    DATA WA_SORT TYPE slis_sortinfo_alv.
    WA_SORT-fieldname = 'H_BETRG'.     " speicfy field name..
    WA_SORT-UP = 'X'.
    WA_SORT-SUBTOT = 'X'.
    APPEND WA_SORT TO I_SORT.
    CLEAR WA_SORT.
    IN FM.
    it_sort                = i_sort
    I do not know what is the file name I should put into the WA_SORT-fieldname, I tried "wrbtr" and some other name, but I got the same dump when I excute the program. Please help me to correct the code.
    Thank you.

    Hi,
    The dump is as following:
    What happened?
        The current application program detected a situation which really
        should not occur. Therefore, a termination with a short dump was
        triggered on purpose by the key word MESSAGE (type X).
    Error analysis
        Short text of error message:
        Technical information about the message:
        Message classe...... "0K"
        Number.............. 000
        Variable 1.......... " "
        Variable 2.......... " "
        Variable 3.......... " "
        Variable 4.......... " "
        Variable 3.......... " "
        Variable 4.......... " "
    Trigger Location of Runtime Error
        Program                                 SAPLSLVC
        Include                                 LSLVCU10
        Row                                     36
        Module type                             (FUNCTION)
        Module Name                             LVC_SORT_COMPLETE
      31   LOOP AT CT_SORT INTO LS_SORT.
      32
      33     READ TABLE IT_FIELDCAT ASSIGNING <LS_FIELDCAT>
      34          WITH KEY FIELDNAME = LS_SORT-FIELDNAME BINARY SEARCH.
      35     IF SY-SUBRC NE 0.
    >>>>       MESSAGE X000(0K).
      37     ENDIF.
      38
      39     LS_SORT-SELTEXT = <LS_FIELDCAT>-SELTEXT.
      40
      41 *     Zwischensummenstufen ermitteln
      42     IF NOT LS_SORT-SUBTOT IS INITIAL.
      43       L_COUNT = L_COUNT + 1.
    Please help, thank you!!

  • Batch Code to trigger bat file whenever there is an error in Eventvwr log error

    Batch Code to trigger bat file whenever there is an error in Eventvwr log error

    Hello,
    You can create a windows service which can look into EventVwr and update you accordingly
    Sample code:
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    namespace EventViewer
        class Program
            static void Main(string[] args)
                //logType can be Application, Security, System or any other Custom Log.
                string logType = "Application";
                EventLog ev = new EventLog(logType, System.Environment.MachineName);
                int LastLogToShow = ev.Entries.Count;
                if (LastLogToShow <= 0)
                    Console.WriteLine("No Event Logs in the Log :" + logType);
                // Read the last 2 records in the specified log.
                int i;
                for (i = ev.Entries.Count - 1; i >= LastLogToShow - 10; i--)
                    EventLogEntry CurrentEntry = ev.Entries[i];
                    Console.WriteLine("Event ID : " + CurrentEntry.EventID);
                    Console.WriteLine("Entry Type : " + CurrentEntry.EntryType.ToString());
                    Console.WriteLine("Message :  " + CurrentEntry.Message + "\n");
                    Console.ReadKey();
                ev.Close();
    Alternative way is to use below link
    http://blogs.technet.com/b/jhoward/archive/2010/06/16/getting-event-log-contents-by-email-on-an-event-log-trigger.aspx
    Thanks
    Abhishek

  • Using LV Class Property Nodes in In-place Element structure causes the code to halt

    I have some code written in LV RT 2010 that uses property nodes from a LVOOP class that I created.  I am using access the property node from inside an in-place element structure.  When the code reaches the property node, LabVIEW stops running.  (as if the abort button was pressed).  I verified this behaviour using highlight execution.  When I remove the in-place structure code runs fine.
    Is this is know bug in LabVIEW?  Is there a CAR to resolve this created for a future release?

    Bob,
    I tried to reproduce the behavior you're seeing by recreating the Trigger and Trigger List classes, but I have not been able to reproduce it.  Please take a look at my version of the project in the attached zip file.  Take a look at Test.vi, and feel free to modify and repost it to show me how to make the problem occur.  I would like to file a CAR to make sure we get the problem fixed, but I will need to be able to reliably reproduce it first.
    On a similar note, you can get much better performance out of the Process Triggers VI by preallocating the list array, instead of using build array in a loop.  Take a look at Process Triggers2.vi in my project.  You can run Benchmark.vi to see the performance difference between the two different approaches.
    Chris M
    Attachments:
    triggerlist test.zip ‏165 KB

  • Where is the code behind buttons?

    Hi,
    I need to modify some forms developed several years ago. There are some buttons on a horizontal toolbar. They all work ok except one button. I tried to find code behind these buttons by clicking the "+" sign in front each button item, but it looks like no trigger is attached to any of the buttons. Where can the code be hidden? Even if the buttons are inherited from object group or property class, I should be able to see some code, right? Any idea?
    Thanks.
    Sherry

    Hi,
    I think if the buttons do default actions e.g Exit does EXIT_FORM, tnen there is no need for triggers - try creating a WHEN-BUTTON-PRESSED trigger under one of the items with MESSAGE('Hello World'); and see what happens. Forms can work with no triggers at all if all that is required is default functionality. When you require, for example, conditional validation/navigation a trigger is needed. Take a text item: pressing RETURN will fire the NEXT_ITEM built-in unless you explicitly change Forms behaviour by coding a KEY-NEXT-ITEM trigger (which could contain any PL/SQL e.g. EXECUTE_QUERY if you want a query block to execute a query upon hitting RETURN from an item.
    Hope this helps

Maybe you are looking for