Reg:Insert the record in another ztable

Hi Experts,
                  My scenerio is that when a record is inserted from a program to a table i need to added the same values to another table which is on different server(ex: BW). Is it necessary to create events to do that because i don't need table maintainance generator or any other way.
Regards,
Vinoth

Hi,
In your case, you can do either of the following:
1) Create RFC FM in other system (say, B) to update the Z table. (as suggested by Klaus)
In SM59, maintain connection between your current system (say, system A) and the other system (B).
In current system (A) program, call the RFC using destination keyword to update other system's (B) table.
OR
2) You can send IDOc to the other system and update the Z table (this may involve a lot of mapping and ALE configuration). Generally in SAP XI system, we map the fields with the sender system and update the records at the receiving end.
Do let us know how you solved your problem.
Regards,
Saba

Similar Messages

  • Triggers to insert the record in a table

    I have two table 1. Holiday 2. Attendance.
    When I insert the record    in holiday table for his
     advance holiday   with empid, the same time I want to insert it attendance table
     automatically for the same date using a trigger
    Insert into attendance (empid,date,holiday) values (20078,07/10/2014,1). If holiday column value 1 represent holiday marked,
     0 represent  holiday not marked. The same thing can happen vice versa
    If employee mark his current attendance as  holiday through attendance,
     it should   be  inserted into holiday table 
    automatically using triggers.
    Insert into  Holiday (empid,date,holiday) values (20078,06/08/2014,1). If holiday column value 1 represent holiday marked,
     0 represent  holiday not marked. The same thing can happen vice versa
    Please I am looking for your help , how I can make it using triggers 
    to insert both table  in two different ways of options.
    Regards
    Pol
    polachan

    Hi polachan,
    According to your description, if you want to synchronize the data between the holiday table and the attendance table while inserting records into holiday table, you need to create a trigger on the holiday table, please try the following syntax.
    use <databasename>
    go
    create trigger Tr_holiday
    on holiday
    for insert
    as
    declare @empid varchar(20),
    @date datetime,
    @holiday int
    select @empid = empid, @date=date, @holiday=holiday from inserted
    declare @qty int
    select @qty =count(*) from attendance where empid=@empid and date=@date and holiday=@holiday
    if @qty<1
    begin
    insert into attendance
    select i.empid,
    i.date,
    i.holiday
    from inserted i
    end
    Meanwhile, if you want to insert the record into the holiday table when holiday is updated to 1 in the attendance table, you need to create another trigger on the attendance table, please try the following syntax.
    use <databasename>
    go
    create trigger Tr_attendance
    on attendance
    for update
    as
    declare @holiday int
    if update (holiday)
    begin
    select @holiday=holiday from inserted
    if @holiday=1
    begin
    insert into dbo.holiday
    select empid,
    date,
    holiday
    from inserted
    end
    end
    For more details about creating triggers in SQL Server, please review this article:
    CREATE TRIGGER (Transact-SQL).
    Thanks,
    Lydia Zhang

  • How to insert the records using sql query

    hi,
    i insert the record uisng sql query and DOTNET programme successfully and increase the doc num .ubut when i try to  add record using SAP B1 the old Doc no show.It means its not consider the docnums which are not inserted by sql query.
    how can i solve this problem?
    Regards,
    M.Thippa Reddy

    You are not support use Insert / Update / Delete on SAP Databases directly.
    SAP will not support any database, which is inconsistent, due to SQL-Queries, which modify datasets or the datastructure of the SAP Business One Database. This includes any update-, delete- or drop-statements executed via SQL-Server Tools or via the the query interface of SAP Business One
    Check SAP Note: 896891 Support Scope for SAP Business One - DB Integrity
    [https://websmp130.sap-ag.de/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/smb_searchnotes/display.htm?note_langu=E&note_numm=896891]

  • How to update and insert the records without using Table_comparison and Map_operation?

    How to update and insert the records without using Table_comparison and Map_operation?

    Use either join or MERGE see this Inserting, Updating, and Deleting Data by Using MERGE

  • How Can insert the records into Excel_sheet by using SQL Task-SSIS ?

    As per requirement ,
    insert the records in excel sheet(DT)  by using SQL Task-SSIS .
    I used SQL query in SQL Task-SSIS:
    e.g.., INSERT INTO [DT$B1:B1] VALUES ('COMMM')
    but error:Executing the query "INSERT INTO [DT$B1:B1] VALUES ('COMMM') " failed with the following error: "This table contains cells that are outside the range of cells defined in this spreadsheet.". Possible failure reasons: Problems
    with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
    Please any suggestion  ...
    -MADHU

    then first create a table inside Excel sheet based on your source data. You can Execute sql task for that using excel connection. then use insert to populate it
    see an example here where I create a dynamic sheet using execute sql task
    http://visakhm.blogspot.in/2013/09/exporting-sqlserver-data-to-multiple.html
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • Insert Multiple Records into Multiple ZTABLEs inside the BAPI

    Hi,
    I have a requirement to Insert or Update Multiple Records into a ZTABLE inside the BAPI. Is there any special approach inside the BAPI to insert or update ZTABLEs with multiple records. It looks like the simple INSERT Statement is not working. Can you please suggest me a Suitable solution for this req?
    Thanks and Regards,
    Kannan

    Hi,
    INSERT ZTABLE FROM TABLE ITAB.
    The itab structure should be of the structure ZTABLE..
      Same for MODIFY and update.
      MODIFY ZTABLE FROM TABLE ITAB..
    Thanks,
    Naren

  • RE: Pbm in alv for copying and inserting the record....

    Hi,
       I am developing alv gird  report...............what my issue is:
      while selecting a record...........he should copy the record and insert a new record
      below on which he selected....
      Regarding this if anybody helps me that will be appreciable...
    Regards,
    Naveen M.

    hai Do like This:
    at user command
    FORM PICK USING COMMAND LIKE SY-UCOMM SELFIELD TYPE SLIS_SELFIELD. "Pick is name  given in REUSE_ALV_GRID
    READ TABLE idata INTO wa_data INDEX SELFIELD-TABINDEX.
    CASE COMMAND.
    WHEN '&IC1'.
    Select second data according to your requirement in Another internal  table.
    newdata[] = idata[]. "Move ur first table display data to one new internal tabe.
    clear idata[].
    append wa_data to idata.
    now move data which was selected in select statement to idata table and append data. "it will add new data in idata table
    after this get previous data in idata
    READ TABLE newdata INTO wa_data INDEX SELFIELD-TABINDEX.
    clear wa_data.
    modify newdata index sy-tabix.
    delete newdata where "it is initial.
    loop at newdata.
    idata = newdata.
    append idata.
    endloop.
    after this call reuse_alv_grid_display.
    endcase
    endform.

  • How to insert a record in another table

    Hi,
    Can you please help with this urgent problem.
    Suppose my data model is
    SELECT id
    FROM emp
    WHERE salary < 10000
    I would like to create a record in another table for EACH emp.id returned, I wonder which trigger is appropriate to place the INSERT statement?
    And I DON'T want to do like this
    SELECT id, Create_Record(:id)where Create_Record is a function.
    Hope the information here is sufficient.
    Thanks

    Hien
    I had a similar requirement to you and put the code on a push button. In my case the reports are being run interactively to the screen and then printed, and I have no way to know whether the report had actually been printed, so we rely on the user pressing the button. Of course there is a danger that the user forgets to press the button, but in our situation that would not be disasterous. Whatever method is used, I don't think there is any way to be sure that it has actually come out of the printer.

  • How to get the record selected in ztable based record in the output of alv

    Hi All,
    I have developed a report, it is displaying the output in ALV format.The list contained some 20 fields along with MATERIAL and BATCH. I have provided menu bar as extras -> ztable(it also contained MATERIAL and BATCH). But I have some issue when I select any record in the output then go to
    path extras -> ztable, it has to select the record in ztable based MATERIAL and BATCH which i have selected in the output, then can you please provide solution for the above problem.
    Thanks in advance

    Hi Dolly,
    you can do this by,
    data: index_rows type lvc_t_row,
          index like line of index_rows.
    * Get Selected rows from alv grid
      clear index_rows.  refresh index_rows.
    "When you choose extras->ztable
      call method alv_grid->get_selected_rows
               importing
                     et_index_rows = index_rows.
    * Now delete those rows from the ALV grid
      loop at index_rows into index.
        read table itab index index-index. "Lets say itab is the table you are displaying
        if sy-subrc = 0.
         perform bdc_sm30. "do simple bdc for sm30 with tab name and selected values
        endif.
      endloop.
    Regards,
    Manoj Kumar P
    Edited by: Manoj Kumar on Feb 23, 2009 2:49 PM

  • Problem in Inserting the new values into Ztable

    Hi Techies,
    I have a requirement that when ever user enters the value in Billing Qty input which is in VF01 tcode and the table is VBRP-FKIMG, and client want billing qty and previous month reading, the fields are not in VBRP. So I have created a custom table name as YSD-EXPORT_QTY with fields of CUSTOMER, MONTH, YEAR, BILL_QTY, PREV_READING, CUMULATIVE... When ever user enter the Billing Qty I want to update database table and initally there is no data in custom table. I tried below code but i am not getting and i am getting the error as
    "The type of the database table and work area (or internal table) "WA_EXPORT" are not Unicode convertible. "
    So, How can I resolve this issue.. I am trying this since from 3 days... if u have any sample code please give me...
    MOVE WA_VBRP-FKIMG TO WA_EXPORT-BILL_QTY.
    WA_EXPORT-CUMULATIVE = WA_EXPORT-BILL_QTY + WA_EXPORT-PREV_READING.
    WA_EXPORT-PREV_READING = WA_EXPORT-CUMULATIVE.
    APPEND WA_EXPORT TO IT_EXPORT.
    INSERT INTO YSD_EXPORT_QTY VALUES WA_EXPORT.

    If it overrides existting record, you should add new key fields to your database table, there can be only one record per set of key values.
    I suppose  keys look like MANDT, KUNNR, GJAHR, MONAT or MANDT VBELN POSNR or a combination of both set of keys (not sure to understand you requirement)
    You have to first read from database if some data already exists,
    - if yes, add the new quantities and UPDATE the record
    - if no, INSERT a new record
    Remember keys define a unique record, and cannot be updated once inserted.
    If your program should never update records, add a "technical" key field, and fill it using a timestamp or a number range counter (FM NUMBER_GET_NEXT)
    Regards,
    Raymond

  • Moving the record to another internal table.

    dear all,
    i am having two internal tables . itab & itab1.
    itab contains matnr   plant   quantity     date
                        100      500      1000       yyyy/mm/10
                        100      500      2000       yyyy/mm/20.
              i have to move the records to itab1 if dd less than 15 quantity should be moved to  q1 if gt 15 then the quantity should be moved to same q2 in a same line.
    i want itab1 to be
               matnr   plant     q1        q2
              100       500      1000       2000.
    regards ,
    balaji

    hi Balaji,
    Please use the following logic:
    data:
         v_dd(2).
    loop at itab.
          itab1-matnr = itab-matnr.
          itab1-plant = itab-plant.
          v_dd = itab-date+8(2).
          read table itab1 with key matnr = itab1-matnr
                                             plant   = itab1-plant.
          if v_dd < 15.
                itab1-q1 = itab1-q1 + itab-quantity.
          else.
                itab1-q2 = itab1-q2 + itab-quantity.
          endif.
          if sy-subrc = 0.
                 modify itab1 index sy-tabix.
          else.
                append itab1.
          endif.
          clear itab1.
    endloop.
    Hope this helps,
    Sajan Joseph.

  • Reg : Find the records  in Table control

    Dear all
    Im having one requirement in table control .  In my table control totally 100 records contains sales documents
    for Example
    100010
    100020
    100030
    In that Records how to find particluar sale document in table control. How to build find option in table control.
    If possible or not
    Thanks & regards
    Sri

    Hi Sridhar,
    You need to implement amodal screen for this and a Find button above the table control.
    or you can use POPUP_GET_VALUES FM
    after you enter a value in the POP up screen.
    " You need to put some effort to implement this, wish you to implement it successfully as this is possible
    READ TABLE ITAB WITH KEY VBELN = FIND_VBELN. " FIND_VBELN is the field on your find screen.
    if sy-subrc = 0.
    tc-top_line = sy-tabix. " this makes the record visible in the First position
    endif.
    PROCESS AFTER INPUT.
      LOOP AT itab.
        MODULE find.
      ENDLOOP.
    In Program
    MODULE find INPUT.
      DATA : tab TYPE STANDARD TABLE OF sval WITH HEADER LINE.
      REFRESH tab.
      CASE ok_code.
        WHEN 'FIND'.
          clear ok_code.
          tab-tabname = 'VBAK'.
          tab-fieldname = 'VBELN'.
          APPEND tab.
          CALL FUNCTION 'POPUP_GET_VALUES'
            EXPORTING
    *   NO_VALUE_CHECK        = ' '
              popup_title           = 'Find Sales Order'
       start_column          = '5'
       start_row             = '5'
    * IMPORTING
    *   RETURNCODE            =
            TABLES
              fields                = tab
    EXCEPTIONS
       error_in_fields       = 1
       OTHERS                = 2
          IF sy-subrc = 0.
            READ TABLE itab WITH KEY vbeln = tab-value.
            IF sy-subrc = 0.
              tc-top_line = sy-tabix.
            ENDIF.
          ENDIF.
      ENDCASE.
    ENDMODULE.                 " find  INPUT
    Cheerz
    Ram

  • Insert the record from XML file to Tables.

    Hi guys,
    I ill be getting the XML file from FRONT-END.It ill be stored one permanent location(Directory).I need to Insert the data to the corresponding table.Anybody knows Pls give some suggestion for this.......
    Regards....
    GKM

    Using the Oracle XML DB Webdav are is one method as it acts like a file system, but essentially get's the documents directly into the database so they can be queried through the resouce_view.
    Other methods involve reading the file as if it's a CLOB and then using XMLTYPE constructor to change that CLOB to an XMLTYPE which can then be stored as that datatype in the database or processed as you need.
    The best place to look is over in the XML DB forum, which has it's own FAQ detailing various best practices for all sort of XML stuff, including reading XML files and shredding them into relational tables etc.
    {thread:id=410714}
    Edited by: BluShadow on 18-Jan-2012 08:53
    corrected link

  • Inserting the records into the table

    Hi,
    I defined a procedure as follows
    create ....
    Cursor C1 is
    select item_id,item_name from item;
    Inert into abc.t3_clas(id,name) values(NVL(c1.item_id,' '),c1.item_name);
    end;
    Cursor C1 is having data. There are no null values.
    But after executing the procedure it's working fine but it is not loading the data.
    Could you please help me out where I need do check to find out the problem.
    Thanks.

    832581 wrote:
    create or replace
    PROCEDURE cust_load AS
    <var declaration)
    CURSOR C1 IS
    SELECT a.item_num,a.item_name FROM
    (SELECT ltrim(rtrim(item_num)) itemnum,
    item_name, item_cd, item_typ
         FROM abc.item_wrkg
              UNION ALL
              SELECT ltrim(rtrim(item_num)) itemnum,
    item_name, item_cd, item_typ
         FROM abc.item_w_cd ) a
    WHERE a.item_cd = '01'
    AND a.item_typ = '28';
    BEGIN
    DBMS_OUTPUT.ENABLE(100000);
    lvb_trun_tbl := DWB.DWB_truncate_tbl('ITEM_CTGRY');
    IF NOT lvb_trun_tbl THEN
    RAISE lve_trunc_failed;
    END IF;
    FOR c_rec in c1 LOOP
    INSERT INTO abc.item_ctgry(ctgry_cd,
    ctgry_name)
    VALUES (NVL(c_rec.itemnum,' '),
    c_rec.item_name);
    lvn_rec_count := lvn_rec_count + 1;
    IF MOD(lvn_rec_count,lvn_commit_seq) = 0 THEN
    COMMIT;
    END IF;
    END LOOP;
    COMMIT;
    IF lvn_rec_count = 0 THEN
    RAISE lve_no_rec_found;
    END IF;
    DBMS_OUTPUT.PUT_LINE('abc.item_CODE_LOAD - Rows loaded: '|| TO_CHAR(lvn_rec_count));
    EXCEPTION
    WHEN lve_trunc_failed THEN
    DBMS_OUTPUT.PUT_LINE(' Truncation failed');
    WHEN lve_no_rec_found THEN
    DBMS_OUTPUT.PUT_LINE(' No rows inserted');
    WHEN OTHERS THEN
    DBMS_OUTPUT.PUT_LINE('SQLERRM);
    END;
    this is the procedure....
    please look into this and give me your suggestions.
    Thanks.You still hiding the code...
    But its not throwing any error means ur logic is going wrong somewhere..
    post your whole code.
    and put the below tag line before and end of code..
    Regards
    Umesh                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Unable to insert the record to table using pre-insert & pre-update trigger

    Hi All,
    I have tried to insert and update the backend table using the pre-update and pre-insert triggers. But its not working for me. Please find below the code which i have used in the triggers.
    Pre-insert trigger:
    DECLARE
    v_cust_num_cnt NUMBER;
    BEGIN
              SELECT      COUNT(customer_number)
              INTO      v_cust_num_cnt
              FROM cmw_bc_mobile_number
              WHERE substr(customer_number,1,15)=substr(:BLOCKNAME.CUSTOMER_NUMBER,1,15);
              IF      v_cust_num_cnt = 0 THEN
                        INSERT INTO cmw_bc_mobile_number (CUSTOMER_NUMBER
                                                                                                   ,MOBILE_NUMBER
    ,CREATION_DATE
    VALUES
    (substr(:BLOCKNAME.CUSTOMER_NUMBER,1,15)
    ,:BLOCKNAME.MOBILE_NUMBER
    ,SYSDATE
    COMMIT;                                                                                                    
    END IF;          
    END;
    PRE_UPDATE TRIGGER:
    BEGIN
              IF :SYSTEM.RECORD_STATUS = 'CHANGED' THEN
              UPDATE apps.cmw_bc_mobile_number
         SET mobile_number = :BLOCKNAME.MOBILE_NUMBER,
         creation_date = SYSDATE
              WHERE customer_number=substr(:BLOCKNAME.CUSTOMER_NUMBER,1,15);
              COMMIT;
         END IF;
    EXCEPTION
              WHEN OTHERS THEN
                   NULL;     
    END;
    Please let someone assist in gettting it resolved.
    Regards,
    Raj.

    Just use MESSAGE (we don't know what fnd_message is, that is some custom code):
    message('v_cust_num_cnt='||v_cust_num_cnt);
    IF v_cust_num_cnt = 0 THEN
      message('Now inserting...');
      INSERT INTO cmw_bc_mobile_number (CUSTOMER_NUMBER... 
    else
      message('Nothing to insert');
    end if;

Maybe you are looking for