<?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 please help in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/please-help/m-p/1700832#M307269</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;    I have to design a report where there are five inputs &lt;/P&gt;&lt;P&gt;wbs element, cost center no, purchasing group, plant no and po creation date. the data is taken from ekko, ekpo and ekkn. and all the inputs are optional. so the input can be in one field or any combination. My doubt is can I join the three tables for this requirement as below,&lt;/P&gt;&lt;P&gt; SELECT a~ebeln&lt;/P&gt;&lt;P&gt;         a~bsart&lt;/P&gt;&lt;P&gt;         a~lifnr&lt;/P&gt;&lt;P&gt;         a~ekgrp&lt;/P&gt;&lt;P&gt;         a~aedat&lt;/P&gt;&lt;P&gt;         a~waers&lt;/P&gt;&lt;P&gt;         b~werks&lt;/P&gt;&lt;P&gt;         c~ps_psp_pnr&lt;/P&gt;&lt;P&gt;         c~kostl&lt;/P&gt;&lt;P&gt;  INTO CORRESPONDING FIELDS OF TABLE po_hdr&lt;/P&gt;&lt;P&gt;  FROM ekko as a&lt;/P&gt;&lt;P&gt;  JOIN ekpo as b ON a&lt;SUB&gt;ebeln = b&lt;/SUB&gt;ebeln&lt;/P&gt;&lt;P&gt;  JOIN ekkn as c ON a&lt;SUB&gt;ebeln = c&lt;/SUB&gt;ebeln&lt;/P&gt;&lt;P&gt;  WHERE a~bsart IN ('PO','EBP')&lt;/P&gt;&lt;P&gt;  AND   a~ekgrp IN pgrp_no&lt;/P&gt;&lt;P&gt;  AND   a~bedat IN po_dt&lt;/P&gt;&lt;P&gt;  AND   b~werks IN pl_no&lt;/P&gt;&lt;P&gt;  AND   c~ps_psp_pnr IN wbs_no&lt;/P&gt;&lt;P&gt;  AND   c~kostl IN cc_no.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  v_chk2 = sy-subrc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  IF v_chk2 = 0.&lt;/P&gt;&lt;P&gt;    SELECT ebeln&lt;/P&gt;&lt;P&gt;           ebelp&lt;/P&gt;&lt;P&gt;           txz01&lt;/P&gt;&lt;P&gt;           werks&lt;/P&gt;&lt;P&gt;           brtwr&lt;/P&gt;&lt;P&gt;    INTO CORRESPONDING FIELDS OF TABLE po_det&lt;/P&gt;&lt;P&gt;    FROM ekpo&lt;/P&gt;&lt;P&gt;    FOR ALL ENTRIES IN po_hdr&lt;/P&gt;&lt;P&gt;    WHERE ebeln = po_hdr-ebeln&lt;/P&gt;&lt;P&gt;    AND   loekz &amp;lt;&amp;gt; 'L'&lt;/P&gt;&lt;P&gt;    AND   werks IN pl_no.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;*Populating the internal table WBS_DET with the WBS Details from EKKN.&lt;/P&gt;&lt;P&gt;    SELECT ebeln&lt;/P&gt;&lt;P&gt;           ebelp&lt;/P&gt;&lt;P&gt;           kostl&lt;/P&gt;&lt;P&gt;           ps_psp_pnr&lt;/P&gt;&lt;P&gt;    INTO CORRESPONDING FIELDS OF TABLE wbs_det&lt;/P&gt;&lt;P&gt;    FROM ekkn&lt;/P&gt;&lt;P&gt;    FOR ALL ENTRIES IN po_det&lt;/P&gt;&lt;P&gt;    WHERE ebeln = po_det-ebeln&lt;/P&gt;&lt;P&gt;    AND   ps_psp_pnr IN wbs_no&lt;/P&gt;&lt;P&gt;    AND   kostl IN cc_no.&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and proceed like this. Should I match the ebelp for the detail tables ekpo and ekkn?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 02 Nov 2006 04:48:02 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-11-02T04:48:02Z</dc:date>
    <item>
      <title>please help</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/please-help/m-p/1700832#M307269</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;    I have to design a report where there are five inputs &lt;/P&gt;&lt;P&gt;wbs element, cost center no, purchasing group, plant no and po creation date. the data is taken from ekko, ekpo and ekkn. and all the inputs are optional. so the input can be in one field or any combination. My doubt is can I join the three tables for this requirement as below,&lt;/P&gt;&lt;P&gt; SELECT a~ebeln&lt;/P&gt;&lt;P&gt;         a~bsart&lt;/P&gt;&lt;P&gt;         a~lifnr&lt;/P&gt;&lt;P&gt;         a~ekgrp&lt;/P&gt;&lt;P&gt;         a~aedat&lt;/P&gt;&lt;P&gt;         a~waers&lt;/P&gt;&lt;P&gt;         b~werks&lt;/P&gt;&lt;P&gt;         c~ps_psp_pnr&lt;/P&gt;&lt;P&gt;         c~kostl&lt;/P&gt;&lt;P&gt;  INTO CORRESPONDING FIELDS OF TABLE po_hdr&lt;/P&gt;&lt;P&gt;  FROM ekko as a&lt;/P&gt;&lt;P&gt;  JOIN ekpo as b ON a&lt;SUB&gt;ebeln = b&lt;/SUB&gt;ebeln&lt;/P&gt;&lt;P&gt;  JOIN ekkn as c ON a&lt;SUB&gt;ebeln = c&lt;/SUB&gt;ebeln&lt;/P&gt;&lt;P&gt;  WHERE a~bsart IN ('PO','EBP')&lt;/P&gt;&lt;P&gt;  AND   a~ekgrp IN pgrp_no&lt;/P&gt;&lt;P&gt;  AND   a~bedat IN po_dt&lt;/P&gt;&lt;P&gt;  AND   b~werks IN pl_no&lt;/P&gt;&lt;P&gt;  AND   c~ps_psp_pnr IN wbs_no&lt;/P&gt;&lt;P&gt;  AND   c~kostl IN cc_no.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  v_chk2 = sy-subrc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  IF v_chk2 = 0.&lt;/P&gt;&lt;P&gt;    SELECT ebeln&lt;/P&gt;&lt;P&gt;           ebelp&lt;/P&gt;&lt;P&gt;           txz01&lt;/P&gt;&lt;P&gt;           werks&lt;/P&gt;&lt;P&gt;           brtwr&lt;/P&gt;&lt;P&gt;    INTO CORRESPONDING FIELDS OF TABLE po_det&lt;/P&gt;&lt;P&gt;    FROM ekpo&lt;/P&gt;&lt;P&gt;    FOR ALL ENTRIES IN po_hdr&lt;/P&gt;&lt;P&gt;    WHERE ebeln = po_hdr-ebeln&lt;/P&gt;&lt;P&gt;    AND   loekz &amp;lt;&amp;gt; 'L'&lt;/P&gt;&lt;P&gt;    AND   werks IN pl_no.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;*Populating the internal table WBS_DET with the WBS Details from EKKN.&lt;/P&gt;&lt;P&gt;    SELECT ebeln&lt;/P&gt;&lt;P&gt;           ebelp&lt;/P&gt;&lt;P&gt;           kostl&lt;/P&gt;&lt;P&gt;           ps_psp_pnr&lt;/P&gt;&lt;P&gt;    INTO CORRESPONDING FIELDS OF TABLE wbs_det&lt;/P&gt;&lt;P&gt;    FROM ekkn&lt;/P&gt;&lt;P&gt;    FOR ALL ENTRIES IN po_det&lt;/P&gt;&lt;P&gt;    WHERE ebeln = po_det-ebeln&lt;/P&gt;&lt;P&gt;    AND   ps_psp_pnr IN wbs_no&lt;/P&gt;&lt;P&gt;    AND   kostl IN cc_no.&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and proceed like this. Should I match the ebelp for the detail tables ekpo and ekkn?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Nov 2006 04:48:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/please-help/m-p/1700832#M307269</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-02T04:48:02Z</dc:date>
    </item>
    <item>
      <title>Re: please help</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/please-help/m-p/1700833#M307270</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;  Please try with below code to avoid other two select statements.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;types: begin of t_data,
         ebeln like ekko-ebeln,
         bsart like ekko-bsart,
         lifnr like ekko-lifnr,
         ekgrp like ekko-ekgrp,
         aedat like ekko-aedat,
         waers like ekko-waers,
         ebelp like ekpo-ebelp,
         werks like ekpo-werks,
         txz01 like ekpo-txz01,
         ps_psp_pnr like ekkn-ps_psp_pnr,
         kostl like ekkn-kostl,
       end of t_data.
data: it_po type standard table of t_data,
      wa_po type t_data.

SELECT a~ebeln a~bsart a~lifnr a~ekgrp a~aedat a~waers
       b~ebelp b~werks b~txz01 c~ps_psp_pnr c~kostl
       INTO CORRESPONDING FIELDS OF TABLE it_po
       FROM ekko as a
       JOIN ekpo as b ON a~ebeln = b~ebeln
       JOIN ekkn as c ON a~ebeln = c~ebeln and b~ebelp = c~ebelp
       WHERE a~bsart IN ('PO','EBP')
       AND a~ekgrp IN pgrp_no
       AND a~bedat IN po_dt
       AND b~werks IN pl_no
       AND b~loekz &amp;lt;&amp;gt; 'L'
       AND c~ps_psp_pnr IN wbs_no
       AND c~kostl IN cc_no.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Kind Regards&lt;/P&gt;&lt;P&gt;Eswar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Nov 2006 04:59:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/please-help/m-p/1700833#M307270</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-02T04:59:19Z</dc:date>
    </item>
  </channel>
</rss>

