Deleting records in table

Hello,
I have an advanced table with a VO (and EO)
I am trying to delete some records using the following code in the page's AM
public void deleteRows()
          RowSetIterator rowsetiterator = null;
          try
               XxglFrsAcctMappingEOViewImpl vo = getXxglFrsAcctMappingEOView();
               rowsetiterator = vo.createRowSetIterator(null);
               for (OAViewRowImpl rowimpl = (OAViewRowImpl)rowsetiterator.first(); rowimpl != null; rowimpl = (OAViewRowImpl)rowsetiterator.next())
                    String s2 = (String)rowimpl.getAttribute("UpdateFlag");
                    if (s2 == "Y")
                         rowimpl.remove();
          catch (Exception exception1)
               throw OAException.wrapperException(exception1);
          finally
               rowsetiterator.closeRowSetIterator();
that doesnt work. if I remove if (s2 == "Y") then all rows are deleted as they should be.
I tried something like
oracle.jbo.server.EntityImpl aentityimpl[] = rowimpl.getEntities();
XxglFrsAcctMappingEOImpl eoimpl = (XxglFrsAcctMappingEOImpl)aentityimpl[0];
String s2 = (String)eoimpl.getUpdateFlag();
but that didnt work either. Is there a better to get the attribute to check?
thanks

Benoit,
I should have noticed it earlier :)
You can't use == sign with string. Use equals() method with string.
So change your code from
s2 == "Y"
to
"Y".equals(s2)
that should fix your issue.
--Shiv                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Similar Messages

  • Delete records from tableA which are not in tableB

    Table A contains milions of records which is the best way to delete records from tableA which are not in tableB
    delete from tableA where empno not in (select empno from tableb)
    or
    delete from tableA where empno not exists (select empno from tableb
    where b.empno=a.empno)
    any help

    Hi
    If you can do this, do with this:
    create table tableC
    as select a.*
    from tableA a,
    (select empno from tableA
    minus
    select empno from tableB) b
    where a.empno = b.empno;
    drop table tableA;
    rename table tableC to tableA;
    Ott Karesz
    http://www.trendo-kft.hu

  • How do you delete records from table with data in a select option

    how do you delete records from table with relevant to data in a select option..how to write coding

    Hi,
    Try
    if not s_select_option [ ] is initial.
    delete * from table
    where field in s_select_option.
    endif.
    commit work.
    Be careful though. If select option is emty, you will delete the entire table.
    Regards,
    Arek

  • Unable to update and delete record in table

    Hello All,
    Kindly help me regarding the below mentioned issue plz
    When I want to update or delete record in table from form developed in 6i give no error message but no action and when I run same form on other system updation and deletion are successfully done.
    Any suggestion

    Hello
    More explanation is as under:
    1. I am working on only one table say A
    2. Wants to update only one row of Table A at one time in single user envoirment.
    3. My form is successfully update some rows as well but not on all rows on one PC while same form able to update all rows on other PC.
    4. I drop the table and re-create the table again but problem persist.
    Any advice plz.

  • How to delete record from table control in BDC?

    Hello friends,
    I am running a BDC program to delete records.
    I have file with following records and i got these records into t_itab.
    Material     Plant     Start date     End date     Cost
    MQ100001     S001     09/01/2008     09/31/2008     55.00
    MQ100004     S002     09/01/2008     09/31/2008     56.00
    MQ100008     S003     09/01/2008     09/31/2008     57.00
    Now, I have BDC transaction in which table control screen which contains following structure.
    MQ100001     S001     09/01/2008     09/31/2008     55.00
    MQ100002     S002     09/01/2008     09/31/2008     56.00
    MQ100004     S003     09/01/2008     09/31/2008     47.00     
    MQ100005     S004     09/01/2008     09/31/2008     25.00
    MQ100006     S012     09/01/2008     09/31/2008     76.00
    MQ100007     S033     09/01/2008     09/31/2008     17.00
    MQ100008     S011     09/01/2008     09/31/2008     95.00
    MQ100009     S002     09/01/2008     09/31/2008     46.00
    I have recorded from SHDB in which first record will be delete.
    So, when i loop through t_itab,instead of deleting MQ100001,MQ100004 and MQ100008 from BDC screen,
    it is deleting MQ100001,MQ100002 and MQ100004 (first record for each process ).
    Which i don't want to.
    Is there any facility in BDC to put records on top which i want to delete?
    Please guide me.
    Regards,
    RH

    Hi,
    While doing recording check for Filter button available for the table control, if it available then do the recording for the same.
    Once it is done while passing the data from internal table put the value into Filter field.
    Hope it resolves your issue.
    Thanks & Regards.
    Nagaraj Kalbavi

  • How to delete record from table control using BDC?

    Hello friends,
    I am running a BDC program to delete records.
    I have file with following records and i got these records into t_itab.
    Material     Plant     Start date     End date     Cost
    MQ100001     S001     09/01/2008     09/31/2008     55.00
    MQ100004     S002     09/01/2008     09/31/2008     56.00
    MQ100008     S003     09/01/2008     09/31/2008     57.00
    Now, I have BDC transaction in which table control screen which contains following structure.
    MQ100001     S001     09/01/2008     09/31/2008     55.00
    MQ100002     S002     09/01/2008     09/31/2008     56.00
    MQ100004     S003     09/01/2008     09/31/2008     47.00     
    MQ100005     S004     09/01/2008     09/31/2008     25.00
    MQ100006     S012     09/01/2008     09/31/2008     76.00
    MQ100007     S033     09/01/2008     09/31/2008     17.00
    MQ100008     S011     09/01/2008     09/31/2008     95.00
    MQ100009     S002     09/01/2008     09/31/2008     46.00
    I have recorded from SHDB in which first record will be delete.
    So, when i loop through t_itab,instead of deleting MQ100001,MQ100004 and MQ100008 from BDC screen,
    it is deleting MQ100001,MQ100002 and MQ100004 (first record for each process ).
    Which i don't want to.
    Is there any facility in BDC to put records on top which i want to delete?
    Please guide me.
    Regards,
    RH

    One option is to identify the table and find out the location as the number of row which should be deleted from the table and then in the bdc program instead of postioning the cursor on the row 1(using the statement perform bdc_cursor ....(01)), replace the 01 with the row number.
    Second option is that if a filter control is available for the table control, then filter the data each and every time with the material number to be deleted and then delete the first row.
    Regards
    Farzan

  • Deleting records from table MVER

    We are experiencing performance issues when adding data to table MVER.  We have data on there that is over 5 years old which could be deleted.  As we have not been able to find any standard program or process that carries out housekeeping on MVER we are considering writing an ABAP program to delete the records.   Has anyone had any problems when deleting records from MVER or does anyone know of any reason why we should not delete these records in this way ?

    Well, I wouldn't delet data from a standard SAP table based on information from the internete. I'd look at other alternatives.
    Are you maintaining custom indexes on this table?
    Are your database statistics up to date?
    Consider a databse re-org.
    I don't think simple inserts should cause a problem.
    Rob

  • How to delete records in Table control

    Hi,
    i defined  a table control in which it has 5 records and i have 1 ''DELETE button.
    if i select a record and if i click on delete button.
    The selected button has to be deleted.
    Please let me know how i can i do..if possible with sample codes..
    Thanks in advance.

    Hi Andrew,
    In the PAI event, you need to handle the DELETE logic.
    Just have a look at the following code.
    OK_CODE = SY-UCOMM.
    Case OK_CODE.
    When 'DELETE'.
    Loop at internal table where CHECKBOX = 'X'. " Checkbox is marked.
    lv_sytabix = sy-tabix.
    If sy-subrc eq 0.
      Delete from itab index lv_sytabix. " Deleting values from ITAB
    Endif.
    Endloop.
    Endcase.
    Also have a look at this demo dynpro code. This will let you know the exact syntax.
    DEMO_DYNPRO_TABCONT_LOOP_AT.
    Hope this will help.
    Thanks,
    Samantak.

  • Visual Studio 2010 Cannot delete records in table

    Hello!
    I created a local
    database in vs2010 and created a web site from which i want to interract with it. I want
    to delete a client based on his e-mail address. This is the code i wrote:
    protected void btnDelete_Client(object sender, System.EventArgs e)
        SqlConnection con = new SqlConnection(@"Data Source=JOHN-PC\SQLEXPRESS;Initial Catalog=subiect1;Integrated Security=True");
        try
            con.Open();
            SqlCommand cmd = new SqlCommand("delete from Clienti where (Adresa_mail = @Adresa_mail)", con);
            cmd.Parameters.AddWithValue("@Adresa_mail", txtAdresamail.Text);
            if (cmd.ExecuteNonQuery() == 1)
                Label1.Text = "Clientul a fost sters!";
            else
                Label1.Text = "Clientul nu a putut fi sters!";
        catch (Exception ex)
            Label1.Text = "Error --> " + ex.Message;
        finally
            con.Close();
    I don't get an error, but instead i get one of the messages i chose to be displayed if the deletion command doesn't execute ("The client couldn't be deleted"). Is there a functionality problem or did i made my
    table read-only? If so, how can i remove this property?

    Hi Laura_M92,
    Actually this forum is to discuss the VS usage issue, if this issue is related to web development, you could ask this question in the ASP.NET forum:
    http://forums.asp.net. If then, you could get an answer more quickly and professional. Thanks for your cooperation.
    Best Regards,
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Deleted records of tables related to datasources at source system

    Hello,
    The tables related to datasources(RSISOSMAP, RSOSFIELDMAP, RSOSOHIE, etc...)  in source system are without records and  basis team does'nt know what happened.
    Do you know any transaction or procedure in source system that can clear those tables?
    Do you know if the transaction BDLS can cause this?
    Source System -> SAP-R/3-ECC 6.0
    BI System -> SAP-BI 7.0
    Tks
    Portella

    The problem was solved with replicate DS in BW
    Tks
    Portella

  • Deleting Records from Referential Tables

    Hi,
    Can anyone help me in deleting records from tables in a hierarcial manner. For e.g C refers B and B refers A. I need to delete data from all three tables related to a where clause in A.I tried using User_constraints and User_cons_columns views. But i am not able to find a hierarchial delete statement.
    Venkatesh

    Did you look into the option of specifying ON DELETE CASCADE for your foreign key constraints. That way, if you delete a
    row from the master table Oracle will automatically go and delete the child rows. Take a look at the following script.
    Here, when I delete a row from table A for NUM = 1 the child rows from table B (WHERE num = 1) are automatically deleted.
    drop table b
    drop table a
    create table a (num number, name varchar2(40))
    create table b (num number, name varchar2(40))
    alter table a add constraint pk_a primary key(num)
    alter table b add constraint fk_b_num foreign key (num) references a(num) on delete cascade
    insert into a values (1, 'Test#1')
    insert into a values (2, 'Test#2')
    insert into b values (1, 'Referes#1')
    insert into b values (2, 'Referes#2')
    select * from a
    select * from b
    delete from a where num = 1
    select * from a
    select * from b
    Sridhar,
    Thanks a lot for your help.My exact need was to delete records in 50 tables starting with the key table for a specific condition in the key table.
    Assume table A has 100 records,B 200 records,C 150 records,D 400 records, etc
    When i want to delete some records in table A, i will not be able to do that as child records exists in table B and this structure will carry on till that last table in my application. How do i delete those specific records
    Venkatesh

  • Archiving (delete) record SOFFCONT1

    hi guru,
    how can i delete record in table SOFFCONT1 ?
    i haven't report RSBCS_REORG because SP level is SAPKB62040.
    Thank  you
    MC

    Hi MC,
    If you are on SAPKB62040, then you should have report RSBCS_REORG. Please recheck.
    Else check if you can implement SAP notes 966854 and 1003894
    Cheers.....,
    Raghu

  • How to Restore deleted records in other table in oracle database 10g...

    Hi All,
    i want to restore deleted records of a particular table in other table
    suppose:
    i perform a query
    delete from emp
    where deptno =30;
    now i wont to restore deptno=30 records in other table, let say in emp1 table
    can any one let me know how to do it?
    Thanks..

    This is what flashback query is for:
    orclz> conn scott/tiger
    Connected.
    orclz> select count(*) from emp;
      COUNT(*)
            14
    orclz> delete from emp where deptno=30;
    6 rows deleted.
    orclz> commit;
    Commit complete.
    orclz> create table deleted30 as select * from emp as of timestamp(systimestamp - 5/1440) where deptno=30;
    Table created.
    orclz> select count(*) from deleted30;
      COUNT(*)
             6
    orclz>

  • Delete records in a table and at the same time print out for reference

    I am working on a req to delete some records from a table and at the same time, record/print the deleted records in the outstream (DBMS_OUTPUT.PUT_LINE)
    DECLARE
    v_rec_po hst_po%ROWTYPE;
    BEGIN
    DELETE FROM hst_po po
    WHERE abbrpoid = '&opportunity_code'
    AND updatedby = (SELECT employeeid
    FROM tes_employee
    WHERE name = &emp_name)
    AND audittimestamp BETWEEN TO_DATE ('&start_timestamp',
    'DD-MON-YYYY HH24:MI'
    AND TO_DATE ('&end_timestamp',
    'DD-MON-YYYY HH24:MI'
    END;
    I was thinking of using returning into and then using DBMS_output to pull out the delted records, but there will be multiple rows deleted fro this statements. I am stuck here..Can anyone help

    How about:
    SQL> create table t
      2  (x int)
      3  /
    Table created.
    SQL> insert into t
      2  select rownum
      3    from all_objects
      4   where rownum <= 10
      5  /
    10 rows created.
    SQL> declare
      2     cnt pls_integer;
      3  begin
      4     delete from t;
      5     cnt := sql%rowcount;
      6     dbms_output.put_line ('Removed: '||to_Char (cnt));
      7  end;
      8  /
    Removed: 10
    PL/SQL procedure successfully completed.Edited by: Alex Nuijten on Jun 4, 2009 8:58 AM

  • How to record the records deleted in a table

    Hi Experts
    I want to run a report as a batch which should deleted the records
    which are sysdate - 60 and The report should log the number of records deleted
    from each table at End Of Run.
    Criteria for selecting records to be deleted are as follows:
    1.     ZINT_DATA
    u2022     ZINT_DATA.CREATED_ON <= (Today u2013 60 Days)
                   and ZINT_DATA.STATUS = u2018OKu2019
    So I want to create a table for log history recorded as
    Delete Date         Log description
    01.01.2008        1500 rows deleted
    30.03.2008        2000 rows deleted.
    30.04.2008        300  rows deleted.
    Eg The table are ZINT_DATA.
    The report starts like this
    REPORT z_eslp_command.
    DATA:
      fs_zint_data TYPE zint_data.
    DATA:
      t_zint_data TYPE
              TABLE OF
                      ZINT_DATA.
    START-OF-SELECTION.
    SELECT *
       FROM ZINT_DATA
       INTO TABLE t_ZINT_DATA PACKAGE SIZE 10000.
    ENDSELECT.
    LOOP AT t_zint_data INTO fs_zint_data.
    INSERT INTO ZINT_DATA_DEL
          VALUES fs_zint_data.
    select count(*) from zint_data_del.
    ENDLOOP.
    IF sy-subrc EQ 0.
      WRITE:
        'DATA INSERTED FROM ZINT_DATA into ZINT_DATA_DEL'.
    ENDIF.
    But Instead of creating another table , I want only log to be recorded as described.
    Thanks
    Regards
    Piroz

    Hi Kiran
    See the final modification of the report but I am getting an error as
    Field " Corresponding_fields" is unknown, it is neithere in one of the specified tables nor defined by a
    DATA statement, but I have already created an internal table itab1 , could you check and revert with the correction.
    REPORT  ZSD1DELETION                .
    TYPE-POOLS:SLIS.
    *Used in ZSDI_INTERFACE1 Program.
    TABLES:ZINT_DATA_DEL  . 
    *DATA: BEGIN OF ITAB1 OCCURS 0.
    *DATA: SL_NO TYPE SY-TABIX.
         INCLUDE STRUCTURE zint_data_del.
    *DATA:END OF ITAB1.
    DATA: BEGIN OF ITAB1 occurs 0 ,
          MANDT type zint_data_del-mandt,
          ZINT_ID type zint_data_del-zint_id,
          ZINT_TY type zint_data_del-zint_ty,
          CREATED_ON type zint_data_del-created_on,
          KEY_VAL type zint_data_del-key_val,
          SEQUENCE type zint_data_del-sequence,
          STATUS type zint_data_del-status,                 
          LENGTH type zint_data_del-length,           
          RAW_DATA type zint_data_del-raw_data,       
          end of itab1.
    *DATA: i_data TYPE TABLE OF ITAB1, " internal table
    *wa_data TYPE ITAB1. " work area
    DATA:LINE1(10) TYPE C,
         LINE2(10) TYPE C,
         date1(10) type c,
         date2(10) type c,
         name1(60),
         string1(100),
         title1(65),
         title2(100) type c,
         FNAME TYPE STRING.
    *Declarations for ALV
    DATA:itfieldcat TYPE slis_t_fieldcat_alv WITH HEADER LINE.
    DATA:itrepid TYPE sy-repid.
    itrepid = sy-repid.
    DATA:itevent TYPE slis_t_event.
    DATA:itlistheader TYPE slis_t_listheader.
    DATA:walistheader LIKE LINE OF itlistheader.
    DATA:itlayout TYPE slis_layout_alv.
    DATA:top TYPE slis_formname.
    DATA:itsort TYPE slis_t_sortinfo_alv WITH HEADER LINE.
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
    *PARAMETERS:P_WERKS LIKE BSEG-WERKS.
    SELECT-OPTIONS: S_DATE FOR ZINT_DATA_DEL-CREATED_ON OBLIGATORY.              
    SELECTION-SCREEN END OF BLOCK B1.
    *Validations w.r.t the Date
    AT SELECTION-SCREEN ON S_DATE.
    IF S_DATE IS INITIAL.
    MESSAGE 'Enter the Date' type 'E'.
    *Records from 2007 can't be deleted.
    ELSEIF S_DATE-LOW+0(4) >= '2007' AND
           S_DATE-HIGH+0(4) >= '2007'.
    MESSAGE 'Records from the Year 2007 cannot  be Deleted' type 'E'.
    ENDIF.
    CONCATENATE  s_DATE-low6(2) '.' s_DATE-low4(2) '.' s_DATE-low+0(4)
    INTO date1.
    CONCATENATE  s_DATE-high6(2) '.' s_DATE-high4(2) '.' s_DATE-high+0(4)
    INTO date2.
    PERFORM GETDATA.
    *&      Form  DOWNLOAD
          text
    -->  p1        text
    <--  p2        text
    form GETDATA.
    SELECT * FROM ZINT_DATA_DEL
             INTO CORRESPONDING_FIELDS OF TABLE ITAB1
             WHERE CREATED_ON IN S_DATE.
    IF ITAB1[] IS NOT INITIAL.
    DESCRIBE TABLE ITAB1 LINES LINE1.
    PERFORM DELETION.
    PERFORM ALV.
    ELSE.
    MESSAGE 'No Data' type 'S'.
    ENDIF.
    endform.                    " GETDATA
    *&      Form  DELETION
          text
    -->  p1        text
    <--  p2        text
    form DELETION .
    DELETE FROM ZINT_DATA_DEL WHERE CREATED_ON IN S_DATE.
    endform.                    " DELETION
    *&      Form  alv
          Fieldcatalog for ALV Report
    FORM alv.
    LOOP AT ITAB1.
    ITAB1-SL_NO = SY-TABIX.
    MODIFY ITAB1.
    ENDLOOP.
      DEFINE m_fieldcat.
        itfieldcat-fieldname = &1.
        itfieldcat-col_pos = &2.
        itfieldcat-seltext_l = &3.
        itfieldcat-do_sum = &4.
        itfieldcat-outputlen = &5.
        itfieldcat-edit = &6.
        append itfieldcat to itfieldcat.
        clear itfieldcat.
      END-OF-DEFINITION.
      m_fieldcat 'MANDT'     '' 'Client' '' 03 ''.
      m_fieldcat 'ZINT_ID' ''   'Id' '' 10 ''.
      m_fieldcat 'ZINT_TY'   '' 'Type.'  '' 05 ''.
      m_fieldcat 'CREATED_ON' '' 'Date Created on' '' 25 ''.
      m_fieldcat 'KEY_VAL'       '' 'key value'  '' 04  ''.
      m_fieldcat 'SEQUENCE' '' 'sequence' '' 06 ''  .
      m_fieldcat 'STATUS'   '' 'status.' '' 10 ''.
      m_fieldcat 'LENGTH'    '' 'Length.' '' 18 ''.
      m_fieldcat 'RAW_DATA'    '' 'Raw Data' '' 15 '' .
      itlayout-zebra = 'X'.
      itlayout-colwidth_optimize = 'X'.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
          EXPORTING
            i_callback_program      = sy-repid
            is_layout               = itlayout
          i_callback_user_command =  ' '
            i_callback_top_of_page  = 'TOP'
            it_fieldcat             = itfieldcat[]
            i_save                  = 'A'
         is_variant              = ITVARIANT
            it_events               = itevent[]
         is_print                = ITPRINTPARAMS
            it_sort                 = itsort[]
          TABLES
            t_outtab                = itAB1
            EXCEPTIONS
            program_error           = 1
            OTHERS                  = 2.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    ENDFORM.                    "alv
    *&      Form  TOP
        Top of page for ALV Report
    FORM top.
       CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
         EXPORTING
            i_list_type           = 0
         IMPORTING
            et_events             = itevent
    EXCEPTIONS
      LIST_TYPE_WRONG       = 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.
    string1 = 'Records from'.
    CONCATENATE string1 date1 'to' date2 INTO title1
    SEPARATED BY space.
    walistheader-typ = 'H'.
    walistheader-info = title1.
    APPEND walistheader TO itlistheader.
    CONCATENATE 'Records Deleted' '-' LINE1 INTO title2.
    walistheader-typ = 'H'.
    walistheader-info = title2.
    APPEND walistheader TO itlistheader.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          it_list_commentary      = itlistheader
        I_LOGO                   = ''.
        I_END_OF_LIST_GRID       =
       ENDIF.
      CLEAR itlistheader.
    ENDIF.
    ENDFORM.                    "TOP
    Regrds
    Piroz

Maybe you are looking for

  • How can I improve my cellphone signal at home?

    Across the street it's great signal strength but my side of the street is heavily wooded and 1 bar is lucky. I can never use the phone held to my head I always have to put it on speaker and I literally know where to stand so the call isn't dropped. T

  • Downgrading Firmware for the WRT54G... I can't do it...

    Hello, I am using the WRT54G wireless router, which currently has the 8.0.01 firmware. That's what it came with when i bought it. I am trying to downgrade the firmware to either 3.01.3 or 3.03.6. I want to downgrade to one of those because Xbox said

  • Material not maintained by purchasing

    Hi all, Is there a way to check that a material number is maintained by purchasing? I know that this can be achieved by going to MM01 and then extending the view to purchasing. Is there a way to do this by checking any fields in the MM Tables? Regard

  • Purpose of net-assembler.cfg.xml file

    Hi, all. I've tried to deploy the 8.1 EAR to 9.2 weblogic server. I ran weblogic.appc that came with 9.2 to compile the ear and this completed without errors (some warnings about enabling call-by-reference, but those are already present in 8.1). When

  • Need to upgrade from Creative Suites 4 to cloud

    I have an uninstalled Adobe Suites 4 and am taking a Photoshop 6 class and need to upgrade. can someone help? ellen