<?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 Re: Internal table value checking in custom table using SQL... in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-value-checking-in-custom-table-using-sql/m-p/1073249#M95492</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Tushar,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; To begin with I am assuming that the Z config table that you had been referring to seems to be a lookup table where the internal table entries needs to be validated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Here is a piece of code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; DATA: itab1 TYPE STANDARD TABLE OF lifnr,&lt;/P&gt;&lt;P&gt;       itab2 LIKE itab1,&lt;/P&gt;&lt;P&gt;       wa TYPE lifnr.&lt;/P&gt;&lt;P&gt;  REFRESH itab1.&lt;/P&gt;&lt;P&gt;  LOOP AT X2. "(your internal table).&lt;/P&gt;&lt;P&gt;    CLEAR wa.&lt;/P&gt;&lt;P&gt;    wa = x2-lifnr.&lt;/P&gt;&lt;P&gt;    APPEND wa TO itab1.&lt;/P&gt;&lt;P&gt;  ENDLOOP.&lt;/P&gt;&lt;P&gt;  SELECT lifnr&lt;/P&gt;&lt;P&gt;    FROM zconfigcustomtable&lt;/P&gt;&lt;P&gt;    INTO itab2&lt;/P&gt;&lt;P&gt;  FOR ALL ENTRIES IN itab1&lt;/P&gt;&lt;P&gt;   WHERE lifnr EQ itab1-table_line.&lt;/P&gt;&lt;P&gt;  LOOP AT X2.&lt;/P&gt;&lt;P&gt;    READ TABLE itab2 TRANSPORTING NO FIELDS&lt;/P&gt;&lt;P&gt;                     WITH KEY table_line = x2-lifnr.&lt;/P&gt;&lt;P&gt;    IF NOT sy-subrc IS INITIAL.&lt;/P&gt;&lt;P&gt;      RAISE error.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;  ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Srikanth&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 23 Dec 2005 07:56:13 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2005-12-23T07:56:13Z</dc:date>
    <item>
      <title>Internal table value checking in custom table using SQL...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-value-checking-in-custom-table-using-sql/m-p/1073245#M95488</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a table which has following fields:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;X1 TABLE (ZCONfig custom table)      &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LIFNR  land1                    &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;123      br                     &lt;/P&gt;&lt;P&gt;234      br                      &lt;/P&gt;&lt;P&gt;456      br                      &lt;/P&gt;&lt;P&gt;567      Gr&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and &lt;/P&gt;&lt;P&gt;X2 TABLE: (Internal table)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LIFNR:&lt;/P&gt;&lt;P&gt; 234&lt;/P&gt;&lt;P&gt; 567&lt;/P&gt;&lt;P&gt; 123&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now I want to see if all the field values of LIFNR in internal table X2 (X2-LIFNR) are present in X1 or not. &lt;/P&gt;&lt;P&gt;Raise error if it is not.&lt;/P&gt;&lt;P&gt;How do I do this using SQL ? I guess I have to use read statement.&lt;/P&gt;&lt;P&gt;Please help. Points will be awarded.&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Dec 2005 07:44:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-value-checking-in-custom-table-using-sql/m-p/1073245#M95488</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-12-23T07:44:37Z</dc:date>
    </item>
    <item>
      <title>Re: Internal table value checking in custom table using SQL...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-value-checking-in-custom-table-using-sql/m-p/1073246#M95489</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Urgent help is required...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Dec 2005 07:48:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-value-checking-in-custom-table-using-sql/m-p/1073246#M95489</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-12-23T07:48:21Z</dc:date>
    </item>
    <item>
      <title>Re: Internal table value checking in custom table using SQL...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-value-checking-in-custom-table-using-sql/m-p/1073247#M95490</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Tushar,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1 Ya u are right , we need to use READ statement.&lt;/P&gt;&lt;P&gt;2. Populate X1 (all records)&lt;/P&gt;&lt;P&gt;   in an internal table.&lt;/P&gt;&lt;P&gt;3. Then Loop at X2&lt;/P&gt;&lt;P&gt;   and compare with X1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  ( u can also keep an extra field in X2&lt;/P&gt;&lt;P&gt;    of type c, so that if a record is found,&lt;/P&gt;&lt;P&gt;   mark it as X )&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;4. try this code (just copy paste)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPORT abc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA : BEGIN OF itab OCCURS 0,&lt;/P&gt;&lt;P&gt;       bukrs LIKE t001-bukrs,&lt;/P&gt;&lt;P&gt;       present TYPE c,&lt;/P&gt;&lt;P&gt;       END OF itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA : t001 LIKE TABLE OF t001 WITH HEADER LINE.&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="-------------------" /&gt;&lt;P&gt;itab-bukrs = '1000'.&lt;/P&gt;&lt;P&gt;APPEND itab.&lt;/P&gt;&lt;P&gt;itab-bukrs = 'X000'.&lt;/P&gt;&lt;P&gt;APPEND itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT * FROM t001 INTO TABLE t001.&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="-----------------" /&gt;&lt;P&gt;LOOP AT itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  READ TABLE t001 with key bukrs = itab-bukrs.&lt;/P&gt;&lt;P&gt;  IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;    itab-present = 'X'.&lt;/P&gt;&lt;P&gt;    MODIFY itab.&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BREAK-POINT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;amit m.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Amit Mittal&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Dec 2005 07:52:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-value-checking-in-custom-table-using-sql/m-p/1073247#M95490</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-12-23T07:52:55Z</dc:date>
    </item>
    <item>
      <title>Re: Internal table value checking in custom table using SQL...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-value-checking-in-custom-table-using-sql/m-p/1073248#M95491</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Tushar,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try this,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Loop at X2.&lt;/P&gt;&lt;P&gt;READ table X1 with key lifnr = X2-lifnr.&lt;/P&gt;&lt;P&gt;if sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;error message.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Lakshman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Dec 2005 07:53:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-value-checking-in-custom-table-using-sql/m-p/1073248#M95491</guid>
      <dc:creator>Lakshmant1</dc:creator>
      <dc:date>2005-12-23T07:53:56Z</dc:date>
    </item>
    <item>
      <title>Re: Internal table value checking in custom table using SQL...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-value-checking-in-custom-table-using-sql/m-p/1073249#M95492</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Tushar,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; To begin with I am assuming that the Z config table that you had been referring to seems to be a lookup table where the internal table entries needs to be validated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Here is a piece of code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; DATA: itab1 TYPE STANDARD TABLE OF lifnr,&lt;/P&gt;&lt;P&gt;       itab2 LIKE itab1,&lt;/P&gt;&lt;P&gt;       wa TYPE lifnr.&lt;/P&gt;&lt;P&gt;  REFRESH itab1.&lt;/P&gt;&lt;P&gt;  LOOP AT X2. "(your internal table).&lt;/P&gt;&lt;P&gt;    CLEAR wa.&lt;/P&gt;&lt;P&gt;    wa = x2-lifnr.&lt;/P&gt;&lt;P&gt;    APPEND wa TO itab1.&lt;/P&gt;&lt;P&gt;  ENDLOOP.&lt;/P&gt;&lt;P&gt;  SELECT lifnr&lt;/P&gt;&lt;P&gt;    FROM zconfigcustomtable&lt;/P&gt;&lt;P&gt;    INTO itab2&lt;/P&gt;&lt;P&gt;  FOR ALL ENTRIES IN itab1&lt;/P&gt;&lt;P&gt;   WHERE lifnr EQ itab1-table_line.&lt;/P&gt;&lt;P&gt;  LOOP AT X2.&lt;/P&gt;&lt;P&gt;    READ TABLE itab2 TRANSPORTING NO FIELDS&lt;/P&gt;&lt;P&gt;                     WITH KEY table_line = x2-lifnr.&lt;/P&gt;&lt;P&gt;    IF NOT sy-subrc IS INITIAL.&lt;/P&gt;&lt;P&gt;      RAISE error.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;  ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Srikanth&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Dec 2005 07:56:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-value-checking-in-custom-table-using-sql/m-p/1073249#M95492</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-12-23T07:56:13Z</dc:date>
    </item>
    <item>
      <title>Re: Internal table value checking in custom table using SQL...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-value-checking-in-custom-table-using-sql/m-p/1073250#M95493</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;select *
       from ztable
       into table it_ztable.
if sy-subrc = 0.
loop at it_x2table.
read table it_ztable with key lifnr = it_x2table-lifnr.
if sy-subrc &amp;lt;&amp;gt; 0.
raise error.....
endif.
endloop.
 
endif.&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Dec 2005 07:59:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-value-checking-in-custom-table-using-sql/m-p/1073250#M95493</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-12-23T07:59:09Z</dc:date>
    </item>
    <item>
      <title>Re: Internal table value checking in custom table using SQL...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-value-checking-in-custom-table-using-sql/m-p/1073251#M95494</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Tushar, do the other way round, it will be faster&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: ii type i.&lt;/P&gt;&lt;P&gt;loop at X2.&lt;/P&gt;&lt;P&gt;clear: ii.&lt;/P&gt;&lt;P&gt;select count(*) from x1 into ii.&lt;/P&gt;&lt;P&gt;if ii = 0 or sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;*raise error&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Dec 2005 08:02:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-value-checking-in-custom-table-using-sql/m-p/1073251#M95494</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-12-23T08:02:51Z</dc:date>
    </item>
  </channel>
</rss>

