Skip to Content
author's profile photo Former Member
Former Member

hi

hi mine is small critial doubt

what is the procedure to delete a record from internal table which is only once in that table .

i mean that i want duplicate records and i dont want a single existing record in an internal table pls help me for this

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Dec 05, 2007 at 06:05 AM

    Hi,

    Try the below logic, u can get the required output.

    itab2[] = itab1[].

    loop at itab1.

    count = 0.

    Loop at itab2 where itab2-keyfields = itab1-keyfields.

    count = count + 1.

    endloop.

    if count = 1.

    delete itab1.

    endif.

    endloop.

    Result will be available in ITab1.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 05, 2007 at 05:58 AM

    Hi,

    First sort your internal table using key fields, then with the help of DELETE ADJACENT DUPLICATES from I_TAB comparing fields(key fields).

    Cheers,

    Bujji

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 05, 2007 at 06:02 AM

    Hi,

    Refer this code

    *--Sort table by Personnel Number and Pay Scale Level

    SORT it_final BY pernr endda begda.

    LOOP AT it_final INTO wa_final.

    lv_index = sy-tabix.

    lv_index1 = lv_index - 1.

    *--Clear

    CLEAR : wa_final1.

    READ TABLE it_final INTO wa_final1 INDEX lv_index1.

    IF sy-subrc EQ 0 AND " check ur condition here

    wa_final1-pernr EQ wa_final-pernr.

    wa_final-incre = wa_final-bet01 - wa_final1-bet01.

    else.

    delete itab. delete if condition fails

    ENDIF.

    MODIFY it_final FROM wa_final INDEX lv_index

    TRANSPORTING incre.

    *--Clear

    CLEAR : wa_final,

    wa_final1.

    ENDLOOP.

    Regards,

    PRashant

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 05, 2007 at 06:08 AM

    Hi Chaaya,

    You can follow the following steps to get desired result.

    assume u have internal table itab1

    1) itab2[] = itab1[].

    2) Delete all adjacent records from itab2.Now u will have the records which have single entry.

    3) Now loop at itab2 and delete all the records present in itab1.

    In this way u will get the desired result.

    Reward if useful.

    Regards,

    Rajesh Akarte

    Message was edited by:

    Rajesh Akarte

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 05, 2007 at 06:12 AM

    read that record into header and write :

    <b>delete itab.</b>

    plz reward points if helps.

    regards,

    rahul

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.