Skip to Content
author's profile photo Former Member
Former Member

subsequent and precedent documents in VBFA

please explain what is this subsequent(VBELN) and precendent(VEBLV) documents in VBFA.

How they are related to each other.

I also didn't understand the following code related to VBFA:

LOOP AT it_so.

SELECT SINGLE name1 FROM kna1 INTO v_name

WHERE kunnr = it_so-kunnr.

SELECT SINGLE vbeln FROM vbfa INTO v_delnum

WHERE vbelv = it_so-vbeln

AND vbtyp_n = 'J'.

IF sy-subrc = 0.

SELECT SINGLE vbeln FROM vbfa INTO v_invnum

WHERE vbelv = v_delnum

AND vbtyp_n = 'M'.

ENDIF.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jan 29, 2008 at 05:33 PM

    VBFA is the table where the document flow is stored. This table is VERY usefull. Imagine that you have a Sales Order and you want to know which deliveries it's realted to. You go to VBFA with VBELV (Preceding document) = SALES ORDER and VBTYP_N (Type of subsecuent document) = 'J'. The result are the deliveries (VBELN) related to that sales document.

    Here is stored a lot of document relationships, not only the one I've mentioned, check field VBTYP_N for more detail. The use of this table is that if you need to go backwards in the document flow, you just check the content of the related document fields (LIPS-VGBEL in our example), but when going forewards, you would need to change the sales order to store the delivery number and furthermore, more than one delivery could be related to the sales order, hence the need of this table.

    Last but not least, remember that this table is for going FORWARDS in the document flow. Never us it to go backwards, because it has low performance (the table is not indexed in that way). You should check the reference fields as I said before.

    I hope I've been clear, <REMOVED BY MODERATOR>

    Edited by: Alvaro Tejada Galindo on Jan 29, 2008 2:08 PM

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      You can get the delivery if you do:

      SELECT vbeln FROM lips
       INTO lv_vbeln
       WHERE vgbel EQ vbap-vbeln
            AND vgpos EQ vbap-posnr.

      That works, but LIPS is not indexed by vgbel and vgpos (in fact it doesn't have any index at all) so the query will take ages.

      On the other hand, using VBFA as I said before, you may access the delivery in no time. SAP adds redundancy to increase performance. Try it yourself in the SE16 in a client with a lot of data in LIPS and you will understand better.

      Regards!

      Pablo

  • author's profile photo Former Member
    Former Member
    Posted on Jan 29, 2008 at 05:44 PM

    It's looking for deliveries (vbtyp_n = 'J') for the sales order.

    Rob

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.