Concate values in Trigger

Hi,
I am trying to store the changed value in my trigger to a variable. It seems that i cant do a concate with a bind variable to a string variable.
Is there any workaround for that?
Attached is a snippet of code.
CREATE OR REPLACE TRIGGER Trigger_Test AFTER UPDATE ON Table_A FOR EACH ROW
DECLARE
strNewVal CHAR(32767):= '' ;
strOldVal CHAR(32767):= '' ;
iFieldsUpdated Number;
new_app_type varchar2(60);
old_app_type varchar2(60);     
BEGIN
IF UPDATING THEN
     IF :OLD.COL_A<>:NEW.COL_B THEN
     strNewVal:=strNewVal ||'<br>Col A = '||:NEW.Col_A;
     strOldVal:=strOldVal ||'<br>Col A = '||:OLD.Col_A;     
     END IF;
     INSERT INTO Table_A_aud
     VALUES(strNewVal, strOldVal);
END IF;
END;

SQL> create table table_a(col_a varchar2(10),
  2  col_b varchar2(10));
Table created.
SQL> create table table_a_aud(col1 varchar2(100),
  2  col2 varchar2(100));
Table created.
SQL> insert into table_a values('test1','test2');
1 row created.
SQL> CREATE OR REPLACE TRIGGER Trigger_Test AFTER UPDATE ON Table_A FOR EACH ROW
  2  DECLARE
  3  strNewVal CHAR(32767):= '' ;
  4  strOldVal CHAR(32767):= '' ;
  5  iFieldsUpdated Number;
  6  new_app_type varchar2(60);
  7  old_app_type varchar2(60);
  8 
  9  BEGIN
10  IF UPDATING THEN
11  IF :OLD.COL_A<>:NEW.COL_B THEN
12  strNewVal:=strNewVal ||'<br>Col A = '||:NEW.Col_A;
13  strOldVal:=strOldVal ||'<br>Col A = '||:OLD.Col_A;
14  END IF;
15 
16 
17  INSERT INTO Table_A_aud
18  VALUES(strNewVal, strOldVal);
19 
20  END IF;
21  END;
22  /
Trigger created.
SQL> UPDATE TABLE_A
  2  SET COL_B = 'test3';
UPDATE TABLE_A
ERROR at line 1:
ORA-06502: PL/SQL: numeric or value error: character string buffer too small
ORA-06512: at "SCOTT.TRIGGER_TEST", line 11
ORA-04088: error during execution of trigger 'LMS.TRIGGER_TEST'
SQL> select * from table_a;
COL_A      COL_B
test1      test2
SQL> CREATE OR REPLACE TRIGGER Trigger_Test AFTER UPDATE ON Table_A FOR EACH ROW
  2  DECLARE
  3  strNewVal CHAR(32767):= '' ;
  4  strOldVal CHAR(32767):= '' ;
  5  iFieldsUpdated Number;
  6  new_app_type varchar2(60);
  7  old_app_type varchar2(60);
  8 
  9  BEGIN
10  IF UPDATING THEN
11  IF :OLD.COL_A<>:NEW.COL_B THEN
12  strNewVal:=strNewVal ||'<br>Col A = '||:NEW.Col_A;
13  strOldVal:=strOldVal ||'<br>Col A = '||:OLD.Col_A;
14  END IF;
15 
16 
17  INSERT INTO Table_A_aud
18  VALUES(strNewVal, strOldVal);
19 
20  END IF;
21  END;
22  .
SQL> ed
Wrote file afiedt.buf
  1  CREATE OR REPLACE TRIGGER Trigger_Test AFTER UPDATE ON Table_A FOR EACH ROW
  2  DECLARE
  3  strNewVal VARCHAR2(32767):= '' ;
  4  strOldVal VARCHAR2(32767):= '' ;
  5  iFieldsUpdated Number;
  6  new_app_type varchar2(60);
  7  old_app_type varchar2(60);
  8  BEGIN
  9  IF UPDATING THEN
10  IF :OLD.COL_A<>:NEW.COL_B THEN
11  strNewVal:=strNewVal ||'<br>Col A = '||:NEW.Col_A;
12  strOldVal:=strOldVal ||'<br>Col A = '||:OLD.Col_A;
13  END IF;
14  INSERT INTO Table_A_aud
15  VALUES(strNewVal, strOldVal);
16  END IF;
17* END;
18  /
Trigger created.
SQL> UPDATE TABLE_A
  2  SET COL_B = 'test3';
1 row updated.
SQL> SELECT * FROM TABLE_A_AUD;
COL1
COL2
<br>Col A = test1
<br>Col A = test1Change the datatype for variables 'strNewVal' and 'strOldVal'.

Similar Messages

  • Default value? Trigger?

    Hi all,
    I got one Oracle 10g problem here, not sure you can help me or not.
    If a table has a column which has "default value" setup.
    Example
    CREATE TABLE KENTEMP
    refno number(10),
    user_create varchar2(30) Default USER not null
    And it also has a trigger with following contents:
    If :new.user_create is Null then
    :new.user_create := 'TEST';
    end if;
    If I going insert a record with null value on user_create column.
    In some Oracle database, the create_user will become USER, some will become "TEST".
    Do you understand why?
    Thanks

    In some Oracle database, the create_user will become USER, some will become "TEST". Are you running the same INSERT statement on all these databases? Because the default value gets applied before the trigger fires, and I would expect that to be consistent across all databases.
    SQL>  create table defval (col1 number, col2 varchar2(30) default user)
      2  /
    Table created.
    SQL> insert into defval (col1) values (1)
      2  /
    1 row created.
    SQL> select * from defval
      2  /
          COL1 COL2
             1 APC
    SQL> create trigger defval_trg before insert on defval for each row
      2  begin
      3    if :new.col2 is null then
      4       :new.col2 := 'TEST';
      5    end if;
      6  end;
      7  /
    Trigger created.
    SQL> insert into defval (col1) values (2)
      2  /
    1 row created.
    SQL> select * from defval
      2  /
          COL1 COL2
             1 APC
             2 APC
    SQL> insert into defval (col1,col2) values (3, null)
      2  /
    1 row created.
    SQL> select * from defval
      2  /
          COL1 COL2
             1 APC
             2 APC
             3 TEST
    SQL> Cheers, APC
    Blog : http://radiofreetooting.blogspot.com/

  • APEX and CLOB value in trigger

    Hi,
    I am using APEX 3.2.1 with Oracle 11gR1.
    I have two tables:
    CREATE TABLE "TSI"."ATT_TEST2"
    (     "ID" NUMBER NOT NULL ENABLE,
         "TITLE" VARCHAR2(250 BYTE),
         "TOPIC" CLOB
    and
    CREATE TABLE "TSI"."ATT_TEST2"
    (     "ID" NUMBER NOT NULL ENABLE,
         "TITLE" VARCHAR2(250 BYTE),
         "TOPIC" CLOB
    My trigger is:
    create or replace TRIGGER "TSI"."ATT_TEST_TRG"
    BEFORE INSERT ON ATT_TEST
    FOR EACH ROW
    BEGIN
    SELECT ATT_TEST_SEQ.NEXTVAL INTO :new.ID FROM DUAL;
    insert into att_test2(id, title, topic) values (ATT_TEST_SEQ.NEXTVAL, :new.title, :new.topic);
    END;
    Now if I insert a record to ATT_TEST using SQL Developer ATT_TEST2 gets populated.
    If create an APEX form and try to insert into ATT_TEST i get all the fields inserted into ATT_TEST2 except for the CLOB column. The TOPIC column is not copied into ATT_TEST2.
    Any idea why this works from SQL Developer and not from APEX?
    Thank you

    Hello:
    I believe this behaviour is seen because APEX uses the 'DBMS_LOB' API to update LOB/CLOB columns.For the example posted APEX does something like
    INSERT INTO "ATT_TEST" ( "ID","TITLE","TOPIC") VALUES (:B1 ,REPLACE(:B2 ,'%null%',NULL),EMPTY_CLOB()) RETURNING ROWID INTO :0;
    begin select "TOPIC" into wwv_flow.g_dml_clob_text from "ATT_TEST" where rowid = :p_rowid for update; end;
    begin dbms_lob.write( wwv_flow.g_dml_clob_text, length(wwv_flow.g_dml_varchar32767_text), 1, wwv_flow.g_dml_varchar32767_text ); end;
    varad

  • For Each function for a Concat Value

    Hi:
    The scenario is, we need to concat two unbounded elements and map it to a target element using for each functionality.
    For example
    <BookStore>
    <Books>
    <Name>NAME1</Name>
    <Author>AUTHOR1</Author>
    <BookId>1</BookId>
    <Quantity>2</Quantity>
    <Price></Price>
    <Status></Status>
    <Books>
    <Books>
    <Name>NAME2</Name>
    <Author>AUTHOR2</Author>
    <BookId>2</BookId>
    <Quantity>2</Quantity>
    <Price></Price>
    <Status></Status>
    <Books>
    </BookStore>
    I need to concat "Name" and "Author" which is under the unbounded element "BookStore" and map it to a single element called "Sample" on the Target side.
    I am not able to use the "for-each" XSLT function to get the multiple value of Name and Author since concat function is used. Is there any other way to concat and get the multiple values of the element "Name" and "Author"?
    Regards
    RK

    Hi Vlad:
    Ok i use for-each function in my XSLT to get the vlaues of unbounded elements
    eg:
    <xsl:for-each select="/BookStore/Books/Name">
    <request:Sample>
    <xsl:value-of select="/BookStore/Books/Name"/>
    </request:Sample>
    </xsl:for-each>
    This works perfectly fine and whenever there is a multiple vlaue for Name it is mapped to Sample and output comes as expected
    <Sample>NAME1</Sample>
    <Sample>NAME2</Sample>
    Now i need to concat the Name and Author and pass the value to element on the target. Since name and author occuring multiple times, i am not sure how to pass the values to the element on the target

  • Combine the concat value in a single textfield.

    hi there,
    How to make the concat function, combining the multiple textfield into a single textfield
    It doesnt work when i'm inserting the data in the last of textfield.It should appear when i have finished inserting the data.. should i put the onChange function to make it appear..
    and what is the diferent between concat and bufferString...
    below is my example program which is not function...
    <input type="text" name="neg" size="35" value=''>
    <input type="text" name="dae" size="35" value=''>
    <input type="text" name="jdhm" size="35" value=''>
    <input type="text" name="mbp" size="35" value=''>
    <input type="text" name="notkt" size="35" value=''>
    <input type="text" name="noptk" size="35" value=''>
    <input type="text" name="nobgn" size="35" value=''>
    <input type="text" name="nodhm" size="35" value=''>
    <% String hak1="",hak2="",hak3="",hak4="",hak5="",hak6="",hak7="",
    tempNOPTK=request.getParameter("NOPTK"),
    tempNOTKT=request.getParameter("NOTKT"),
    tempNOBGN=request.getParameter("NOBGN"),
    tempNODHM=request.getParameter("NODHM"),
    tempJHM=request.getParameter("jdhm"),
    tempMBP=request.getParameter("mbp"),
    tempDAE=request.getParameter("dae"),
    tempNEG=request.getParameter("neg");
    if (tempNEG !=null && tempJHM !=null && tempMBP !=null && tempDAE !=null && tempNODHM !=null && tempNOBGN !=null && tempNOTKT !=null && tempNOPTK !=null)
    hak1=tempNEG.concat(tempDAE);
    hak2=hak1.concat(tempMBP);
    hak3=hak2.concat(tempJHM);
    hak4=hak3.concat(tempNODHM);
    hak5=hak4.concat(tempNOBGN);
    hak6=hak5.concat(tempNOTKT);
    hak7=hak6.concat(tempNOPTK);
    System.out.println(hak7);}
    %>
    <input type="text" name="id hakmilik" size="35" value='<%=hak7%>'>
    i want the id hakmilik textfield to appear the result..

    if (tempNEG !=null && tempJHM !=null && tempMBP !=null
    && tempDAE !=null && tempNODHM !=null && tempNOBGN
    !=null && tempNOTKT !=null && tempNOPTK !=null)
    {What happens if one of them is a null? That is why you are getting '""' displayed in the 'id hakmilik' field.
    One more point, try to avoid spaces in field names.(id hakmilik).
    Sudha

  • Problem inserting auto-sequence for PK value using trigger - ORA-02287

    I have a query where the sub-query is working. I created a table to receive the results of the query. I created a Sequence:
    CREATE SEQUENCE SEQ_RPT_H2_LOOPS
    MINVALUE 1
    START WITH 1
    INCREMENT BY 1
    NOMAXVALUE;
    Then I created a trigger:
    CREATE OR REPLACE TRIGGER TRG_RPT_H2_LOOPS
    BEFORE INSERT ON RPT_H2_LOOPS
    FOR EACH ROW
    BEGIN
    SELECT SEQ_RPT_H2_LOOPS.NEXTVAL INTO :NEW.RECORD_ID FROM DUAL;
    END;
    And here is the Insert query.
    accept month_year;
    accept prior_month_year;
    insert into rpt_h2_loops (
         RECORD_ID,
         MKT_CODE,
         MKT_NAME,
         ECCKT,
         VENDOR_ID,
         ECCKT_VENDOR_ID,
         OCN,
         FAC_TYP,
         ALOC,
         ZLOC,
         STATE,
         OCN_STATE,
         OCN_STATE_COLO,
         SRVC_TYP,
         CUR_PERIOD,
         PRIOR_PERIOD,
         TIME_STAMP )
    select seq_rpt_h2_loops.nextval
    ,substr(r.sub_acct,4,3)
    ,m.market
    ,rr.ckt
    ,rr.vendor_id
    ,rr.ckt||rr.vendor_id
    ,rr.ocn
    ,rr.srvc_typ
    ,'N/A'
    ,rr.zloc
    ,rr.st_cd
    ,rr.ocn||rr.st_cd
    ,rr.ocn||rr.st_cd||rr.zloc
    ,rr.srvc_typ
    ,'&month_year'
    ,'&prior_month_year'
    ,sysdate
    from rco.rate_route rr
    ,rco.cogs_resource r
    ,rco.cogs_mkt m
    where rr.cvbi_key = r.cvbi_key
    and     m.subacct = r.sub_acct
    and     to_char(rr.period, 'mm/yyyy') = '&month_year'
    and     to_char(r.period, 'mm/yyyy') = '&month_year'
    and     rr.srvc_typ = 'CUNE'
    group by    substr(r.sub_acct,4,3)
    ,m.market
    ,rr.ckt
    ,rr.vendor_id
    ,rr.ckt||rr.vendor_id
    ,rr.ocn
    ,rr.srvc_typ
    ,rr.zloc
    ,rr.st_cd
    ,rr.ocn||rr.st_cd
    ,rr.ocn||rr.st_cd||rr.zloc
    );The problem is that I am getting a ORA-02287: sequence number not allowed here on the NEXTVAL keyword.
    The sequence and trigger compiled without problem. I just can't seem to insert that value into the query. Any help would be appreciated.

    you are defeating the purpose of trigger which is before insert so just rewrite the query and remove the column for which value will be inserted using the created sequence and your code will work.
    Regards,
    Vikas Kumar

  • I'm looking for return value if trigger level is reached,in LABVIEW .NO data acquisition.

    I won't like to acquire data with the analog input , only a return value if the trigger level is reached, dearest a Bool expression to control another function, only to activate or deactivate this function. I use the PCI MIO 16E1 and Labview 6 and i hope there is someone who can help ; -)

    The DAQ Occurence will probably be the best option for you. It can be set to generate an occurence (interrupt) at a particular level. You won't get a BOOL output. Instead, you have another node (Wait on Occurence) that doesn't allow execution to continue until the occurence is generated.
    Otherwise, you may have to do a point-point comparison.

  • How catch variable value from trigger

    situation:
    I have trigger which is fired after update on any value in table aaa, trigger is used to archive all values in updated row from table aaa to table aaa_archive, in trigger is calculated sys_guid() ID for archive record ID, I need to get this ID, and forward to php code, because of some filesystem archive operations with files(files are archvived as well, and I need create connection between this file and archived record in DB).
    It is needed to use trigger instead of some own pl/sql archive procedure.
    Can somebody help?
    Thx :)

    Seems to me like you're not grasping how an INSERT works.
    SQL> create table foo_tab( guid varchar2(100), n number );
    Table created.
    SQL>
    SQL> create or replace trigger ins_foo_tab
    2 before insert on foo_tab
    3 for each row
    4 begin
    5 :new.guid := SYS_GUID();
    6 end;
    7 /
    Trigger created.
    SQL>
    SQL>
    SQL> insert into foo_tab( n ) values( 1 );
    1 row created.
    SQL>
    SQL> select * from foo_tab;
    GUID N
    42D0B3DA3E22D07EE040FB0A3A5D4C40 1
    SQL>
    SQL> -- from php
    SQL> var guid varchar2(100)
    SQL> insert into foo_tab( n ) values( 2 ) returning guid into :guid;
    1 row created.
    SQL> commit;
    Commit complete.
    SQL> -- from PHP
    SQL> print guid
    GUID
    42D0B3DA3E23D07EE040FB0A3A5D4C40
    SQL>
    SQL> select * from foo_tab;
    GUID N
    42D0B3DA3E22D07EE040FB0A3A5D4C40 1
    42D0B3DA3E23D07EE040FB0A3A5D4C40 2
    SQL>

  • Concat () values

    Hello,
    I am struggling with a concat statement. I need my value to display with () for the Last Name inside of them along with concat first name. But the () should only appear for every Last Name only. If there is no last name I do not want them to appear.
    select first_name|| ' '||last_name from oehr_employees
    Here is some example data. 
    Donald OConner
    John
    James John
    I need it to appear as....
    Donald (OConner)
    John
    James (John)John does not have a last name so the () should not display. Has anyone done this before?

    select first_name|| ' '||nvl2(last_name,'('||last_name||')',null) from oehr_employees

  • Using Value as trigger??? USB 6221

    Hi everybody,
    I have a problem. I have 8 DO and 8 AI and I want to record my AI but I want to start recording at a specific point. For example of an rising edge of my signal which should at least reach 4 Volts. Is this possible and how to do it.
    Another question is I want to know how long it is going to take my device to send out a signal and when I can receive it ( I connected DO with AI). Hoiw can I accomplish this test.
    thanks for answering

    Hi Leee,
    you only need to place the triggerfunction before the start function.
    You can see it in several examples fron the LabVIEW-Examples library like the Acq&Graph Voltage-Int Clk-Retriggerable.vi.If you use an analog Edge, you can choose a channel and and a level for this function to start.
    Regards,
    Philipp
    AE | NI Germany
    Attachments:
    Trigger.png ‏10 KB

  • Controlling which value changes trigger a CacheStore store()

    I cache objects with fields A,B & C and my CacheStore persists to a table with just columns A & B. I don't need to persist C. Is there some way to make it so store() isn't called when C is changed?
    Thanks,
    Andrew

    Hi Andrew,
    Here is write-through example:
    <?xml version="1.0"?>
    <!DOCTYPE cache-config SYSTEM "cache-config.dtd">
    <cache-config>
        <caching-scheme-mapping>
            <cache-mapping>
                <cache-name>test</cache-name>
                <scheme-name>test</scheme-name>
            </cache-mapping>
        </caching-scheme-mapping>
        <caching-schemes>
            <distributed-scheme>
                <scheme-name>test</scheme-name>
                <backing-map-scheme>
                    <read-write-backing-map-scheme>
                        <class-name>Main</class-name>
                        <internal-cache-scheme>
                            <local-scheme/>
                        </internal-cache-scheme>
                        <cachestore-scheme>
                            <class-scheme>
                                <class-name>Main$MyCacheStore</class-name>
                            </class-scheme>
                        </cachestore-scheme>
                    </read-write-backing-map-scheme>
                </backing-map-scheme>
                <autostart>true</autostart>
            </distributed-scheme>
        </caching-schemes>
    </cache-config>
    import com.tangosol.net.cache.ReadWriteBackingMap;
    import com.tangosol.net.cache.CacheLoader;
    import com.tangosol.net.cache.CacheStore;
    import com.tangosol.net.cache.AbstractCacheStore;
    import com.tangosol.net.BackingMapManagerContext;
    import com.tangosol.net.CacheFactory;
    import com.tangosol.net.NamedCache;
    import com.tangosol.util.ObservableMap;
    import com.tangosol.util.MapEvent;
    import com.tangosol.util.Base;
    import com.tangosol.util.NullImplementation;
    import java.util.Map;
    import java.io.Serializable;
    public class Main extends ReadWriteBackingMap
        public Main(BackingMapManagerContext ctxService, ObservableMap mapInternal, Map mapMisses, CacheLoader loader)
            super(ctxService, mapInternal, mapMisses, loader);
        public Main(BackingMapManagerContext ctxService, ObservableMap mapInternal, Map mapMisses, CacheLoader loader, boolean fReadOnly, int cWriteBehindSeconds)
            super(ctxService, mapInternal, mapMisses, loader, fReadOnly, cWriteBehindSeconds);
        public Main(BackingMapManagerContext ctxService, ObservableMap mapInternal, Map mapMisses, CacheLoader loader, boolean fReadOnly, int cWriteBehindSeconds, double dflRefreshAheadFactor)
            super(ctxService, mapInternal, mapMisses, loader, fReadOnly, cWriteBehindSeconds, dflRefreshAheadFactor);
        protected CacheStoreWrapper instantiateCacheStoreWrapper(CacheStore store)
            return new MyCacheStoreWrapper(store);
        protected class MyCacheStoreWrapper extends CacheStoreWrapper
            public MyCacheStoreWrapper(CacheStore store)
                super(store);
            protected void storeInternal(Object oKey, Object oValue)
                BackingMapManagerContext ctx = getContext();
                Object oValueNewReal = ctx.getValueFromInternalConverter().convert(oValue);
                Object oValueOldReal = null;
                Object oValueOld = getInternalCache().get(oKey);
                if (oValueOld != null)
                    oValueOldReal = ctx.getValueFromInternalConverter().convert(oValueOld);
                oValue = ctx.getValueToInternalConverter().convert(
                    new MapEvent(
                        NullImplementation.getObservableMap(), 0, null,
                        oValueOldReal,
                        oValueNewReal));
                super.storeInternal(oKey, oValue);
        public static class MyCacheStore extends AbstractCacheStore
            public Object load(Object oKey)
                return null;
            public void store(Object oKey, Object oValue)
                azzert(oValue instanceof MapEvent);
                MapEvent evt       = (MapEvent) oValue;
                Object   oValueNew = evt.getNewValue();
                 old value can be null (if it was evicted, or store is triggered by insert,
                 or not up to date if database was changed
                Object   oValueOld = evt.getOldValue();
                CacheFactory.log("storing " + oKey + " = " + oValueNew + ", old value = " + oValueOld);
        public static void main(String[] asArg)
            try
                NamedCache cache = CacheFactory.getCache("test");
                for (int i = 0; i <= 22; i++)
                    cache.put("foo", "value_" + i);
            catch (Throwable oops)
                Base.err(oops);
            finally
                CacheFactory.shutdown();
        }Regards,
    Dimitri

  • Concat rows values into single column

    Hi All,
    How can I concat values of a multiple rows into a single column by separating them by comma.
    Eg:
    SELECT empno FROM emp;
    empno
    1
    2
    3
    4
    I want output should be:
    Empnos
    1,2,3,4
    Thanks & Regards,
    Danish

    MichaelS wrote:
    Or
    SQL>  select rtrim(xmlagg(xmlelement(e, empno || ',')).extract('//text()').extract('//text()') ,',') empnos from emp
    EMPNOS                                                                         
    7369,7499,7521,7566,7654,7698,7782,7788,7839,7844,7876,7900,7902,7934 
    Hi Michael,
    is it an error or is it correct to put extract 2 times? This is giving to me the same result:
    select rtrim(xmlagg(xmlelement(e, empno || ',')).extract('//text()'),',') empnos from emp;
    EMPNOS                                                                         
    7369,7499,7521,7566,7654,7698,7782,7788,7839,7844,7876,7900,7902,7934           Regards.
    Al

  • Ovs value help in adobe forms

    Hi all,
        I am able to get the standard value help from sap on interactive form..
    But how to get the ovs value help for any field created in webdynpro on interactive forms..
    Pls help me reg this..
    Thank you

    Have a look at this link from the online help:
    [http://help.sap.com/saphelp_nw70/helpdata/EN/42/fb2fe500553ee4e10000000a1553f7/frameset.htm|http://help.sap.com/saphelp_nw70/helpdata/EN/42/fb2fe500553ee4e10000000a1553f7/frameset.htm]
    You have to be sure you are using the ZCI form type, but then it allows you to link the value help trigger within the adobe form to the Web Dynpro value help.  The same functionality is simply not available in the older ACF form type.

  • Trigger a process(IDOC) when Data in Z-table updated

    Hi All,
    I am working on an interface and the outbound IDOC from R/3 to XI needs to be triggered when a particular field value in a Z*table changes.
    So far I am able to trigger the IDOC from the calling Z*prog which updates this table, but I need some exit, PAI etc which will get triggered only when the data in table is updated.
    Current Flow chart:
    Z-prog starts--->Updates a Z-table--->if sy-subrc=0--->I create an IDOC from the Z-prog itself
    What I need:
    Z-table is updated--->check if particular filed value changed--->Trigger IDOC
    Is it possible to do this.
    Many thanks
    Shirin

    Hi Balu,
    I am triggering my IDOCS from the Z*program itself.
    The trigger point is when I have successfully updated the table (sy-subrc = 0).
    Then I have used the code below to populate my IDOC. I have also maintained a distribution model, so that is the reason I pass only the idoc type in edidc segment and do not pass any port , receiver etc.
    Hope you find the code useful.
    Regards
    Shirin
    Reward points if this was helpful.
    *Local Data Declaration
      DATA:  wa_msg_header TYPE zca_msg_header,
             wa_edidc      TYPE edidc,
             wa_edidd      TYPE edidd,
             i_edidc       TYPE edidc OCCURS 0,
             i_edidd       TYPE edidd OCCURS 0,
             wa_trailer    TYPE zca_gs_trailer,
             wa_count(10)  TYPE n,
             wa_allocation_response TYPE zca_allocation_response.
    *Populate IDOC segments
    * 1. Save the message type and the basic IDoc type* in the control segment
      MOVE 'ZMT_ALLOCATION_RESPONSE' TO wa_edidc-mestyp.
      MOVE 'ZGS_ALLOCATION_RESPONSE' TO wa_edidc-idoctp.
    * 2. Populate the Genius specific Message Header 'ZCA_MSG_HEADER'
      wa_msg_header-source        = 'SOURCE_SYST'.
      wa_msg_header-destination   = 'DESTINATION-LS.
      wa_msg_header-message_id    = ''.  "Populate this in XI
      wa_msg_header-date_time     = ''.  "populate this in xi.
      wa_msg_header-message_typ   = 'I'.
      wa_msg_header-status        = 'S'.
      MOVE 'ZCA_MSG_HEADER' TO wa_edidd-segnam.
      MOVE wa_msg_header    TO wa_edidd-sdata.
      APPEND wa_edidd       TO i_edidd.
      CLEAR wa_edidd.
    * 3 Populate the ALOCATION_RESPONSE segment
      CONCATENATE 'EXAM'
                   sy-datum
                   sy-uzeit
                   INTO
                   wa_allocation_response-uid.
    * wa_allocation_response-uid                 =  i_set_number  .
      wa_allocation_response-set_number          =  i_set_number .
      wa_allocation_response-trigger             =  '1' .              "Always default to Allocation Change   .
      wa_allocation_response-next_a_exam         =  i_next_a_exam .
      wa_allocation_response-miles_to_a          =  i_miles_to_a .
      wa_allocation_response-next_b_exam         =  i_next_b_exam .
      wa_allocation_response-miles_to_b          =  i_miles_to_b.
      wa_allocation_response-next_major_exam     =  i_next_maj_exam  .
      wa_allocation_response-miles_to_major_exam =  i_miles_to_maj_exam .
      MOVE  'ZCA_ALLOCATION_RESPONSE' TO wa_edidd-segnam.
      MOVE   wa_allocation_response   TO wa_edidd-sdata.
      APPEND wa_edidd                 TO i_edidd.
      CLEAR  wa_edidd.
    *4 Populate the Trailer record 'ZCA_TRAILER'
      wa_trailer-data_marker  = 'T'.
      wa_trailer-checksum     = wa_count.
      MOVE 'ZCA_TRAILER' TO wa_edidd-segnam.
      MOVE wa_trailer       TO wa_edidd-sdata.
      APPEND wa_edidd       TO i_edidd.
      CLEAR  wa_edidd.
    * Check for distribution model and create the IDOC
      CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE'
        EXPORTING
          master_idoc_control            = wa_edidc
        TABLES
          communication_idoc_control     = i_edidc
          master_idoc_data               = i_edidd
        EXCEPTIONS
          error_in_idoc_control          = 1
          error_writing_idoc_status      = 2
          error_in_idoc_data             = 3
          sending_logical_system_unknown = 4
          OTHERS                         = 5.
    * No need for error handling here as the IDOC will be created and ststus record will
    * mention the latest ststus including any error message.

  • How to get LOV column's DISPLAY value in IR report?

    Hi,
    I would like to get LOV column's DISPLAY value to trigger another javascript function. Could you please provide any hint?
    For example, there is one IR report with 2 column, DEPT_NAME & SHOW.
    The DEPT_NAME type is LOV .
    The SHOW column is one link image, when clicking it , I would like to fire a javascript to get DEPT_NAME 's display value.
    I know I can use #DEPT_NAME# to get the return value of LOV. However, how to get current row's DEPT_NAME's display value?
    Thanks in advance.
    Ray
    Edited by: 最爱用中文 on 2013-4-11 下午4:14

    Is there any way you can create a table join, instead of using LOV as your display type?
    That way you can select the name of the department in your IR query, display it as text, and then easily reference it as #DEPARTMENT_NAME#, for example.

Maybe you are looking for

  • RFC - XI - Mail scenario special characters

    Hi Experts, I'm developing the mentioned scenario and have one problem. In my scenario I have one transformation RFC -> XML that uses graphical mapping one second transformation XML -> Mail package that is a java mapping where I take one of the field

  • Error: no iView available for system "SAP_ERP_TalentManagement":

    Hi Experts, I am getting the following error in Ehp4 E-Recruitment application. There is no iView available for system "SAP_ERP_TalentManagement": object "talent_group". For more information, contact your administrator. we have deployed the business

  • 64 bit add on ard

    Experts, I want to convert one add on to 64 bit  and want to create ard for that? should i use "any CPU" in Properties->compile->Advanced compile option->Target CPU-> "Any CPU" ? i do not have 64 bit machine but i need to create the ard

  • InDesign CS4 Help is now live

    Even though InDesign CS4 hasn't shipped yet, weve just posted InDesign CS4 Help on the Web: http://help.adobe.com/en_US/InDesign/6.0/index.html We still have some work to do and bugs to fix, but we figured that youd get a lot of benefit from taking a

  • Font not recognized in LightRoom

    Hello all-- I have loaded a font onto my OS and although Word (etc) recognizes the font, LightRoom does not. Has anyone else come across this issue? Help! Thanks!