<?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 Invoice number without a FI document will be empty. in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/invoice-number-without-a-fi-document-will-be-empty/m-p/12528487#M2005239</link>
    <description>&lt;P&gt;Hello everyone,&lt;/P&gt;
  &lt;P&gt;I am trying to fix a certain already developed function with the goal that the SD Invoice with amount 0 EUR should not be transmitted to FI. As I understood, the below code is used to select the data from FI and SD:&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;PRE&gt;&lt;CODE&gt;* select order-related invoices
    SELECT * FROM vbfa AS v INTO TABLE gt_vbfa_inv
      FOR ALL ENTRIES IN gt_vbak
      WHERE vbelv = gt_vbak-vbeln
        AND vbtyp_n IN ('M', 'O', 'P', '5', '6')
        AND stufe = '00'
        AND NOT EXISTS ( SELECT * FROM vbfa
                           WHERE vbelv = v~vbeln
                             AND posnv = v~posnn
                             AND vbtyp_n IN ('N', 'S')
                             AND stufe = '00' ) .
    IF sy-subrc = 0.
* select invoice head status
      SELECT DISTINCT * FROM vbuk APPENDING TABLE gt_vbuk_inv
        FOR ALL ENTRIES IN gt_vbfa_inv
        WHERE vbeln = gt_vbfa_inv-vbeln.                  "#EC CI_SUBRC
    ENDIF.

    SORT gt_vbuk_inv BY vbeln.
    DELETE ADJACENT DUPLICATES FROM gt_vbuk_inv COMPARING vbeln.

    IF me-&amp;gt;gv_items = abap_true AND gt_vbuk_inv IS NOT INITIAL.
      SELECT * FROM vbrp INTO TABLE gt_vbrp
        FOR ALL ENTRIES IN gt_vbuk_inv
        WHERE vbeln = gt_vbuk_inv-vbeln.                  "#EC CI_SUBRC
    ENDIF.
&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;CODE&gt;&lt;BR /&gt;&lt;/CODE&gt;As far as I can understand from the above written code, is that the table 
  &lt;STRONG&gt;VBFA&lt;/STRONG&gt; is used to get the data for FI, while the table 
  &lt;STRONG&gt;VBRP&lt;/STRONG&gt; is used to get the data for SD. What I want to achieve is that when the invoice number does not have a FI document, then the invoice number will be empty.
  &lt;BR /&gt;
  &lt;P&gt;If the tables &lt;STRONG&gt;BKPF&lt;/STRONG&gt;(for the FI) and &lt;STRONG&gt;VBRK&lt;/STRONG&gt;(for the SD) would be used, then I could have tried the relation:&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;PRE&gt;&lt;CODE&gt;vbrk-xblnr=bkpf-xblnr.&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;However, those tables are not used in the function. May I please ask you, how can I fix the code so that when the invoice number does not have a FI document, thus the invoices with a value of 0 EUR will not generate an FI document, then the invoice number will be empty.&lt;/P&gt;
  &lt;P&gt;Thank you all in advance!&lt;/P&gt;</description>
    <pubDate>Wed, 10 Nov 2021 10:33:26 GMT</pubDate>
    <dc:creator>Raxph</dc:creator>
    <dc:date>2021-11-10T10:33:26Z</dc:date>
    <item>
      <title>Invoice number without a FI document will be empty.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/invoice-number-without-a-fi-document-will-be-empty/m-p/12528487#M2005239</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;
  &lt;P&gt;I am trying to fix a certain already developed function with the goal that the SD Invoice with amount 0 EUR should not be transmitted to FI. As I understood, the below code is used to select the data from FI and SD:&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;PRE&gt;&lt;CODE&gt;* select order-related invoices
    SELECT * FROM vbfa AS v INTO TABLE gt_vbfa_inv
      FOR ALL ENTRIES IN gt_vbak
      WHERE vbelv = gt_vbak-vbeln
        AND vbtyp_n IN ('M', 'O', 'P', '5', '6')
        AND stufe = '00'
        AND NOT EXISTS ( SELECT * FROM vbfa
                           WHERE vbelv = v~vbeln
                             AND posnv = v~posnn
                             AND vbtyp_n IN ('N', 'S')
                             AND stufe = '00' ) .
    IF sy-subrc = 0.
* select invoice head status
      SELECT DISTINCT * FROM vbuk APPENDING TABLE gt_vbuk_inv
        FOR ALL ENTRIES IN gt_vbfa_inv
        WHERE vbeln = gt_vbfa_inv-vbeln.                  "#EC CI_SUBRC
    ENDIF.

    SORT gt_vbuk_inv BY vbeln.
    DELETE ADJACENT DUPLICATES FROM gt_vbuk_inv COMPARING vbeln.

    IF me-&amp;gt;gv_items = abap_true AND gt_vbuk_inv IS NOT INITIAL.
      SELECT * FROM vbrp INTO TABLE gt_vbrp
        FOR ALL ENTRIES IN gt_vbuk_inv
        WHERE vbeln = gt_vbuk_inv-vbeln.                  "#EC CI_SUBRC
    ENDIF.
&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;CODE&gt;&lt;BR /&gt;&lt;/CODE&gt;As far as I can understand from the above written code, is that the table 
  &lt;STRONG&gt;VBFA&lt;/STRONG&gt; is used to get the data for FI, while the table 
  &lt;STRONG&gt;VBRP&lt;/STRONG&gt; is used to get the data for SD. What I want to achieve is that when the invoice number does not have a FI document, then the invoice number will be empty.
  &lt;BR /&gt;
  &lt;P&gt;If the tables &lt;STRONG&gt;BKPF&lt;/STRONG&gt;(for the FI) and &lt;STRONG&gt;VBRK&lt;/STRONG&gt;(for the SD) would be used, then I could have tried the relation:&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;PRE&gt;&lt;CODE&gt;vbrk-xblnr=bkpf-xblnr.&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;However, those tables are not used in the function. May I please ask you, how can I fix the code so that when the invoice number does not have a FI document, thus the invoices with a value of 0 EUR will not generate an FI document, then the invoice number will be empty.&lt;/P&gt;
  &lt;P&gt;Thank you all in advance!&lt;/P&gt;</description>
      <pubDate>Wed, 10 Nov 2021 10:33:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/invoice-number-without-a-fi-document-will-be-empty/m-p/12528487#M2005239</guid>
      <dc:creator>Raxph</dc:creator>
      <dc:date>2021-11-10T10:33:26Z</dc:date>
    </item>
  </channel>
</rss>

