<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Abap code not working  - deleting based on master data table information in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-code-not-working-deleting-based-on-master-data-table-information/m-p/6977571#M1492197</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I wrote a piece of code earlier which is working and during test we found out that it will be hard for the support guys to maintain because it was hard coded and there is possibility that users will include more code nums in the future&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sample code&lt;/P&gt;&lt;P&gt;DELETE it_source WHERE /M/SOURCE EQ 'USA' AND&lt;/P&gt;&lt;P&gt;/M/CODENUM NE '0999' AND&lt;/P&gt;&lt;P&gt;/MCODENUM NE '0888' AND.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="-------------------------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now I created a new InfoObject master data so that the support people can maintain the source and code number manually.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;master data table - the codenum is the key.&lt;/P&gt;&lt;P&gt;XCODENUM    XSOURCE&lt;/P&gt;&lt;P&gt;0999               IND01&lt;/P&gt;&lt;P&gt;0888               IND01&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now I wrote this routine all the data gets deleted.&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="-------------------------------------------------------------------------------" /&gt;&lt;P&gt;tables /M/PGICTABLE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data tab like /M/PGICTABLE occurs 0 with header line.&lt;/P&gt;&lt;P&gt;Select * from /M/PGICTABLE into table tab where objvers = 'A'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;LOOP at tab.&lt;/P&gt;&lt;P&gt;DELETE it_source WHERE /M/SOURCE EQ tab-XSOURCE AND /M/CODENUM NE tab-XCODENUM.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;Endif.&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="-------------------------------------------------------------------------------" /&gt;&lt;P&gt;But when I chage the sign to EQ, I get opposite values , Not what I require.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DELETE it_source WHERE /M/SOURCE EQ tab-XSOURCE AND &lt;STRONG&gt;/M/CODENUM EQ tab-XCODENUM.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cube table that I want to extract from&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/M/SOURCE                             /M/CODENUM&lt;/P&gt;&lt;P&gt;IND01                                       0999&lt;/P&gt;&lt;P&gt;IND01                                       0888&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;IND01                                       0555&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;IND01                                       0444&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;FRF01                                      0111&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to only the rows where the /M/CODENUM = 0999 and 0888 and i would also need FRF101 &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and the rows in bold  should be deleted.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Bhat Vaidya on Jun 17, 2010 12:38 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 17 Jun 2010 10:38:09 GMT</pubDate>
    <dc:creator>bhat_vaidya2</dc:creator>
    <dc:date>2010-06-17T10:38:09Z</dc:date>
    <item>
      <title>Abap code not working  - deleting based on master data table information</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-code-not-working-deleting-based-on-master-data-table-information/m-p/6977571#M1492197</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I wrote a piece of code earlier which is working and during test we found out that it will be hard for the support guys to maintain because it was hard coded and there is possibility that users will include more code nums in the future&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sample code&lt;/P&gt;&lt;P&gt;DELETE it_source WHERE /M/SOURCE EQ 'USA' AND&lt;/P&gt;&lt;P&gt;/M/CODENUM NE '0999' AND&lt;/P&gt;&lt;P&gt;/MCODENUM NE '0888' AND.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="-------------------------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now I created a new InfoObject master data so that the support people can maintain the source and code number manually.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;master data table - the codenum is the key.&lt;/P&gt;&lt;P&gt;XCODENUM    XSOURCE&lt;/P&gt;&lt;P&gt;0999               IND01&lt;/P&gt;&lt;P&gt;0888               IND01&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now I wrote this routine all the data gets deleted.&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="-------------------------------------------------------------------------------" /&gt;&lt;P&gt;tables /M/PGICTABLE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data tab like /M/PGICTABLE occurs 0 with header line.&lt;/P&gt;&lt;P&gt;Select * from /M/PGICTABLE into table tab where objvers = 'A'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;LOOP at tab.&lt;/P&gt;&lt;P&gt;DELETE it_source WHERE /M/SOURCE EQ tab-XSOURCE AND /M/CODENUM NE tab-XCODENUM.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;Endif.&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="-------------------------------------------------------------------------------" /&gt;&lt;P&gt;But when I chage the sign to EQ, I get opposite values , Not what I require.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DELETE it_source WHERE /M/SOURCE EQ tab-XSOURCE AND &lt;STRONG&gt;/M/CODENUM EQ tab-XCODENUM.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cube table that I want to extract from&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/M/SOURCE                             /M/CODENUM&lt;/P&gt;&lt;P&gt;IND01                                       0999&lt;/P&gt;&lt;P&gt;IND01                                       0888&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;IND01                                       0555&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;IND01                                       0444&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;FRF01                                      0111&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to only the rows where the /M/CODENUM = 0999 and 0888 and i would also need FRF101 &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and the rows in bold  should be deleted.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Bhat Vaidya on Jun 17, 2010 12:38 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Jun 2010 10:38:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-code-not-working-deleting-based-on-master-data-table-information/m-p/6977571#M1492197</guid>
      <dc:creator>bhat_vaidya2</dc:creator>
      <dc:date>2010-06-17T10:38:09Z</dc:date>
    </item>
    <item>
      <title>Re: Abap code not working  - deleting based on master data table information</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-code-not-working-deleting-based-on-master-data-table-information/m-p/6977572#M1492198</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Why do you want to change the sign in your delete statement ? And logically while deleting you have to use the Not Equals operator.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR,&lt;/P&gt;&lt;P&gt;Suhas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Jun 2010 10:43:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-code-not-working-deleting-based-on-master-data-table-information/m-p/6977572#M1492198</guid>
      <dc:creator>SuhaSaha</dc:creator>
      <dc:date>2010-06-17T10:43:16Z</dc:date>
    </item>
    <item>
      <title>Re: Abap code not working  - deleting based on master data table information</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-code-not-working-deleting-based-on-master-data-table-information/m-p/6977573#M1492199</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Changing the sign is for testing. It should be NE but all records gets  deleted.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and thats what I don't understand&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Jun 2010 10:51:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-code-not-working-deleting-based-on-master-data-table-information/m-p/6977573#M1492199</guid>
      <dc:creator>bhat_vaidya2</dc:creator>
      <dc:date>2010-06-17T10:51:44Z</dc:date>
    </item>
    <item>
      <title>Re: Abap code not working  - deleting based on master data table information</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-code-not-working-deleting-based-on-master-data-table-information/m-p/6977574#M1492200</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What is the data in your internal table ITAB ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Jun 2010 10:55:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-code-not-working-deleting-based-on-master-data-table-information/m-p/6977574#M1492200</guid>
      <dc:creator>SuhaSaha</dc:creator>
      <dc:date>2010-06-17T10:55:47Z</dc:date>
    </item>
    <item>
      <title>Re: Abap code not working  - deleting based on master data table information</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-code-not-working-deleting-based-on-master-data-table-information/m-p/6977575#M1492201</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the data in my internal table is same as master data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Data tab like /M/PGICTABLE occurs 0 with header line.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;master data table - the codenum is the key.&lt;/P&gt;&lt;P&gt;XCODENUM                  XSOURCE&lt;/P&gt;&lt;P&gt;0999                             IND01&lt;/P&gt;&lt;P&gt;0888                             IND01&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Jun 2010 10:58:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-code-not-working-deleting-based-on-master-data-table-information/m-p/6977575#M1492201</guid>
      <dc:creator>bhat_vaidya2</dc:creator>
      <dc:date>2010-06-17T10:58:53Z</dc:date>
    </item>
    <item>
      <title>Re: Abap code not working  - deleting based on master data table information</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-code-not-working-deleting-based-on-master-data-table-information/m-p/6977576#M1492202</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It's obvious why it deletes all the records. Debug &amp;amp; get your answer i wont spoon feed &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyways on to achieve your requirement try this code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA:
      r_srce TYPE RANGE OF char5, "Range Table for Source
      s_srce LIKE LINE OF r_srce,
      r_code TYPE RANGE OF numc04,"Range table for Code
      s_code LIKE LINE OF r_code.

s_srce-sign = s_code-sign = 'I'.
s_srce-option = s_code-option = 'EQ'.

* Populate the range tables using /M/PGICTABLE
LOOP AT itab INTO wa.
  s_code-low = wa1-code.
  s_srce-low = wa1-srce.

  APPEND: s_code TO r_code,
          s_srce TO r_srce.
ENDLOOP.

DELETE ADJACENT DUPLICATES FROM:
r_code COMPARING ALL FIELDS,
r_srce COMPARING ALL FIELDS.

* Delete from Cube
DELETE it_source WHERE srce IN r_srce AND code IN r_code.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Jun 2010 11:30:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-code-not-working-deleting-based-on-master-data-table-information/m-p/6977576#M1492202</guid>
      <dc:creator>SuhaSaha</dc:creator>
      <dc:date>2010-06-17T11:30:07Z</dc:date>
    </item>
  </channel>
</rss>

