<?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: Key problem in innerJoin in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/key-problem-in-innerjoin/m-p/6884473#M1479158</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Daniel,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;You'll first need to retrieve STPO records that you want to use as the key for your search into an itab.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;How to get the STPO records I need. The cdpos~tabkey was my key to get the needed records from stpos otherwise I have to get all the stpo records into an itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;i'd still provide the objectclass and objectid so you can avoid a full table scan.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;where to provide the above condition.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Iam already providing it on&lt;/P&gt;&lt;P&gt;inner join cdpos on cdhdr&lt;SUB&gt;objectclas = cdpos&lt;/SUB&gt;objectclas&lt;/P&gt;&lt;P&gt;          and cdhdr&lt;SUB&gt;changenr = cdpos&lt;/SUB&gt;changenr&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Kohinoor72 on May 21, 2010 7:04 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 21 May 2010 16:11:09 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2010-05-21T16:11:09Z</dc:date>
    <item>
      <title>Key problem in innerJoin</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/key-problem-in-innerjoin/m-p/6884469#M1479154</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Iam trying to get some fields from the tables cdpos and stpo using the following query &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;select cdpos~valueold cdpos~tabname 
         stpo~stlr stpo~position stpo~component into CORRESPONDING FIELDS OF TABLE gt_ditab from
	 cdpos
	INNER JOIN stpo on cdpos~tabkey = stpo~(mandt+bomtype+bom+nodetype+counter)
	where cdpos~tabname = ' 'stpo'.	&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;In the innerJoin " &lt;STRONG&gt;INNER JOIN stpo on cdpos&lt;SUB&gt;tabkey = stpos&lt;/SUB&gt;( mandt&lt;EM&gt;bomtype&lt;/EM&gt;bom&lt;EM&gt;nodetype&lt;/EM&gt;counter)"&lt;/STRONG&gt; - the cdpos~tabkey is a concateneted value from the fields(mandt&lt;EM&gt;bomtype&lt;/EM&gt;bom&lt;EM&gt;nodetype&lt;/EM&gt;counter) in stpos. how to make a join condition here.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Koh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 May 2010 15:21:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/key-problem-in-innerjoin/m-p/6884469#M1479154</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-05-21T15:21:59Z</dc:date>
    </item>
    <item>
      <title>Re: Key problem in innerJoin</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/key-problem-in-innerjoin/m-p/6884470#M1479155</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can't concatenate like that during a join iteslf.  Also, I would seriously suggest you reconsider the query in general.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CDPOS by nature can get very large, since the change items in there are cross application.  Your query, even if you could make the join, will definitely will have major issues in production since you'll be doing a full table scan.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would first try to figure out what BOM header you're working with, and then look up CDHDR to get the change document header, then use the key to read from CDPOS.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 May 2010 15:29:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/key-problem-in-innerjoin/m-p/6884470#M1479155</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-05-21T15:29:49Z</dc:date>
    </item>
    <item>
      <title>Re: Key problem in innerJoin</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/key-problem-in-innerjoin/m-p/6884471#M1479156</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi daniel,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The above was just a test query to show my problem.&lt;/P&gt;&lt;P&gt;In my real query Iam using&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;select cdhdr~username cdhdr~udate cdpos~changeid cdpos~valuenew
         cdpos~valueold cdpos~tabname cdpos~feldname stpo~stlr
         stpo~stlr stpo~position stpo~component 
	 into corresponding fields of table gt_ditab
         from cdhdr
         inner join cdpos on cdhdr~objectclas = cdpos~objectclas
          and cdhdr~changenr = cdpos~changenr
        *+inner join stpo on cdpos~tabkey = stpo~(*+
            +*mandt+bomtype+bom+nodetype+counter)*+

	where where cdhdr~objectclas = 'stue'
        and cdhdr~udate in so_date
	AND cdpos~tabname = 'stpo'.
	&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I know that it cant be concateneted as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;INNER JOIN stpo on cdpos&lt;SUB&gt;tabkey = stpo&lt;/SUB&gt;(mandt&lt;EM&gt;bomtype&lt;/EM&gt;bom&lt;EM&gt;nodetype&lt;/EM&gt;counter).&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How to rewrite the above join condition.That was my question....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Kohinoor72 on May 21, 2010 5:49 PM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Kohinoor72 on May 21, 2010 5:50 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 May 2010 15:43:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/key-problem-in-innerjoin/m-p/6884471#M1479156</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-05-21T15:43:05Z</dc:date>
    </item>
    <item>
      <title>Re: Key problem in innerJoin</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/key-problem-in-innerjoin/m-p/6884472#M1479157</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In that case, you won't be able to do the join.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You'll first need to retrieve STPO records that you want to use as the key for your search into an itab, then concatenate it into a compatible column of TABKEY (type CDTABKEY).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Afterwards, you can try to "use for all entries".  However, i'd still provide the objectclass and objectid so you can avoid a full table scan.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 May 2010 15:51:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/key-problem-in-innerjoin/m-p/6884472#M1479157</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-05-21T15:51:15Z</dc:date>
    </item>
    <item>
      <title>Re: Key problem in innerJoin</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/key-problem-in-innerjoin/m-p/6884473#M1479158</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Daniel,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;You'll first need to retrieve STPO records that you want to use as the key for your search into an itab.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;How to get the STPO records I need. The cdpos~tabkey was my key to get the needed records from stpos otherwise I have to get all the stpo records into an itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;i'd still provide the objectclass and objectid so you can avoid a full table scan.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;where to provide the above condition.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Iam already providing it on&lt;/P&gt;&lt;P&gt;inner join cdpos on cdhdr&lt;SUB&gt;objectclas = cdpos&lt;/SUB&gt;objectclas&lt;/P&gt;&lt;P&gt;          and cdhdr&lt;SUB&gt;changenr = cdpos&lt;/SUB&gt;changenr&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Kohinoor72 on May 21, 2010 7:04 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 May 2010 16:11:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/key-problem-in-innerjoin/m-p/6884473#M1479158</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-05-21T16:11:09Z</dc:date>
    </item>
    <item>
      <title>Re: Key problem in innerJoin</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/key-problem-in-innerjoin/m-p/6884474#M1479159</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you know what BOM's you're dealing with, the objectid in CDHDR should be the concatenation of mandt, stlty, and stlnr.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 May 2010 17:49:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/key-problem-in-innerjoin/m-p/6884474#M1479159</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-05-21T17:49:44Z</dc:date>
    </item>
    <item>
      <title>Re: Key problem in innerJoin</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/key-problem-in-innerjoin/m-p/6884475#M1479160</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;so I can do something as follows right.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Instead of doing a check like this "cdpos&lt;SUB&gt;tabkey = stpo&lt;/SUB&gt;(mandt&lt;EM&gt;bomtype&lt;/EM&gt;bom&lt;EM&gt;nodetype&lt;/EM&gt;counter).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can also do it as follows right&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cdpos&lt;SUB&gt;tabkey = cdhdr&lt;/SUB&gt;(mandant+objectid) and&lt;/P&gt;&lt;P&gt;CDHDR&lt;SUB&gt;ObjectId = stpo&lt;/SUB&gt;(mandt, stlty, and stlnr.)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;select * from cdhdr into TABLE  gt_cdhdr where cdhdr~objectclas =
'stue' and cdhdr~udate in so_date.

 loop at gt_cdhdr.

      h_tabkey-low(3)    = gt_cdhdr-mandant.
      h_tabkey-low+3(18) = gt_cdhdr-objectid.
      append h_tabkey.
      h_mandant = gt_cdhdr-objectid+2(4).
      h_stlType = gt_cdhdr-objectid+6(4).
      h_stlNummer = gt_cdhdr-objectid+10(4).
      append  h_mandant.
      append  h_stlType.
      append  h_stlNummer.
   endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then make a select on cdpos with h_tabkey and on stpo with  h_mandant,h_stlType and h_stlNummer.&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: Kohinoor72 on May 22, 2010 1:21 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 22 May 2010 11:09:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/key-problem-in-innerjoin/m-p/6884475#M1479160</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-05-22T11:09:35Z</dc:date>
    </item>
  </channel>
</rss>

