<?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: Fetching data from SD tables and creating view in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/fetching-data-from-sd-tables-and-creating-view/m-p/3409771#M818888</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;You can link VBRK/VBRP to VBAK/VBAP in two ways:&lt;/P&gt;&lt;P&gt;1. Simplest version is to use fields from VBRP: VBRP-AUBEL and VBRP-AUPOS; this fields are containing sales document number and sales document position (I'm not 100% sure what this fields will contain if you have a full SD cycle with lets say contract -&amp;gt; sales order -&amp;gt; delivery -&amp;gt; invoice, if they will contain sales order relation of contract relation; this has to be checked).&lt;/P&gt;&lt;P&gt;Using those fields you should write a select like this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
select
  from vbrk inner join vbrp on vbrk~vbeln = vbrp~vbeln
                inner join vbak on vbrp~aubel = vbak~vbeln
                inner join vbap on vbrp~aubel = vbap~vbeln and
                                   vbrp~vgbel = vbap~vgbel
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;You should add what fields you want to extract (using this example you have access to all fields form VBRK, VBRP, VBAK and VBAP).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. Seccond option is to use the VBFA table which contains the document flow (check what contains this table in different examples of document flow to build your logic for extracting data).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope this is helpful for you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR,&lt;/P&gt;&lt;P&gt;Valentin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 13 Feb 2008 09:02:58 GMT</pubDate>
    <dc:creator>valentin_catalin2</dc:creator>
    <dc:date>2008-02-13T09:02:58Z</dc:date>
    <item>
      <title>Fetching data from SD tables and creating view</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fetching-data-from-sd-tables-and-creating-view/m-p/3409769#M818886</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;I want the following fileds in my view.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1.Slaes doc- VBAK-VBELN&lt;/P&gt;&lt;P&gt;2.Created On-VBAK-ERDAT&lt;/P&gt;&lt;P&gt;3.Purch.Order No-VBAK-BSTNK&lt;/P&gt;&lt;P&gt;4.Ref1- VBAK-IHREZ&lt;/P&gt;&lt;P&gt;5.Sold to party- VBAK-KUNNR&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;6.Billing doc- VBRP-VBELN&lt;/P&gt;&lt;P&gt;7.Material- VBRP-MATNR&lt;/P&gt;&lt;P&gt;8.Originating doc- VBRP-VBELV&lt;/P&gt;&lt;P&gt;9.NetValue VBRP-NETWR&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is it possible to create relation between vbak and vbrp, if not how can I fetch these filed from other tables, relate them and create a view. Actualy I want to create a Sales Invoice, where I want to use Sales doc and Billing doc togather. The fileds which I required, I found in these tables, but I am not clear how I can relate these tables and create a view.&lt;/P&gt;&lt;P&gt;Please guide&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cheers&lt;/P&gt;&lt;P&gt;AJ&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Feb 2008 15:14:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fetching-data-from-sd-tables-and-creating-view/m-p/3409769#M818886</guid>
      <dc:creator>anupam_srivastava2</dc:creator>
      <dc:date>2008-02-12T15:14:53Z</dc:date>
    </item>
    <item>
      <title>Re: Fetching data from SD tables and creating view</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fetching-data-from-sd-tables-and-creating-view/m-p/3409770#M818887</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Go to the sqvi transaction and mention the two tables (VBAK and VBRP)for which u want to create a view.&lt;/P&gt;&lt;P&gt;The fields that are common will get joined automatically u can even remove it if not required.&lt;/P&gt;&lt;P&gt;U can select the fields that are to be displayed in the output.&lt;/P&gt;&lt;P&gt;hence u will have the required output.&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;Sai&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Feb 2008 16:53:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fetching-data-from-sd-tables-and-creating-view/m-p/3409770#M818887</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-12T16:53:48Z</dc:date>
    </item>
    <item>
      <title>Re: Fetching data from SD tables and creating view</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fetching-data-from-sd-tables-and-creating-view/m-p/3409771#M818888</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;You can link VBRK/VBRP to VBAK/VBAP in two ways:&lt;/P&gt;&lt;P&gt;1. Simplest version is to use fields from VBRP: VBRP-AUBEL and VBRP-AUPOS; this fields are containing sales document number and sales document position (I'm not 100% sure what this fields will contain if you have a full SD cycle with lets say contract -&amp;gt; sales order -&amp;gt; delivery -&amp;gt; invoice, if they will contain sales order relation of contract relation; this has to be checked).&lt;/P&gt;&lt;P&gt;Using those fields you should write a select like this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
select
  from vbrk inner join vbrp on vbrk~vbeln = vbrp~vbeln
                inner join vbak on vbrp~aubel = vbak~vbeln
                inner join vbap on vbrp~aubel = vbap~vbeln and
                                   vbrp~vgbel = vbap~vgbel
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;You should add what fields you want to extract (using this example you have access to all fields form VBRK, VBRP, VBAK and VBAP).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. Seccond option is to use the VBFA table which contains the document flow (check what contains this table in different examples of document flow to build your logic for extracting data).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope this is helpful for you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR,&lt;/P&gt;&lt;P&gt;Valentin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Feb 2008 09:02:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fetching-data-from-sd-tables-and-creating-view/m-p/3409771#M818888</guid>
      <dc:creator>valentin_catalin2</dc:creator>
      <dc:date>2008-02-13T09:02:58Z</dc:date>
    </item>
  </channel>
</rss>

