Delete inserted record

I bulid trigger in tabel and check condition, if for example check_statment = X i need to delete inserted record (that mead not insert record) and when check_statment = Y then insert record in table, i try to write delete statment and rollback but there is error appear that the current record are reserved.
How i can solve it.

1. Triggers cannot Issues ROLLBACK, SAVEPOINT, COMMIT statements.
2. I guess you are trying to avoid duplicate records, Create a unique index on the key(col1,col2) which you want to prevent duplicates on.
3. Or you can Add a column Flag Chr(1) to your table. While inserting you allow the records to get inserted, but based on your condition change the Flag to 'D' - deleted , 'A' -active. Build a View which the user uses for application filtering out the 'D'eleted records.
Does this look like what you are trying to do !
Ss

Similar Messages

  • How can i display recent update/delete/insert records in form

    Hai !!!!
    i am new for forms,.......any body tell me, how can i display recent no of records updated or no of records deleted or no of records are inserted in a form. these records count are display in display items....give me detail explination......
    Subbu.....

    the easiest way is copy and paste the oracle-forms example from the OU.
    You need form-level-trigger ON-ERROR + ON-MESSAGE, POST-INSERT, POST-UPDATE, POST-DELETE, three global variables and a procedure:
    ON-ERROR
    handle_message( error_code, 'ERROR: ' || ERROR_TYPE || '-' || TO_CHAR(ERROR_CODE) ||': '|| ERROR_TEXT );
    ON-MESSAGE
    handle_message( message_code, MESSAGE_TYPE || '-' || TO_CHAR(MESSAGE_CODE) || ': ' || MESSAGE_TEXT );
    PROCEDURE handle_message( message_number IN NUMBER, message_line IN VARCHAR2 ) IS
    BEGIN
        IF message_number IN ( 40400, 40406, 40407 )
        THEN
          DEFAULT_VALUE( '0', 'GLOBAL.insert' );
          DEFAULT_VALUE( '0', 'GLOBAL.update' );
          DEFAULT_VALUE( '0', 'GLOBAL.delete' );
          MESSAGE('Save Ok: ' ||
            :GLOBAL.insert || ' records inserted, ' ||
           :GLOBAL.update || ' records updated, ' ||
           :GLOBAL.delete || ' records deleted !!!' );
          ERASE('GLOBAL.insert'); 
          ERASE('GLOBAL.update');
          ERASE('GLOBAL.delete');
        ELSE
             MESSAGE(message_line );
              END IF;
    END;
    POST-INSERT
    DEFAULT_VALUE('0', 'GLOBAL.insert');
    :GLOBAL.insert := TO_CHAR( TO_NUMBER( :GLOBAL.insert ) + 1 );
    POST-UPDATE
    DEFAULT_VALUE('0', 'GLOBAL.update');
    :GLOBAL.update := TO_CHAR( TO_NUMBER( :GLOBAL.update ) + 1 );
    POST-DELETE
    DEFAULT_VALUE('0', 'GLOBAL.delete');
    :GLOBAL.delete := TO_CHAR( TO_NUMBER( :GLOBAL.delete ) + 1 );try it
    Gerd

  • Delete all record in a table, the insert speed is not change.

    I have an empty table, and i insert a record need 100ms,
    when this table has 40,0000 record, i insert a record need 1s, this is ok, because i need do a compare based an index before insert a record, so more record, need more time.
    The problem is when i delete all record in this table, the insert time is still 1s, not reduce to 100ms.Why?

    Hello,
    Read through this portion of oracle documentation
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14220/logical.htm#CNCPT004
    The reason is still taking 1s, because when you inserted 400K record because HWM (The high water mark is the boundary between used and unused space in a segment.) moved up. And when you deleted all the records your HWM still at the same marker and didn't get to reset to 0. So when you insert 1 record it lookings for free space and after finding (generally a regular inserts got 6 steps it inserts data). If you truncate your table you and try it again it will be faster as your HWM is reset to 0.
    Regards

  • Error while updating or deleting a record

    Hi to all...
    i have created atable group_master with 2 fields Group_id and Group_name
    the user will specify a group_name in a text box and press save. Before commiting a seq number will be generated
    inside the form procedure and it will be inserted.
    The insert is working fine.
    But when i select a record i.e a group_name and change it contents and commit it, it is not commiting.
    when i checked the display error it showed Ora-01400 cannot insert null values into the table.
    Iam not inserting a value here iam updating the group name only.
    even when i delete a record it shows same error....
    can any one help to solve this....
    thanx in advance........

    I have when button pressed trigger whick helps to show the lov which contains the group_id and group_name;
    a := show_lov('lov27');
    if a then
    go_block('group_master');
    execute_query;
    end if;
    it is correctly fetching the delected data. but propmpts a message box asking Do u want to save the record?
    if i ignore it n modify the group_name and save it,still it shows unable to insert null value.
    i jus want a simple way to solve this....
    i want to fetch that particular record and modify or delete it.
    group_id n group_name cannot be null.
    i will be using Buttons for add,delete,update and save record. i will be using lov to fetch records for modification or deletion.
    how to avoid the message box which prompts when i call lov with execute_query.....
    * I tried Key-listval...but i didnt get any solution. i will try again....
    thanx for ur replies....

  • How to delete duplicate records in 10 G.

    how to delete duplicate records in 10 G.

    --Here is one way to do it using a second table 
    create table temp1
    (col1 char(1));
    --Table created.
    insert into temp1 (col1) values('A');
    insert into temp1 (col1) values('B');
    insert into temp1 (col1) values('B');
    --1 row created.
    --1 row created.
    --1 row created.
    create table temp2 as select distinct * from temp1;
    --Table created.
    --now you have a second table with no duplicates
    --truncate your old table
    truncate table temp1;
    --Table truncated.
    --and reload it with data from the new table
    insert into temp1 select * from temp2;
    --2 rows created.
    --then drop the temp2 table
    drop table temp2

  • @Inserting Records in an Internal Table

    Hi,
    How can I Insert records in an internal table..such that i can insert the records somewhere in the middle based on the entry in a field?

    INSERT wa INTO TABLE itab INDEX idx .
    Effect
    This variant can only be used for standard tables and sorted tables. Each line line_spec to be inserted into the line before the table index idx and the table index of the following lines is increased by one. A data object of the type i is expected for idx.
    If idx contains a value equal to the number of the existing table lines plus one, the new line is appended as the last line in the internal table. If idx contains a greater value, no line is inserted and sy-subrc is set to 4.
    An exception that cannot be handled is raised when:
    idx contains a value less than or equal to 0
    A line to be inserted would cause a duplicate entry in tables with a unique table key
    A line to be inserted would disrupt the sort order of sorted tables
    Within a LOOP loop, you can omit the addition INDEX. Each line to be inserted is inserted before the current table line of the LOOP loop. However, if the current line is deleted in the same loop pass, the response is undefined.

  • Inserting Record In same table through triggers.

    Hi,
    I've a table cus_mst ( cus_div_cd vachar2(1), cus_cd varchar2(5), cus_nm varchar2(100) )
    Records are inserted in this table through forms ...
    We need to automatically insert a record with a diff div_cd for any record inserted in the table .
    If div_cd 'I' is entered automatically a record with div cd 'S' with other coulmns having same values should get inserted .
    In case div_cd is 'S' then record with div_cd 'I' should get created.
    Eg : If in insert ( 'S', 'A0001', 'ABC COmpany' ); another record with values ( 'I', 'A0001', 'ABC Comapny' ) gets created;
    One way to do is to insert records in a view ( on the table ) and use instead of trigger to insert the corresponding record. But that is not possible as development team has to change form and use view instead of table.
    Have tried doing it by populating a collection in-each-row trigger and then using statment level trigger to insert from the collection. But this leads to recursive error.
    Would be great to get more insights into this..
    thanks
    cheers
    Jaani

    Hi,
    Within the following script you need to make adjustments according to your needs about the columns you need to test. But this might help you.
    Sorry for the layout. But I was not able to adjust it in a short time.
    drop table ad_test
    create table ad_test ( col1 varchar2(1), col2 varchar2(5), col3 varchar2(100) )
    create or replace package ad_test_pkg is
    procedure initialize_postpone ;
    procedure postpone_record( r_atst in ad_test%rowtype ) ;
    procedure handle_postponed_records ;
    end ad_test_pkg ;
    create or replace package body ad_test_pkg is
    type type_atst is table of ad_test%rowtype index by binary_integer ;
    t_atst type_atst ;
    procedure initialize_postpone is
    begin
    t_atst.delete ;
    end initialize_postpone ;
    procedure postpone_record( r_atst in ad_test%rowtype ) is
    begin
    t_atst(t_atst.count) := r_atst ;
    end postpone_record ;
    procedure handle_postponed_records is
    cursor c_test( cpiv_col1 in ad_test.col1%type ) is
    select 'x'
    from ad_test
    where col1 = cpiv_col1
    r_test c_test%rowtype ;
    r_atst ad_test%rowtype ;
    begin
    for i in t_atst.first .. t_atst.last
    loop
    r_atst := t_atst(i) ;
    if r_atst.col1 = 'I'
    then
    r_atst.col1 := 'S' ;
    else
    r_atst.col1 := 'I' ;
    end if ;
    open c_test( cpiv_col1 => r_atst.col1 ) ;
    fetch c_test into r_test ;
    if c_test%found
    then
    close c_test ;
    else
    close c_test ;
    insert into ad_test
    ( col1
    , col2
    , col3
    ) values
    ( 'S'
    , r_atst.col2
    , r_atst.col3
    end if ;
    end loop ;
    end handle_postponed_records ;
    end ad_test_pkg ;
    create or replace trigger test_ad_bis
    before insert on ad_test
    begin
    ad_test_pkg.initialize_postpone ;
    end ;
    create or replace trigger test_ad_air
    after insert on ad_test for each row
    declare
    r_atst ad_test%rowtype ;
    begin
    r_atst.col1 := :new.col1 ;
    r_atst.col2 := :new.col2 ;
    r_atst.col3 := :new.col3 ;
    ad_test_pkg.postpone_record( r_atst => r_atst ) ;
    end ;
    create or replace trigger test_ad_ais
    after insert on ad_test
    begin
    ad_test_pkg.handle_postponed_records ;
    end ;
    insert into ad_test values ( 'I', 'A0001', 'ABC COmpany') ;
    select * from ad_test ;
    Greets,
    Ad
    Edited by: loaddev on 10-nov-2010 4:47

  • ADF,how to delete parent record and related child record without manual cod

    Hi All,
    I'm using 11g adf.
    I have one parent table PAR and two child table CHD1 , CHD2 respectively.
    I'm inserting values in three tables , making a form having add , delete and edit buttons.
    Issue when i want to delete a record from PAR table , it gives child table record exists . i have did manual coding to delete the child records with related to the selected parent table PAR.
    Is there any process in ADF to delete the child records with respective selected parent record with out manual coding.
    thanks in advance.

    http://download.oracle.com/docs/cd/E14571_01/web.1111/b31974/bcentities.htm#BABHFJFJ
    John

  • Getting Problem after Deleting a record from Record Store

    I am trying to create a simple application for mobile device. This application storing some records. I used RMS for this. These records i show in a list. But i tried to show list of records after deleting any record then list shows only prior records of deleted records n then shows exception as
    Recordsjavax.microedition.rms.InvalidRecordIDException
    The code i written as follows
    For storing data
    public void storeExercise(String EName, String Etime)
    try
    //System.out.println("AAAA");
    recordstore = RecordStore.openRecordStore("Test3",true);
    catch (Exception error)
    //System.out.println("EEEE");
    System.out.println("Exception"+error);
    try
    byte[] outputRecord;
    ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
    DataOutputStream outputdataStream = new DataOutputStream(outputStream);
    outputdataStream.writeUTF(EName);
    outputdataStream.writeUTF(Etime);
    outputdataStream.flush();
    outputRecord = outputStream.toByteArray();
    recordstore.addRecord(outputRecord, 0, outputRecord.length);
    outputStream.reset();
    outputStream.close();
    outputdataStream.close();
    zlist.append(EName+Etime, null);
    display.setCurrent(zlist);
    catch (Exception error)
    System.out.println("Exception in writing Records"+error);
    for getting records
    public void getExercise(ZimList zlist)
    this.zlist = zlist;
    try
    //System.out.println("AAAA");
    recordstore = RecordStore.openRecordStore("Test3",true);
    //recordstore.closeRecordStore();
    catch (Exception error)
    //System.out.println("EEEE");
    System.out.println("Exception"+error);
    try
    //System.out.println("Hello");
    String Ename = null;
    String Etime = null;
    byte[] byteInputData = new byte[100];
    ByteArrayInputStream inputStream = new ByteArrayInputStream(byteInputData);
    DataInputStream inputDataStream = new DataInputStream(inputStream);
    for (int x=1; x<= recordstore.getNumRecords() ; x++ )
    System.out.println("Record Id ="+x);
    //if (x != InvalidRecordID)
    recordstore.getRecord(x, byteInputData, 0);
    Ename = inputDataStream.readUTF();
    Etime = inputDataStream.readUTF();
    inputStream.reset();
    Final = Ename + Etime;
    System.out.println("Insert" + Final);
    zlist.insert(x-1,Final,null);
    inputStream.close();
    inputDataStream.close();
    //recordstore.closeRecordStore();
    catch (Exception error)
    System.out.println("Exception in Reading Records"+error);
    /*if (recordstore.listRecordStores() != null)
    try
    recordstore.deleteRecordStore("My Record Store");
    catch (Exception error)
    System.out.println("Exception"+error);
    And for deleting records I write
    public void deleteExercise(int index)
    try
    //System.out.println("AAAA");
    recordstore = RecordStore.openRecordStore("Test3",true);
    //recordstore.closeRecordStore();
    catch (Exception error)
    //System.out.println("EEEE");
    System.out.println("Exception"+error);
    if (recordstore.listRecordStores() != null)
    try
    byte[] byteInputData = new byte[100];
    ByteArrayInputStream inputStream = new ByteArrayInputStream(byteInputData);
    DataInputStream inputDataStream = new DataInputStream(inputStream);
    for (int x=1; x<= recordstore.getNumRecords() ; x++ )
    recordstore.getRecord(x, byteInputData, 0);
    if (x == index)
    recordstore.deleteRecord(index);
    //x--;
    inputStream.reset();
    break;
    inputStream.close();
    inputDataStream.close();
    catch (Exception error)
    System.out.println("Exception in Deleting Records"+error);
    Please Help me bcz i am new in j2me development n having no experience

    Ok ...
    When you add records in you store, the J2ME implementation create an ID.
    In the database, there is a list like that with ID <--> ]byte[ ]
    You can get back a record with a this ID.
    When you delete a record, it deletes the row. Lets say you have stored 3 records and that the ID are 1, 2, 3 ... if you delete the second one, then you have still in the database IDs 1 and 3.
    That's why you have this exception : you are iterating with an ID 1, 2, 3, 4, 5 ... if one is delete there is no reorganization. (If you add an other record, it could be stored with ID 2).
    To read all the records, you should get a list of existing IDs. Take a look at the API. Here is a piece of code, that you work but I have not tested :
    RecordStore rs;
    RecordEnumeration re = rs.enumerateRecords(null, null, false);
    while (re.hasNextElement()) {
      String str = new String(re.nextRecord());
      System.out.println("Record: " + str);         
    } Hope it will help you.
    Regards

  • Deleting multiple records via html checbkoxes?

    I'm trying to delete multiple records in a table based on the
    selection of checkboxes.
    I have an html form with 4 checkboxes. If a user checks any
    box, I want to delete the associated records. and if they ucnheck
    something I want to insert multiple records. This form does not
    hold the primary keys but other unique parameters. Here is my sql
    statement.

    > and that keyword is not mentioned in the DELETE
    statement chapter.
    IN is not specific to DELETE statements. It can also be used
    with SELECT or UPDATE statements. It is a way of specifying
    multiple values in a single statement, instead of using multiple OR
    statements:
    http://www.w3schools.com/sql/sql_in.asp
    Since you are using cfqueryparam, you also need to use
    list="true" (ie you are passing in a list of values, not just one)
    <cfset listOfValues = "1,2,5,6,8">
    WHERE ColumnName IN
    <cfqueryparam value="#listOfValues#" list="true"
    cfsqltype="...">

  • Insert Records into another tables

    Hi guyz,
    I have four tables as below
    1) employee
    empid (primary key)
    deptid
    emp_name
    work_location
    date_of_join
    emp_status
    date
    2) Termination
    empid reference employee
    deptid
    emp_name
    work_location
    terminate_date
    3) Resignation
    empid reference employee
    deptid
    emp_name
    work_location
    resign_date
    4) Vacation
    empid reference employee
    deptid
    emp_name
    work_location
    vac_date
    i have list item on employee form --> emp_status is list item whic contain Termination, Resignation, Vacation
    i want to update employee as well other tables if user select the respected field from the list item.
    if the user select termination/resignation from the list item the date item will be enable and user should enter the date,otherwise give the error on commit please enter the date and when user commit the record on employee it should update the table employee and delete the record belongs to Termination/Reisgnation and the record will be insert into Termination/Resignation table as select by user from list item.i tried this before but im fail i write the below code on pre-update trigger as below
    begin
    insert into termination
    (empid,deptid,emp_name,work_location,termination_date)select (empid,deptid,emp_name,work_location,date from employee where emp_status='Termination';
    delete from employee where emp_status='Termination' ;
    end;
    same as on resignation
    anybuddy help me how to do this task? to update the tables. im new in oracle.
    Regards
    Edited by: user10648713 on Dec 21, 2008 4:29 AM

    You run into the classic Mutating table problem. You cannot issue DML-statement against the same table the trigger is based on in a FOR EACH ROW-trigger.
    But even worse, you will cause any kind of client program to get in trouble if you implement such a logic. The client issues an update and as a result the record gets deleted. And, for you have a forms-module based i tell you that you will get problems with your forms-module.
    I still can't see whats the sense behind it, putting records into different tables dependant on a status. Oracle is built to manage large data volumes, so even for a large number of records that doesn't make sense to me.
    But anyway if you still want to deal with that multi-table-approach, go for the following:
    You will need three triggers on your table: a before-statement, an after-statement and a for-each-row-trigger:
    The before-statement will initialize a list of PK-Items
    The for-each-row will add the id of the processed row to the list
    The after-statement will loop over the list and process the rows.
    Create a Package for handling the logic including three procedures
    CREATE OR REPLACE PACKAGE PK_TRIGGER IS
      PROCEDURE PR_BS;
      PROCEDURE PR_ARIU(i_nEmpId IN NUMBER);
      PROCEDURE PR_AS;
    END;
    CREATE OR REPLACE PACKAGE BODY IS
      TYPE tData IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
      lData tData;
      PROCEDURE PR_BS IS
      BEGIN
        lData.DELETE;
      END;
      PROCEDURE PR_ARIU(i_nEmpId IN NUMBER) IS
        iPos PLS_INTEGER:=lData.COUNT+1;
      BEGIN
        lData(iPos):=i_nEmpId;
      END;
      PROCEDURE PR_AS IS
        CURSOR crEmp(i_nEmpId IN NUMBER) IS
          SELECT *
            FROM EMP
           WHERE EMP_ID=i_nEmpId;
        recEmp crEmp%ROWTYPE;
        iPos PLS_INTEGER;
      BEGIN
        iPos:=lData.FIRST;
        LOOP
          EXIT WHEN iPos IS NULL;
          -- Do whatever you want with the data in the record
          OPEN crEmp(lData(iPos));
          FETCH crEmp INTO recEmp;
          IF crEmp%FOUND THEN
            IF :NEW.EMP_STATUS='Termination' THEN
              DELETE FROM emp
               WHERE EMPID=lData(iPos);
              INSERT INTO TERMINATION (
                empid,
                deptid,
                emp_name,
                work_location,
                t_date
              ) VALUES (
                recEmp.empid,
                recEmp.deptid,
                recEmp.emp_name,
                recEmp.work_location,
                sysdate
            END IF;
          END IF; 
          CLOSE crEmp;
          -- Process next record
          iPos:=lIds.NEXT(iPos);
        END LOOP;
        lIds.DELETE;
      END;
    END;Now create the three triggers calling the appropiate procedures.

  • Oracle forms error frm-40508: unable to insert record

    Hi Everyone,
    I have been having this problem for 2 weeks and I realize that I spent alot of time I couldn't get to fix the problem so I need your help.
    Here is my situation. First, I installed Oracle 10g in my laptop with Oracle forms10g and Oracle forms904i. I had oracle_home folder as the top level structure then I have inside oracle folder, Oracle10g in it own folder, Oracle9i release2 in it own folder. then I created the user account "student" using the system/manager account finally I granted privilleges as follow:
    GRANT ALL PRIVILLEGES
    TO student
    WITH ADMIN OPTION;
    this was working perfecty I didn't need to grant objects privilleges such as
    GRANT INSERT, UPDATE, DELETE
    ON customers
    TO student;
    Then I created a form Application prototype and it works well I could Insert, Update and Delete but now I am creating an e-commerce application prototype I created an new account using a system/manager account as I did previously and grant all privilleges. When I try to grant object privileges the message that I receive says ORA-01919 : role 'INSERT' doesn't exist
    When I run the application I am unable to insert the record through forms I get message frm-40508 Orcle error: unable to insert record.
    I deinstall the Oracle and clean my laptop and did a clean installation using only Oracle Server10g and Oracle Developer10g I am getting the same message frm-40508.
    Can someone please help me on this. the insert command that I am running is a simple one such as
    INSERT INTO customers
    VALUES( block_name.field_name, ....);
    COMMIT;

    frm 40735:When button pressed trigger raised unhanded exceptionplease help me to solve this>
    The FRM-40735 is a generic Unhandled Exception. Please post the full error message so we can better help you.
    Craig B-)
    If someone's response is helpful or correct, please mark it accordingly.

  • Oracle Materialized View | Deletion of Records, Oracle Materialized View

    One question reg Materialized views.
    If as part of housekeeping of the Source database we delete some records (older records), will the materialized view also be updated with the deletion?
    I believe the answer is yes. In that case can we ensure that this delete does not happen?
    Is there anyway we can prevent MView refresh from deleting the records that is once inserted even if we delete the same records in source DB?

    This is a common scenario, particularly with materialised views that summarise detail data where you want to keep the summary but not the detail, and it is addressed in the documentation.
    The technique is to make the MV refresh on demand, delete the data from the detail tables, and use the CONSIDER_FRESH procedure to prevent the changes propagating to the MV. You'll probably find it in the docs by searching on DBMS_MView.Consider_Fresh. There are a few warnings to note I think.

  • Deleting partner records from CRM order.

    Hi Experts ,
    I have a requirement where I need to delete partner record from order. For that I am using the function module 'CRM_ORDER_MAINTAIN' . This is the code that I am using but  I  am  unable  to  delete the record.
    REPORT  ZSDTESTORDER5.
    parameters: guid1 type crmd_orderadm_h-guid.
    data: guid2(32) type c.
    data: ls_new_partners type CRMT_PARTNER_COM.
    data: lt_new_partners type CRMT_PARTNER_COMT.
    data: guid type COMT_PARTNERSET_GUID.
    data: ls_input_fields type CRMT_INPUT_FIELD.
    data: lt_input_fields type CRMT_INPUT_FIELD_TAB.
    data: ls_logical_key type CRMT_LOGICAL_KEY.
    data: ls_input_field_name type CRMT_INPUT_FIELD_NAMES.
    data: IT_OBJECTS_TO_SAVE type CRMT_OBJECT_GUID_TAB.
    data: ET_OBJECTS_NOT_SAVED type CRMT_OBJECT_GUID_TAB.
    data: ET_OBJECTS_NOT_SAVED_WA type CRMT_OBJECT_GUID.
    data: IT_OBJECTS_TO_SAVE_WA type CRMT_OBJECT_GUID.
    data: txt1(42) type c.
    move guid1 to guid.
    CLEAR ls_new_partners.
    guid2 = guid1.
    ls_new_partners-ref_guid = guid.
    ls_new_partners-ref_kind = 'A'. "A
    ls_new_partners-kind_of_entry = 'C'.
    ls_new_partners-ref_partner_handle = '0000'.
    ls_new_partners-partner_fct = '00000004'.
    ls_new_partners-ref_partner_fct = '00000004'.
    ls_new_partners-partner_no  = '9000000112'.
    ls_new_partners-ref_partner_no  = '9000000112'.
    ls_new_partners-display_type = 'BP'.
    ls_new_partners-ref_display_type = 'BP'.
    ls_new_partners-no_type = 'BP'.
    ls_new_partners-MAINPARTNER =''.
    ls_new_partners-REF_HANDLE = '0000000000'.
    INSERT ls_new_partners INTO TABLE lt_new_partners.
    CLEAR ls_input_fields.
    REFRESH ls_input_fields-field_names.
    ls_input_fields-ref_guid  = ls_new_partners-ref_guid.
    ls_input_fields-ref_kind = ls_new_partners-ref_kind. "A
    ls_input_fields-objectname = 'PARTNER'.
    ls_input_fields-ref_handle = '0000000000'.
    "move ls_new_partners to ls_logical_key.
    "concatenate guid2 ls_new_partners-ref_kind ls_new_partners-kind_of_entry ls_new_partners-ref_partner_handle ls_new_partners-partner_fct ls_new_partners-partner_no ls_new_partners-display_type ls_new_partners-no_type into ls_logical_key.
    "concatenate '0000' '00000004' '9000000111' into txt1.
    "write  'BPBP' to txt1+0(28) .
    "txt1 = '0000000000049000000111      BPBP          '.
    ls_input_fields-logical_key =  '0000000000049000000112    BPBP           ' ."  '0000'  ls_logical_key.
    write:/ ls_input_fields-logical_key.
    ls_input_field_name-fieldname = 'PARTNER_FCT'.
    "ls_input_field_name-changeable = 'X'.
    INSERT ls_input_field_name INTO TABLE ls_input_fields-field_names.
    ls_input_field_name-fieldname = 'NO_TYPE'.
    INSERT ls_input_field_name INTO TABLE ls_input_fields-field_names.
    ls_input_field_name-fieldname = 'DISPLAY_TYPE'.
    INSERT ls_input_field_name INTO TABLE ls_input_fields-field_names.
    ls_input_field_name-fieldname = 'PARTNER_NO'.
    INSERT ls_input_field_name INTO TABLE ls_input_fields-field_names.
    ls_input_field_name-fieldname = 'KIND_OF_ENTRY'.
    INSERT ls_input_field_name INTO TABLE ls_input_fields-field_names.
    INSERT ls_input_fields INTO TABLE lt_input_fields.
    "ENDLOOP.
    CALL FUNCTION 'CRM_ORDER_MAINTAIN'
    EXPORTING
      it_partner        = lt_new_partners
    CHANGING
      ct_input_fields   = lt_input_fields
    EXCEPTIONS
      error_occurred    = 1
      document_locked   = 2
      no_change_allowed = 3
      no_authority      = 4
      OTHERS            = 5.
    "CALL FUNCTION 'CRM_ORDER_INITIALIZE'
    EXPORTING
      IT_GUIDS_TO_INIT                 =
      IV_INITIALIZE_WHOLE_BUFFER       =
      IV_INIT_FRAME_LOG                =
      IV_LOG_HANDLE                    =
      IV_KEEP_LOCK                     = FALSE
    EXCEPTIONS
      ERROR_OCCURRED                   = 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.
    commit work.
    IT_OBJECTS_TO_SAVE_WA = guid.
    append IT_OBJECTS_TO_SAVE_WA to   IT_OBJECTS_TO_SAVE.
    CALL FUNCTION 'CRM_ORDER_SAVE'
       EXPORTING
         IT_OBJECTS_TO_SAVE         = IT_OBJECTS_TO_SAVE
       IV_UPDATE_TASK_LOCAL       = FALSE
       IV_SAVE_FRAME_LOG          = FALSE
       IV_NO_BDOC_SEND            = FALSE
      IMPORTING
       ET_SAVED_OBJECTS           = ET_SAVED_OBJECTS
       ET_EXCEPTION               =
        ET_OBJECTS_NOT_SAVED       = ET_OBJECTS_NOT_SAVED
    CHANGING
       CV_LOG_HANDLE              =
    EXCEPTIONS
       DOCUMENT_NOT_SAVED         = 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.
    commit work.
    *loop at ET_OBJECTS_NOT_SAVED into ET_OBJECTS_NOT_SAVED_WA.
    write:/ ET_OBJECTS_NOT_SAVED_WA.
    *endloop.
    Through this code I  want  to  delete the  partner  number  '9000000112' for the partner function  '00000004'.
    But  this is not  coming. Please tell me if I  am  missing  out  something . This is  very urgent.
    Thanks & Regards,
    Samrat Dutta

    Hi Samrat Dutta,
              Looks like this FM can not be used to delete partner functions. Generally other parameter structures like appointment etc will have one field called MODE, there we give whether it is creation,change or delete mode. unfortunately for partner parameter structre CRMT_PARTNER_COM does not have MODE field in it to identify whether we are creating,chaging or deleting. i would recommond you try to find out some other FM to delete partners of Order. will let you know if i get come clue on this
    Siva

  • How to delete a record in database it should be effect in XML

    In my application wheni insert a record in database it automatically inserted in XML now my problem is when i delete a record in database it should also effect in XML
    plz anybody anything knows about this reply me

    First up all, when u insert a record in database, how the data is inserted in xml file. Is there any application written for that?
    So when u delete the record from database,and want that same data should be deleted from the xml file, write a application to delete data from xml, and call that when u delete record from database.
    U can Write application using DocumentBuilderFactory.
    And using XQuery, you can delete data from xml.
    Hope this will help u.
    .....yogesh

Maybe you are looking for

  • My roommates's boyfriend is hacking my mac

    Can Anyone translate these logs to lamens terms as to what is going on?   My computer's name is Chris or wetherjc.   however, kevos-ipad is another persons Ipad whcih is not authorized to connect. Nov 19 22:33:44 kevos-ipad configd[18]: setting hostn

  • Executing if condition in a sql prompt with in a shell script

    Hi all, i need to write a shell script where i need to execute a sql statement. if the count from the above sql is greater than certain value i need to execute a another sql statement.After some time i need to check the count again using above sql an

  • Macbook pro 13' late 2011 4GB RAM...using lot of RAM

    macbook pro 13' late 2011 4GB RAM...using lot of RAM I have attatched screenshot...please help...sometime free memory is only 15 or 20 mb and i have to restart...after restart it works fine for 10 to 20 minuts

  • Navigation tag Library - launchedNavNode

    Hi    I would like to know how to control launchedNavNode exceptions.   I am using this expression to get the current page in the node hierchy, but if the current node has no default entry point assignment, the library causes a javascript error PS -

  • LT41 - Group TR - Not possible to mark items (bug?)

    Hi, transaction LT41 can be used to group together TR under one group number. This can later be used to create TOs, print TOs and confirm TOs for this group number. When calling LT41 I can see the open TRs sorted by movement type. But I cannot select