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.

Similar Messages

  • Need to Trigger an outbound Idoc when shipment manually deleted thru VT02N

    Hello All,
    Can anyone help me on this issue. I need to Trigger an outbound Idoc when shipment is manually deleted thru VT02N transaction.
    Please help me, how to do the output detemination or if is there any event trigger mechanism for this.
    Waiting for your response.
    Thank you.
    Sridhar Kanchibotla

    Hi,
    We need to display all the IDOC data on a Smartform layout. But we dont need the IDOC to be used for our requirement. So we want to make sure that IDOC is triggered but will not stay in 02 or other status.
    We have a process to monitor the failed idocs (02 status) and we do not want our idoc to have failed status. So we need the idocs to be tirggered directly with status 31 (thanks for letting me know that i cant use status 68 for outbound idocs).
    Thanks!

  • Trigger a process chain when user clicks on save button in web interface

    Hi All,
    This is a issue I'm facing with the BW BPS web interface.
    BPS web interface generates a BSP application so thought posting this question in BSP forum might get some responses.
    The issue is I have to trigger a process chain when the user clicks on the save button on the web interface.
    I have no clue how BSP works. So if anybody has any ideas or suggestions I would greatly appreciate it.
    Thanks,
    Harini

    Hi Dhanya,
    This is the code i have in the ABAP program in the process chain. I just included the API_SEMBPS_POST part, but still it doesn't work. Please give me your email address so that i can send some screenshots.
    REPORT  ZHTEST.
    DATA: l_subrc TYPE sy-subrc.
    DATA: ls_return TYPE bapiret2.
    CALL FUNCTION 'API_SEMBPS_POST'
    IMPORTING
       E_SUBRC         = l_subrc
       ES_RETURN       = ls_return.
    CALL FUNCTION 'RSAPO_CLOSE_TRANS_REQUEST'
      EXPORTING
        I_INFOCUBE               = 'ZMAP_TAB'
    EXCEPTIONS
      ILLEGAL_INPUT            = 1
      REQUEST_NOT_CLOSED       = 2
      INHERITED_ERROR          = 3
      OTHERS                   = 4
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.

  • How to trigger a workflow when data inside a table changes

    Hi
    How to trigger a workflow when data inside a table changes ??
    We need to trigger a workflow when STAT2 field value in PA0000 table changes.
    rgds
    Chemmanz

    Make use of Business Object BUS1065. In this business Object you have an attribute Status which you can use. There are a number of events that will get triggered when the status is changed.
    Thanks
    Arghadip

  • Configuration to trigger the EDI IDOC when posting

    Hi all,
    Can I know what is the configuration needed in order to trigger the EDI message type INVOIC IDOC when posting to certain company code (eg: AP10)?
    As I know for order acknowlegment need to do some configuration in Tcode v v13 in order to trigger the EDI...
    Please help.
    Thanks a lot.

    Hi,
    Please refer the below link:
    SAP IDoc Configuration Overview:
    http://www.topxml.com/biztalkutilities/walkthroughs/SAP%20IDoc%20Configuration.pdf
    SAP Network Blog: IDOC: EAN mapping in EDI orders:
    /people/michal.krawczyk2/blog/2006/12/22/idoc-ean-mapping-in-edi-orders
    Hope this helps.
    Please assign points as way to say thanks

  • How to trigger outbound IDOC when data changed in BP through Inbound IDOC.

    Hi,
        In our system whenever we create a new Business Partner, these data is send across to SAP R/3 (as BDOC) and to Mainframe system  (as outbound IDOC). Whenever we change any Business Partner record the data is send across to SAP R/3 (BDOC) and to Mainframe system (as outbound IDOC).
        This functionality is working fine.
        Currently we are getting a value for one standard field (Customer_Group3) of Business Partner as an inbound IDOC. The value of the inbound IDOC is reflecting in the field (Customer_Group3) in Business Partner Transaction. Once the inbound IDOC is received, the modified value is send across to SAP R/3 as BDOC. But the modified value is not send across to Mainframe system (outbound IDOC). The outbound IDOC is not getting triggered.
    Kindly help

    Is your mainframe system configured as Site in SMOEAC. If so are you using XIF Adapter.

  • Which trigger to use for insert data into db table in Forms

    Hi,
    My form is current having a database block with table reference. When enter data into form field and click on save button. Automatically the record is inserted into database table.
    I want to make this as manual insert. I changed the data block to a non-database. Where should i write the insert statement in order to insert data into table.
    Is it Key-commit trigger at form level?
    Please advise.
    Thanks,
    Yuvaraaj.

    Hi Yuvaraaj.
    Insert should happen when we click on the save which is inbuilt in the form. In this case where should i write the insert statement.Forms in built save commit's the form data where block is based on database not non database.
    @2nd reply
    Ypu are right. The reason i chnaged the database block to non-database is Currently i have a database block with form field canvas which insert only 1 record in to >table when we click on standard save button. The requirement was to add a field called CHANNEL which should have multiple values displayed. (i created this channel >field in a seperate datablock (non database) and used the same canvas.) When we insert data in all fields (single record) and channel we should be able to selected >multiple channel (say A,B and C) when we click on save then 3 records should be inserted in to the table which looping values for each channel. This was the actual >requirement and this is the reason why iam changing the block to non-database block.You are talking about two blocks.. 1. Master block and 2. Details block name channel
    You are inserting one record in master block then insert 3 record name A,B,C for that master record.
    Now you want master record should insert to each A,B,C record. Means
    'how are you' --master record
    and you want
    'A'- 'how are you'
    'B'- 'how are you'
    'C'- 'how are you'OR
    ?Ok. If you want master record save in database and then want to save non-database(channel) data into database USE Post-Insert trigger at block level and do the rest.
    Hope this helps...
    Hamid
    Mark correct/helpful to help others to get right answer(s).*
    Edited by: HamidHelal on Jan 26, 2013 1:20 AM

  • Refresh af:table when data in another table changes

    Hi
    I am using jdev 11.1.1.7.0 and using bean datacontols..
    I have 2 tables in the same page..
    1. Language table
    2. Items table
    Language table has CRUD operations like user can created new language. The items table is a dynamic table with one fixed column that is "item" and remaining are the language columns.
    So, if user give 3 languages in first table then the second table will have "item" + 3 columns i.e 1 column for each language. .
    Because these 2 tables are on the same page.. I need to refresh the items table to show new column when user creates new language in the language table.. what is the best way of doing this?
    Thanks

    Jdev 11.1.1.7 is not oficialy released yet, so I suppose you are Oracle employee, right ?
    As I understand, you have you own internal forum, right ?
    BTW, you probably have something like "Commit" button, or similar. So set partlalTrigger for the Items table to that Commit button...

  • To know when data in a table is inserted,deleted.

    I have to execute a report as soon as data in a specifix table is inserted or deleted.
    Please guide me how to do this.

    Hi,
    Value in table dbtablog is insterted as soon as someone logs in.
    I have execute a report as soon as changes are recorded in dbtablog.
    Please guide me how to do this.

  • Data dictionary for table updates

    Hi,
    I want to know which audit tables are to be looked into to see a particular transaction done on a db table.
    For ex:- I've updated a table(say Tab1) and I want to know when,by whom and what changes they have done Tab1.
    Thanks in advance

    For information on Oracle Auditing refer to :
    http://download-west.oracle.com/docs/cd/A87860_01/doc/server.817/a76956/audit.htm#1108

  • Copying large amount of data from one table to another getting slower

    I have a process that copies data from one table (big_tbl) into a very big archive table (vb_archive_tbl - 30 mil recs - partitioned table). If there are less than 1 million records in the big_tbl the copy to the vb_archive_table is fast (-10 min), but more importantly - it's consistant. However, if the number of records is greater than 1 million records in the big_tbl copying the data into the vb_archive_tbl is very slow (+30 min - 4 hours), and very inconsistant. Every few days the time it takes to copy the same amount of data grows signicantly.
    Here's an example of the code I'm using, which uses BULK COLLECT and FORALL INSERST to copy the data.
    I occasionally change 'LIMIT 5000' to see performance differences.
    DECLARE
    TYPE t_rec_type IS RECORD (fact_id NUMBER(12,0),
    store_id VARCHAR2(10),
    product_id VARCHAR2(20));
    TYPE CFF_TYPE IS TABLE OF t_rec_type
    INDEX BY BINARY_INTEGER;
    T_CFF CFF_TYPE;
    CURSOR c_cff IS SELECT *
    FROM big_tbl;
    BEGIN
    OPEN c_cff;
    LOOP
    FETCH c_cff BULK COLLECT INTO T_CFF LIMIT 5000;
    FORALL i IN T_CFF.first..T_CFF.last
    INSERT INTO vb_archive_tbl
    VALUES T_CFF(i);
    COMMIT;
    EXIT WHEN c_cff%NOTFOUND;
    END LOOP;
    CLOSE c_cff;
    END;
    Thanks you very much for any advice
    Edited by: reid on Sep 11, 2008 5:23 PM

    Assuming that there is nothing else in the code that forces you to use PL/SQL for processing, I'll second Tubby's comment that this would be better done in SQL. Depending on the logic and partitioning approach for the archive table, you may be better off doing a direct-path load into a staging table and then doing a partition exchange to load the staging table into the partitioned table. Ideally, you could just move big_tbl into the vb_archive_tbl with a single partition exchange operation.
    That said, if there is a need for PL/SQL, have you traced the session to see what is causing the slowness? Is the query plan different? If the number of rows in the table is really a trigger, I would tend to suspect that the number of rows is causing the optimizer to choose a different plan (with your sample code, the plan is obvious, but perhaps you omitted some where clauses to simplify things down) which may be rather poor.
    Justin

  • Moving Data from Normal table to History tables

    Hi All,
    I'm in the process of moving data from normal tables to
    History tables.
    It can be some sort of a procedure which should be a cron job running at night.
    My aim is to move data say 1.5 yrs or 2yrs old data to History tables.
    What aspects i need to check when moving data. And how can i write a procedure for this requirement.
    The schema is same in both the normal table and history table.
    It has to be a procedure based on particular field RCRE_DT.
    If the rcre_dt is above 2 yrs the data needs to be moved to HIS_<table>.
    I have to insert record in to HIS_table and simultaneously delete record from the normal table.
    This is in Production system and the tables are quite big.
    Pls do find enclosed the attached sample schema for Normal table and HIS_<table>.
    If i want to automate this script as a Cron job for similarly other History tables
    how am i to do it in a single procedure assuming the procedure for moving the data is the same procedure.
    Thanks for ur help in advance.
    SQL> DESC PXM_FLT;
    Name Null? Type
    RCRE_USER_ID NOT NULL VARCHAR2(15)
    RCRE_DT NOT NULL DATE
    LCHG_USER_ID VARCHAR2(15)
    LCHG_DT DATE
    AIRLINE_CD NOT NULL VARCHAR2(5)
    REF_ID NOT NULL VARCHAR2(12)
    BATCH_DT NOT NULL DATE
    CPY_NO NOT NULL NUMBER(2)
    ACCRUAL_STATUS NOT NULL VARCHAR2(1)
    FLT_DT NOT NULL DATE
    OPERATING_CARRIER_CD NOT NULL VARCHAR2(3)
    OPERATING_FLT_NO NOT NULL NUMBER(4)
    MKTING_CARRIER_CD VARCHAR2(3)
    MKTING_FLT_NO NUMBER(4)
    BOARD_PT NOT NULL VARCHAR2(5)
    OFF_PT NOT NULL VARCHAR2(5)
    AIR_CD_SHARE_IND VARCHAR2(1)
    UPLOAD_ERR_CD VARCHAR2(5)
    MID_PT1 VARCHAR2(5)
    MID_PT2 VARCHAR2(5)
    MID_PT3 VARCHAR2(5)
    MID_PT4 VARCHAR2(5)
    MID_PT5 VARCHAR2(5)
    PAX_TYPE VARCHAR2(3)
    PAY_PRINCIPLE VARCHAR2(1)
    SQL> DESC HIS_PXM_FLT;
    Name Null? Type
    RCRE_USER_ID NOT NULL VARCHAR2(15)
    RCRE_DT NOT NULL DATE
    LCHG_USER_ID VARCHAR2(15)
    LCHG_DT DATE
    AIRLINE_CD NOT NULL VARCHAR2(5)
    REF_ID NOT NULL VARCHAR2(12)
    BATCH_DT NOT NULL DATE
    CPY_NO NOT NULL NUMBER(2)
    ACCRUAL_STATUS NOT NULL VARCHAR2(1)
    FLT_DT NOT NULL DATE
    OPERATING_CARRIER_CD NOT NULL VARCHAR2(3)
    OPERATING_FLT_NO NOT NULL NUMBER(4)
    MKTING_CARRIER_CD VARCHAR2(3)
    MKTING_FLT_NO NUMBER(4)
    BOARD_PT NOT NULL VARCHAR2(5)
    OFF_PT NOT NULL VARCHAR2(5)
    AIR_CD_SHARE_IND VARCHAR2(1)
    UPLOAD_ERR_CD VARCHAR2(5)
    MID_PT1 VARCHAR2(5)
    MID_PT2 VARCHAR2(5)
    MID_PT3 VARCHAR2(5)
    MID_PT4 VARCHAR2(5)
    MID_PT5 VARCHAR2(5)
    PAX_TYPE VARCHAR2(3)
    PAY_PRINCIPLE VARCHAR2(1)

    Hi All,
    Thanks for ur valuable suggestion.But can u explain me bit more on this as i'm still confused about switching between partitoned tables and temporary table.Suppose if i have a table called PXM_FLT and an correspoding similar table named HIS_PXM_FLT.How can i do the partitioning shd i do the partitioning on the normal table or HIS_PXM_FLT.i do have a date field for me to partition based on range.Can u pls explain why shd i again create a temp.table.What's the purpose.Now the application is designed in such a way that old records have to be moved to HIS_PXM_FLT.can u pls highlight more on this.Your suggestions are greatly appreciated.As i'm relatively new to this partitioning technique i'm bit confused on how it works.But i came to understand Partitioning is a better operation than the normal insert or delte as it is more data intensive as millions of record need to be moved.Thanks for feedback and ur precious time.

  • SELECT is taking lot of time to fetch data from cluster table BSET

    <Modified the subject line>
    Hi experts,
    I want to fetch data of some fields from bset table but it is taking a lot of time as the table is cluster table.
    Can you please suggest me any other process to fetch data from cluster table. I am using native sql to fetch data.
    Regards,
    SURYA
    Edited by: Suhas Saha on Jun 29, 2011 1:51 PM

    Hi Subhas,
    As per your suggestion I am now using normal SQL statement to select data from BSET but it is still taking much time.
    My SQL statement is :
    SELECT BELNR
                  GJAHR
                  BUZEI
                  MWSKZ
                  HWBAS
                  KSCHL
                  KNUMH FROM BSET INTO CORRESPONDING FIELDS OF TABLE IT_BSET
                  FOR ALL ENTRIES IN IT_BKPF
                  WHERE BELNR = IT_BKPF-BELNR
                      AND BUKRS = IT_BKPF-BUKRS.
    <Added code tags>
    Can you suggest me anymore?
    Regards,
    SURYA
    Edited by: Suhas Saha on Jun 29, 2011 4:16 PM

  • Trigger Idoc when Batch is created or changed

    Hello,
    We have to transfer Batch ID,Status and Batch Characteristics through IDoc to PI when Batch is created or updated. This can be possible by 3 scenarios.
    When Batch is created or updated manually through Tcode MSC1N.
    When Batch is created or updated at the time of Goods Receipt.( Tcode MIGO)
    When Batch is created or updated at process order creation.(After Release of Process order) Tcode COR1.
    For first 2 scenarios we have found user exit 'EXIT_SAPLCLFM_002' from where we can fill the required Idoc data and trigger IDoc to PI system.
    Also for third scenario we have found user exit 'EXIT_SAPLCOBT_001' where we can get Batch Data but not the characteristics data that is created or updated.
    In both the above cases User Exit is fired before Commit to database statement. Therefore my query is whether we can trigger IDoc through Z function modules in these user exits in update mode?
    Can you provide any input on this situation or can you suggest any alternative method or exits to achieve this functionality?

    BATMAS / BATMAS03 -  for Tcode MSC1N.
    And  I  have only information that there is a SAP note is available on this.
    865778 MIGO to post a goods receipt for a purchase order
    Thanks.

  • Inbound processing of transactional Data(ALE-IDOC)

    Hello,
    Please guide me for Inbound processing of transactional data(ALE-IDOC).
    Thanks.

    Hi Sanjiv,
    The two available process for IDOCs are
    Outbound Process
             Sending out the data from our system. The IDOC which is called as Outbound IDOC.
                      Application Object
                                  |
                    Selection Program
               IDoc_output_<messagetype>
                                  |
                    Outbound Trigger Program
                                 |
                       IDOC in text format
    Inbound Process
              When the data is coming in, the process is called Inbound Process and the IDoc is known as Inbound IDoc
                    Application Object
                                  |
                    Posting Program
             IDoc_inbound_<messagetype>
                                  |
                    Inbound Trigger Program
                                 |
                       IDOC in text format
    Regards,
    SuryaD.

Maybe you are looking for