<?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 how to get order type from reference  document in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-get-order-type-from-reference-document/m-p/2866331#M672337</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi ABAP Gurus,&lt;/P&gt;&lt;P&gt;  I am working on pricing routines for return orders.&lt;/P&gt;&lt;P&gt;  in this return order i am getting reference docuemnt number . &lt;/P&gt;&lt;P&gt;  now i need to find that this reference document is sales order or invoice .&lt;/P&gt;&lt;P&gt;  how can i find  this . &lt;/P&gt;&lt;P&gt;  i know i need to use VBFA table . but i am confused in precedding and subsequent document.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;please guide me how can i find this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thnaks,&lt;/P&gt;&lt;P&gt;Neo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 28 Sep 2007 13:37:13 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-09-28T13:37:13Z</dc:date>
    <item>
      <title>how to get order type from reference  document</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-get-order-type-from-reference-document/m-p/2866331#M672337</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi ABAP Gurus,&lt;/P&gt;&lt;P&gt;  I am working on pricing routines for return orders.&lt;/P&gt;&lt;P&gt;  in this return order i am getting reference docuemnt number . &lt;/P&gt;&lt;P&gt;  now i need to find that this reference document is sales order or invoice .&lt;/P&gt;&lt;P&gt;  how can i find  this . &lt;/P&gt;&lt;P&gt;  i know i need to use VBFA table . but i am confused in precedding and subsequent document.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;please guide me how can i find this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thnaks,&lt;/P&gt;&lt;P&gt;Neo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Sep 2007 13:37:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-get-order-type-from-reference-document/m-p/2866331#M672337</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-28T13:37:13Z</dc:date>
    </item>
    <item>
      <title>Re: how to get order type from reference  document</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-get-order-type-from-reference-document/m-p/2866332#M672338</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;In the routine write a single select to VBUK table&lt;/P&gt;&lt;P&gt;select single VBTYP from VBUK  into v_vbtyp where vbeln = ref doc no.&lt;/P&gt;&lt;P&gt;this will give the doc type&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Anji&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Sep 2007 13:54:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-get-order-type-from-reference-document/m-p/2866332#M672338</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-28T13:54:43Z</dc:date>
    </item>
    <item>
      <title>Re: how to get order type from reference  document</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-get-order-type-from-reference-document/m-p/2866333#M672339</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you have an example you should be able to work it out by looking at the values in SE16.  With the fields in the normal order the reference document item are the first two, the subsequent ones are the next two.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Howver VBFA isn't the correct solution here.  One, the order of fields given means it's optimised for tracking forward, not back. Second, if you haven't yet saved the new document it probably isn't updated yet.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Better to look for fields with names like VGBEL and VGPOS; if you find the document/item combination in VBRP it's an invoice, if you find it in VBAP it was an order.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Sep 2007 14:02:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-get-order-type-from-reference-document/m-p/2866333#M672339</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-28T14:02:38Z</dc:date>
    </item>
    <item>
      <title>Re: how to get order type from reference  document</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-get-order-type-from-reference-document/m-p/2866334#M672340</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you have an example you should be able to work it out by looking at the values in SE16.  With the fields in the normal order the reference document item are the first two, the subsequent ones are the next two.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Howver VBFA isn't the correct solution here.  One, the order of fields given means it's optimised for tracking forward, not back. Second, if you haven't yet saved the new document it probably isn't updated yet.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Better to look for fields with names like VGBEL and VGPOS in structures like XVBAP, VBAP or KOMP; if you can find the document/item combination in VBRP it's an invoice, if you find it in VBAP it was an order.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Sep 2007 14:07:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-get-order-type-from-reference-document/m-p/2866334#M672340</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-28T14:07:49Z</dc:date>
    </item>
    <item>
      <title>Re: how to get order type from reference  document</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-get-order-type-from-reference-document/m-p/2866335#M672341</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;VBAK-VGTYP will give you the document category and once you know which document category it is, you can go to either VBAK or VBRK with the number to get the document type (VBAK-AUART or VBRK-FKART).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Sep 2007 14:19:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-get-order-type-from-reference-document/m-p/2866335#M672341</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-28T14:19:58Z</dc:date>
    </item>
    <item>
      <title>Re: how to get order type from reference  document</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-get-order-type-from-reference-document/m-p/2866336#M672342</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;gt; I am working on pricing routines for return&lt;/P&gt;&lt;P&gt;&amp;gt;  orders.&lt;/P&gt;&lt;P&gt;&amp;gt; in this return order i am getting reference docuemnt&lt;/P&gt;&lt;P&gt;&amp;gt;  number . &lt;/P&gt;&lt;P&gt;&amp;gt; now i need to find that this reference document is&lt;/P&gt;&lt;P&gt;&amp;gt;  sales order or invoice .&lt;/P&gt;&lt;P&gt;&amp;gt;  how can i find  this . &lt;/P&gt;&lt;P&gt;&amp;gt; i know i need to use VBFA table . but i am confused&lt;/P&gt;&lt;P&gt;&amp;gt;  in precedding and subsequent document.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Since you mention the pricing routines, I guess you are working on a VOFM routine or a user exit. I think that Anji gave the best universal solution for finding the document type by using VBUK table. VBFA table should not be used for this purpose IMHO. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Additionally, inside the VOFM routine or a user exit you might be able to use VBPA or XVBPA/YVBPA table - the field VGTYP will contain the reference document category for each line. C = order, M = invoice, there are several orders, which you can see in SE11.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just FYI "preceding document" in VBFA is the document that was created first. For example, a sales order is a "preceding document" and the corresponding outbound delivery is a "subsequent document".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps and good luck!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Sep 2007 15:23:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-get-order-type-from-reference-document/m-p/2866336#M672342</guid>
      <dc:creator>Jelena_Perfiljeva</dc:creator>
      <dc:date>2007-09-28T15:23:31Z</dc:date>
    </item>
  </channel>
</rss>

