<?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: SQL Select Issue in VBFA in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/sql-select-issue-in-vbfa/m-p/12656560#M2015397</link>
    <description>&lt;BR /&gt;It is possible that the data in the VBFA table has been updated with multiple entries that have the same delivery document number (VBELN). This could happen if the data has been updated manually or if a program was used to update the data. Additionally, it is possible that the entries in the VBFA table were created with the same delivery document number.</description>
    <pubDate>Mon, 27 Feb 2023 08:31:47 GMT</pubDate>
    <dc:creator>Yogananda</dc:creator>
    <dc:date>2023-02-27T08:31:47Z</dc:date>
    <item>
      <title>SQL Select Issue in VBFA</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sql-select-issue-in-vbfa/m-p/12656559#M2015396</link>
      <description>&lt;P&gt;I'm currently encountering an issue where in multiple data were selected in table VBFA. While the parameter is unique which is LIKP-VBELN which equates to Delivery Document Number. However, when the program passes this code, it is showing multiple sales delivery with same delivery document. How does that happen?&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;      SELECT vbelv&lt;BR /&gt;             vbeln&lt;BR /&gt;             matnr&lt;BR /&gt;        FROM vbfa&lt;BR /&gt;        INTO TABLE it_vbfa&lt;BR /&gt;       WHERE vbeln = it_likp-vbeln.&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 27 Feb 2023 08:05:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sql-select-issue-in-vbfa/m-p/12656559#M2015396</guid>
      <dc:creator>walkerist79</dc:creator>
      <dc:date>2023-02-27T08:05:01Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Select Issue in VBFA</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sql-select-issue-in-vbfa/m-p/12656560#M2015397</link>
      <description>&lt;BR /&gt;It is possible that the data in the VBFA table has been updated with multiple entries that have the same delivery document number (VBELN). This could happen if the data has been updated manually or if a program was used to update the data. Additionally, it is possible that the entries in the VBFA table were created with the same delivery document number.</description>
      <pubDate>Mon, 27 Feb 2023 08:31:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sql-select-issue-in-vbfa/m-p/12656560#M2015397</guid>
      <dc:creator>Yogananda</dc:creator>
      <dc:date>2023-02-27T08:31:47Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Select Issue in VBFA</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sql-select-issue-in-vbfa/m-p/12656561#M2015398</link>
      <description>&lt;P&gt;It is possible that the query you have written is not correctly restricting the result set to a single delivery document. There might be multiple entries in the VBFA table for the same delivery document number (LIKP-VBELN). &lt;/P&gt;&lt;BR /&gt;
To make sure the query returns only one delivery document, you should add a condition to the WHERE clause to make sure only one row is returned:

&lt;PRE&gt;&lt;CODE&gt;SELECT vbelv&lt;BR /&gt;       vbeln&lt;BR /&gt;       matnr&lt;BR /&gt;  FROM vbfa&lt;BR /&gt;  INTO TABLE it_vbfa&lt;BR /&gt; WHERE vbeln = it_likp-vbeln&lt;BR /&gt;   AND rownum = 1;&lt;/CODE&gt;&lt;/PRE&gt;
This will ensure that only one row is returned in the result set.</description>
      <pubDate>Mon, 27 Feb 2023 08:32:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sql-select-issue-in-vbfa/m-p/12656561#M2015398</guid>
      <dc:creator>Yogananda</dc:creator>
      <dc:date>2023-02-27T08:32:03Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Select Issue in VBFA</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sql-select-issue-in-vbfa/m-p/12656562#M2015399</link>
      <description>&lt;P&gt;Why do you think it should return a single line? The primary key of VBFA is not made of VBELN only.&lt;/P&gt;</description>
      <pubDate>Mon, 27 Feb 2023 08:58:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sql-select-issue-in-vbfa/m-p/12656562#M2015399</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2023-02-27T08:58:50Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Select Issue in VBFA</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sql-select-issue-in-vbfa/m-p/12656563#M2015400</link>
      <description>&lt;P&gt;Call transaction VL03N and check the document flow, it's possible that multiple sales orders or sales order items are processed within a single delivery.&lt;/P&gt;&lt;P&gt;Also you could add more criteria in the select (e.g. delivery item number) if you don't require item numbers or use a DISTINCT clause.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;      SELECT DISTINCT vbelv,
             vbeln,
             matnr
        FROM vbfa
        INTO TABLE it_vbfa
       WHERE vbeln   = it_likp-vbeln
	     AND vbtyp_n = c_delivery " 'J'
	     AND vbtyp_v = c_order. " 'C'&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 27 Feb 2023 09:22:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sql-select-issue-in-vbfa/m-p/12656563#M2015400</guid>
      <dc:creator>RaymondGiuseppi</dc:creator>
      <dc:date>2023-02-27T09:22:15Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Select Issue in VBFA</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sql-select-issue-in-vbfa/m-p/12656564#M2015401</link>
      <description>&lt;P&gt;Try below.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT a~vbelv
       a~vbeln
       a~matnr
  FROM vbfa as a
  inner Join likp as b
  WHERE vbeln = b~vbeln.
  INTO TABLE it_vbfa.&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 27 Feb 2023 10:16:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sql-select-issue-in-vbfa/m-p/12656564#M2015401</guid>
      <dc:creator>shantraj6</dc:creator>
      <dc:date>2023-02-27T10:16:49Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Select Issue in VBFA</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sql-select-issue-in-vbfa/m-p/12656565#M2015402</link>
      <description>&lt;P&gt;From a data point of view table &lt;EM&gt;VBFA &lt;/EM&gt;is to be used when selecting subsequent documents. For instance selecting delivery document items for sales order items. Then the source document, like sales order, is in &lt;EM&gt;VBFA-VBELV&lt;/EM&gt; and the subsequent document, like delivery, is in &lt;EM&gt;VBFA-VBELN&lt;/EM&gt;.&lt;/P&gt;&lt;P&gt;Here you are selecting preceding documents for a delivery. Then you better use table &lt;EM&gt;LIPS&lt;/EM&gt; delivery item. Source document, delivery, is in &lt;EM&gt;LIPS-VBELN&lt;/EM&gt; and the preceding document, like sales order, is in &lt;EM&gt;LIPS-VGBEL&lt;/EM&gt;.&lt;/P&gt;&lt;P&gt;Same result can be applied by below code. However that could still result in multiple lines.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT&lt;BR /&gt;  vgbel&lt;BR /&gt;  vbeln&lt;BR /&gt;  matnr&lt;BR /&gt;  FROM lips&lt;BR /&gt;  INTO TABLE it_vbfa&lt;BR /&gt;  WHERE vbeln = it_likp-vbeln.&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 01 Mar 2023 05:10:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sql-select-issue-in-vbfa/m-p/12656565#M2015402</guid>
      <dc:creator>JackGraus</dc:creator>
      <dc:date>2023-03-01T05:10:05Z</dc:date>
    </item>
  </channel>
</rss>

