<?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: Query needed to retreive data in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/query-needed-to-retreive-data/m-p/4821634#M1128356</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well... you seem to be new to ABAP.. hope this helps..... &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
select VBELN, FKART, FKDAT WAERK, KUNRG, KUNWE
from vbrk
into table t_vbrk
where vbeln = s_vbeln. " given in selection screen
if sy-subrc = 0.
endif.

select BSTNK, VBELN, AUART 
from vbak
into table t_vbak
where vbeln = s_vbeln.
if sy-subrc = 0.
endif.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Similarly write the other select queries as well.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Its very useful if you pass the key fields while selecting from the database.  Helps in faster processing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 18 Nov 2008 15:00:52 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-11-18T15:00:52Z</dc:date>
    <item>
      <title>Query needed to retreive data</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/query-needed-to-retreive-data/m-p/4821631#M1128353</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There is Selection Screen where it allows to enter KUNNR, LAND1 and VBELN.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to display below fields from table specified.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;VBELN, FKART, FKDAT WAERK, KUNRG, KUNWE from VBRK Table, BSTNK, VBELN, AUART from VBAK Table, POSNR, MATNR, FKIMG, WAVWR from VBRP Table, KBETR from KOMV and MWSBP from KOMP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So i need to find out query to display above fields data as output as per input in selection screen. default values if nothing entered in Selection screen are all data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please help me with Program or Query to retrieve above data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Nov 2008 14:32:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/query-needed-to-retreive-data/m-p/4821631#M1128353</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-11-18T14:32:49Z</dc:date>
    </item>
    <item>
      <title>Re: Query needed to retreive data</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/query-needed-to-retreive-data/m-p/4821632#M1128354</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi New&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;lets see what you can write first.. If you have any question then get back to forum..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Nov 2008 14:38:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/query-needed-to-retreive-data/m-p/4821632#M1128354</guid>
      <dc:creator>former_member156446</dc:creator>
      <dc:date>2008-11-18T14:38:00Z</dc:date>
    </item>
    <item>
      <title>Re: Query needed to retreive data</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/query-needed-to-retreive-data/m-p/4821633#M1128355</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If there was single table, i could have done that&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for eg. Select vbeln fkart fkdat waerk from vbrk into table &amp;lt;internal table name&amp;gt; where kunrg in &amp;lt;selection screen parameter name&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But i m not sure of joining more than one tables and then fetching.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would rather look for syntax not complete solution though.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Nov 2008 14:52:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/query-needed-to-retreive-data/m-p/4821633#M1128355</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-11-18T14:52:50Z</dc:date>
    </item>
    <item>
      <title>Re: Query needed to retreive data</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/query-needed-to-retreive-data/m-p/4821634#M1128356</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well... you seem to be new to ABAP.. hope this helps..... &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
select VBELN, FKART, FKDAT WAERK, KUNRG, KUNWE
from vbrk
into table t_vbrk
where vbeln = s_vbeln. " given in selection screen
if sy-subrc = 0.
endif.

select BSTNK, VBELN, AUART 
from vbak
into table t_vbak
where vbeln = s_vbeln.
if sy-subrc = 0.
endif.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Similarly write the other select queries as well.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Its very useful if you pass the key fields while selecting from the database.  Helps in faster processing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Nov 2008 15:00:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/query-needed-to-retreive-data/m-p/4821634#M1128356</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-11-18T15:00:52Z</dc:date>
    </item>
    <item>
      <title>Re: Query needed to retreive data</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/query-needed-to-retreive-data/m-p/4821635#M1128357</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Make sure that the order of the fields is same as in the data base table, and in the internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And remove the commas as well.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Nov 2008 15:01:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/query-needed-to-retreive-data/m-p/4821635#M1128357</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-11-18T15:01:50Z</dc:date>
    </item>
    <item>
      <title>Re: Query needed to retreive data</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/query-needed-to-retreive-data/m-p/4821636#M1128358</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;   First make an internal table as it_final having all the req fields&lt;/P&gt;&lt;P&gt;   second make it_vbrk, it_vbak, it_vbrp, it_komv, it_komp internal tables with required fields.&lt;/P&gt;&lt;P&gt;   third, Open ddic tables &amp;amp; find out relations among all the tables, &lt;/P&gt;&lt;P&gt;   fourth, now select data from tables into internal tables based on conditions, &lt;/P&gt;&lt;P&gt;   and use for all entries to fill it_final table...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try this, your logic will enhance........&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Regards,&lt;/P&gt;&lt;P&gt;Krishna..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Nov 2008 15:03:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/query-needed-to-retreive-data/m-p/4821636#M1128358</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-11-18T15:03:04Z</dc:date>
    </item>
    <item>
      <title>Re: Query needed to retreive data</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/query-needed-to-retreive-data/m-p/4821637#M1128359</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;   First make an internal table as it_final having all the req fields&lt;/P&gt;&lt;P&gt;   second make it_vbrk, it_vbak, it_vbrp, it_komv, it_komp internal tables with required fields.&lt;/P&gt;&lt;P&gt;   third, Open ddic tables &amp;amp; find out relations among all the tables, &lt;/P&gt;&lt;P&gt;   fourth, now select data from tables into internal tables based on conditions, &lt;/P&gt;&lt;P&gt;   and use for all entries to fill it_final table...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try this, your logic will enhance........&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Regards,&lt;/P&gt;&lt;P&gt;Krishna..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Nov 2008 15:03:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/query-needed-to-retreive-data/m-p/4821637#M1128359</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-11-18T15:03:32Z</dc:date>
    </item>
    <item>
      <title>Re: Query needed to retreive data</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/query-needed-to-retreive-data/m-p/4821638#M1128360</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I'm not going to help you with the code as Jay rightly said. for that you can use F1 on select queries. Once you find how to join tables, you can join tables VBRK and VBRP, then in the VBRP-AUBEL you will get the Sales order order number, using that you can fetch data from VBAK. &lt;/P&gt;&lt;P&gt;And KOMP is not a transparent table. So you might need to use some other table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;Advait&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Nov 2008 15:07:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/query-needed-to-retreive-data/m-p/4821638#M1128360</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-11-18T15:07:46Z</dc:date>
    </item>
    <item>
      <title>Re: Query needed to retreive data</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/query-needed-to-retreive-data/m-p/4821639#M1128361</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Any suggestion or idea as what needs to be done ??&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;jusst logic.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Dec 2008 09:14:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/query-needed-to-retreive-data/m-p/4821639#M1128361</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-12-04T09:14:17Z</dc:date>
    </item>
    <item>
      <title>Re: Query needed to retreive data</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/query-needed-to-retreive-data/m-p/4821640#M1128362</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you want to find the prices of the sales order,using the VBAK-KNUMH you can fetch data from KONV table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;Advait&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Dec 2008 09:18:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/query-needed-to-retreive-data/m-p/4821640#M1128362</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-12-04T09:18:51Z</dc:date>
    </item>
    <item>
      <title>Re: Query needed to retreive data</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/query-needed-to-retreive-data/m-p/4821641#M1128363</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;KONV table has field KBETR,  and you can find MWSBP in VBRK (MWSBK). since they are not transparent tables. you need some common fields to fetch data frm konv. Field "knumv" is common to them. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regarding query, create internal table separately for each table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;At item level, fetch data from VBRP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then proceed with other table with keyword "FOR ALL ENTRIES IN i_vbrp". &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;once you done with that, move ur data final internal table will have all details.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank You,&lt;/P&gt;&lt;P&gt;Pintoo D&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Dec 2008 09:38:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/query-needed-to-retreive-data/m-p/4821641#M1128363</guid>
      <dc:creator>pintoo_d</dc:creator>
      <dc:date>2008-12-04T09:38:39Z</dc:date>
    </item>
  </channel>
</rss>

