<?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: Fetch Billing Doc. No. in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-billing-doc-no/m-p/3491195#M839554</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI Eswar&lt;/P&gt;&lt;P&gt;             How v get the VBRK-FKSTO status. coz V dont want to go VBRP as it taks long time. Plz help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;Khan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 27 Feb 2008 07:48:36 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-02-27T07:48:36Z</dc:date>
    <item>
      <title>Fetch Billing Doc. No.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-billing-doc-no/m-p/3491191#M839550</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI EXPERTS,&lt;/P&gt;&lt;P&gt;                   I need to fetch the &lt;STRONG&gt;Billing Doc No.&lt;/STRONG&gt; (VBRP-VBELN) on the base of &lt;STRONG&gt;Dilevery Doc. No.&lt;/STRONG&gt; ( MSEG-XBLNR). I am passing XBLNR into VGEBL of VBRP. But it takes lots of time coz its not a PK. Is there any alternative to this. &lt;/P&gt;&lt;P&gt;Urgent.&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;Khan....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Feb 2008 04:35:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-billing-doc-no/m-p/3491191#M839550</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-27T04:35:57Z</dc:date>
    </item>
    <item>
      <title>Re: Fetch Billing Doc. No.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-billing-doc-no/m-p/3491192#M839551</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Khan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Considering getting the relation from &lt;STRONG&gt;Sales Document Flow&lt;/STRONG&gt; (Table VBFA). Querying &lt;STRONG&gt;VBFA&lt;/STRONG&gt; is not recommended for performance reasons, however there are function modules which optimize the query to VBFA like &lt;STRONG&gt;READ_VBFA&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Feb 2008 05:43:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-billing-doc-no/m-p/3491192#M839551</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-27T05:43:27Z</dc:date>
    </item>
    <item>
      <title>Re: Fetch Billing Doc. No.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-billing-doc-no/m-p/3491193#M839552</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi Aditya,&lt;/P&gt;&lt;P&gt;              Ok if I use Read_VBFA FM. I only need to fetch VBELN from it while passing my XBLNR into VBELV. Hoz do I only fetch my desired field in below FM. My code shows Runtime error. Plz help&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'READ_VBFA'&lt;/P&gt;&lt;P&gt;  EXPORTING&lt;/P&gt;&lt;P&gt;    I_VBELV                  = VXBLNR&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   I_POSNV                  = &lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  I_VBTYP_V                =&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;   I_VBTYP_N                = 'M'&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  I_FKTYP                  =&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  I_BYPASSING_BUFFER       =&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  I_REFRESH_BUFFER         =&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  TABLES&lt;/P&gt;&lt;P&gt;    E_VBFA                   = &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;EXCEPTIONS&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  NO_RECORD_FOUND          = 1&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  OTHERS                   = 2&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;          .&lt;/P&gt;&lt;P&gt;IF SY-SUBRC &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;***********************************&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Khan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Feb 2008 05:55:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-billing-doc-no/m-p/3491193#M839552</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-27T05:55:03Z</dc:date>
    </item>
    <item>
      <title>Re: Fetch Billing Doc. No.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-billing-doc-no/m-p/3491194#M839553</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN __default_attr="blue" __jive_macro_name="color"&gt;&lt;SPAN __default_attr="sylfaen" __jive_macro_name="font"&gt;&lt;SPAN __default_attr="15" __jive_macro_name="size"&gt;
Hi,

You have to pass the item number as well for the FM to retreive the documents.

Should you not have the Item number, make a direct select. But this can correspond to multiple Invoice documents. Also you have to consider if the billing document is &lt;STRONG&gt;cancelled&lt;/STRONG&gt;. You can check the status of the cancellation with field &lt;STRONG&gt;VBRK-FKSTO&lt;/STRONG&gt;. &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN __default_attr="maroon" __jive_macro_name="color"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Feb 2008 07:28:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-billing-doc-no/m-p/3491194#M839553</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-27T07:28:56Z</dc:date>
    </item>
    <item>
      <title>Re: Fetch Billing Doc. No.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-billing-doc-no/m-p/3491195#M839554</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI Eswar&lt;/P&gt;&lt;P&gt;             How v get the VBRK-FKSTO status. coz V dont want to go VBRP as it taks long time. Plz help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;Khan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Feb 2008 07:48:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-billing-doc-no/m-p/3491195#M839554</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-27T07:48:36Z</dc:date>
    </item>
    <item>
      <title>Re: Fetch Billing Doc. No.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-billing-doc-no/m-p/3491196#M839555</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN __default_attr="blue" __jive_macro_name="color"&gt;&lt;SPAN __default_attr="sylfaen" __jive_macro_name="font"&gt;&lt;SPAN __default_attr="15" __jive_macro_name="size"&gt;
Check below example:
&lt;PRE&gt;&lt;CODE&gt;
PARAMETERS: p_vbelv TYPE vbeln_vl.

DATA: l_vbeln TYPE vbeln,
      l_fkdat TYPE fkdat.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
  EXPORTING
    input         = p_vbelv
 IMPORTING
   OUTPUT        = p_vbelv.

SELECT SINGLE a~vbeln b~fkdat INTO (l_vbeln, l_fkdat)
       FROM vbfa AS a
       INNER JOIN vbrk AS b
       ON a~vbeln = b~vbeln
       WHERE a~vbelv = p_vbelv 
       AND   a~vbtyp_n = 'M' " Billing 
       AND   a~vbtyp_v = 'J'   " Delivery 
       AND   b~fksto NE 'X'.   " Billing document not cancelled
IF sy-subrc EQ 0.
  WRITE:/ 'Billing Document:', l_vbeln,
        / 'Date:', l_fkdat.
ENDIF.
&lt;/CODE&gt;&lt;/PRE&gt;
Here parameter &lt;STRONG&gt;P_VBELV&lt;/STRONG&gt; is you delivery number. Execute above code in a temporary program to check the results and use it as per your requirement.
&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN __default_attr="maroon" __jive_macro_name="color"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Feb 2008 07:56:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-billing-doc-no/m-p/3491196#M839555</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-27T07:56:01Z</dc:date>
    </item>
    <item>
      <title>Re: Fetch Billing Doc. No.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-billing-doc-no/m-p/3491197#M839556</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN __default_attr="blue" __jive_macro_name="color"&gt;&lt;SPAN __default_attr="sylfaen" __jive_macro_name="font"&gt;&lt;SPAN __default_attr="15" __jive_macro_name="size"&gt;
Interesting....
&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN __default_attr="maroon" __jive_macro_name="color"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Feb 2008 08:04:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fetch-billing-doc-no/m-p/3491197#M839556</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-27T08:04:09Z</dc:date>
    </item>
  </channel>
</rss>

