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

ti identify discrepancies in internal table data

Hi all,

I do have data in internal table like this...

PODTD Instl Instl.type Premise ContractAccount

100 I1 ELED P1 C1

100 I2 ELES P1 C1

101 I3 ELED P2 C2

102 I4 ELES P2 C2.

I want to delete the records if PODTD are same for the same contract account.

only want to display different PODTD exist for the same contract in the report.

How can i do this check in internal tables? Please give me yours valuable guidance>......

Thanks.<b></b>

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

7 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Oct 23, 2006 at 06:26 PM

    Use DELETE <table> comparing PODTD Contractaccount

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 23, 2006 at 06:27 PM

    Hi

    You can move the same data into another internal table with field structure having Contract Account, PODTD followed by other fields.

    Now you can sort the new internal table by Contract Account and PODTD.

    And, use Delete adjacent duplicates from itab2 comparing Contract Account PODTD.

    Regards,

    Raj

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi,

      Thankyou everybody, I need to find pair of records like

      PODID INST INSTLTYPE PREMISE CONTRACTACCOUNT

      100 I1 ELED P1 CA1

      101 I2 ELED P2 CA2

      100 I3 ELES P1 CA1

      102 I4 ELES P2 CA2

      Records maybe like ,from this I need to first collet the pair like

      100 I1 ELED P1 CA1

      100 I3 ELES P1 CA1 becasue each contact account have two installation type, One is Electric distribution(ELED), one for electric supply(ELES). I need to delete the above record from internal table.

      I need to display this record into display.

      101 I2 ELED p2 CA2

      102 I4 ELES p2 CA2

      How can i check this? If i do compare PODTD & contract account fields not showing correct data?

      Help me please....

  • Posted on Oct 23, 2006 at 06:30 PM

    Hi,

    If I understand your problem correctly, The following code you can use.

    DELETE ADJACENT DUPLICATES FROM itab COMPARING PODTD CONTRACTACCOUNT.

    The above statement will delete all records except the first record from the internal table ITAB if PODTD CONTRACTACCOUNT are same in other records.

    Please let us know if my above code is not useful.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      I want to display this pair of records in my report display, Just want to delete the pair of records if PODTD are same

      101 I3 ELED P2 C2

      102 I4 ELES P2 C2.

      Can i use delete duplicates for this????

  • author's profile photo Former Member
    Former Member
    Posted on Oct 23, 2006 at 07:03 PM

    Hi

    Yes you can use <b>delete adjacent duplicates comparing <keyfield1> <keyfield2></b>

    If it is per Contract Account (i.e distinct PODTD)

    then, Keyfield1 = Contract Account and Keyfield2 = PODTD.

    Regards,

    Raj

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 23, 2006 at 07:05 PM

    Hi,

    For doing DELETE ADJACENT DUPLICATES you have to sort the internal table first.

    SORT ITAB BY PODTD CONTRACT_ACCOUNT.

    DELETE ADJACENT DUPLICATES FROM ITAB COMPARING PODTD CONTRACT_ACCOUNT.

    Thanks,

    Naren

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 23, 2006 at 08:13 PM

    Hi,

    This is the output you want right??

    100 I1 ELED P1 CA1

    101 I2 ELED P2 CA2

    102 I4 ELES P2 CA2

    Then use SORT and DELETE ADJACENT DUPLICATES..As I mentioned above..

    SORT ITAB BY PODTD CONTRACT_ACCOUNT.

    DELETE ADJACENT DUPLICATES FROM ITAB COMPARING PODTD CONTRACT_ACCOUNT.

    Thanks,

    Naren

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 23, 2006 at 08:32 PM

    Hi,

    Okay..Got it..Check this ..

    • Declare a temporary internal table with the same structure as your internal table that has the data..

    DATA: ITAB_TEMP LIKE ITAB OCCURS 0 WITH HEADER LINE.

    ITAB_TEMP[] = ITAB[].

    DATA: V_TABIX TYPE SYTABIX.

    LOOP AT ITAB_TEMP.

    CLEAR: V_TABIX.

    LOOP AT ITAB WHERE PODTD = ITAB_TEMP-PODTD

    AND CONTRACT_ACCOUNT =

    ITAB_TEMP-CONTRACT_ACCOUNT.

    V_TABIX = V_TABIX + 1.

    ENDLOOP.

    IF V_TABIX > 1.

    DELETE ITAB WHERE PODTD = ITAB_TEMP-PODTD

    AND CONTRACT_ACCOUNT =

    ITAB_TEMP-CONTRACT_ACCOUNT.

    ENDIF.

    ENDLOOP.

    • ITAB internal table will have the final values..

    Hope this works..

    Thanks,

    Naren

    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.