Skip to Content

I’m writing this post in order to help others who have difficulties finding the correct SD document flow by accessing directly to standard tables. SAP provides us with a function module called SD_DOCUMENT_FLOW_GET, it’s very easy to use and fast enough to look for all the documents in the flow. To give you an example I’ll use an Outbound delivery, but you can you any SD document such as Sales Orders, Invoices, etc:

1. Let’s go to transaction SE37 and in parameter IV_DOCNUM enter the Outbound delivery number:

/wp-content/uploads/2015/01/foto1_627526.png

2. We get the list of the SD document flow for the Outbound delivery, for our example there are seven documents:

/wp-content/uploads/2015/01/foto2_627537.png

3. Let’s open the table ET_DOCFLOW to see all documents:

/wp-content/uploads/2015/01/foto3_627550.png

4. The fields of these table are important:

DOCNUM: SD document number.

FOCUS:     Points the document from which the search began.

HLEVEL:    Hierarchy position on the document flow tree.

VBTYP_N: SD document category (type of document for DOCNUM field). In our example we have the following:

Category Description
C Order
J Delivery
R Goods movement
M Invoice
8 Shipment

You can check the complete list of categories by looking the VBTYP domain’s values in transaction SE11:

/wp-content/uploads/2015/01/foto4_627548.png

And that’s all we get the SD documents from the order up to the accounting document in FI. As an advice you should order the table by the fields ERDAT and ERZET in descending order to see the documents by the date they were created.

I hope this help you with your SD Abap developments.

To report this post you need to login first.

7 Comments

You must be Logged on to comment or reply to a post.

  1. Phoebe Hu

    Hi Jonathan,

    Thanks for your sharing.

    Checked this FM, basically it is a combination of table VBFA and VBUK as per my understanding.

    Speaking of this, do you notice that in this FM or table VBFA, the field WAERS is local currency, not document corrency?  I don’t know what’s the usage of local curreny here.

    (0) 
  2. Jonathan Christhian Mejia Anchante Post author

    Hi guys, thanks for your comments. It’s a good point Phoebe I didn’t notice that.


    I looked for the description of this WAERS field in the structure TDS_DOCFLOW and says ‘Statistics currency’. So, the currency that this RFC is returning must be the currency how you report your financials.

    (0) 
  3. Jelena Perfiljeva

    The blog is very nicely put together but this function seems rather self-explanatory and hardly deserving a designated blog (also Google ‘function module document flow site:sap.com’ finds over 17,000 hits). Also this FM is not released, so endorsing it’s use on SCN doesn’t seem like a great idea when there are other alternatives. What really worries me though is that the folks who “have difficulties” reading VBFA table (seriously?) or using VGBEL/VGPOS fields are going to put this FM in a LOOP and happily leave for another project.

    Again, it’s a good blog as such and I appreciate the effort that went into creating it, but wish it was  on a subject that was better aligned with best practices. Please don’t let this discourage you, I hope that you’ll continue sharing on different ABAP subjects.

    Thank you.

    (0) 
      1. Jelena Perfiljeva

        I don’t want to make any “blanket” endorsements. As I mentioned, this FM is not released. Of course, there are still cases when an unreleased FM is the only thing we have (other than writing our own code). In the scenarios where the business logic is complex it may be justified to use an FM even if it’s unreleased as there is not much choice.

        Document flow is simply not that kind of scenario. All the data is in VBFA table and it’s rather simple to read. Besides, this FM only works for a single document and in the reports this is almost never the case as you need to get the data for multiple documents.

        I guess in some kind of an interface where you only need data for one document it may seem simple to just call this FM. But SAP could change it at any time and then your interface might no longer work. It totally happened (not with this FM) in one of our systems. I had to remove the FM and replace it with custom code. After we spent hours trying to figure out what was wrong.

        (0) 

Leave a Reply