Skip to Content
Author's profile photo Jonathan Christhian Mejia Anchante

FM to get SD Document Flow

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:


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


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


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:


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.

Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Sridhar Vijjhalwar
      Sridhar Vijjhalwar

      Nice document Jonathan...



      Author's profile photo Former Member
      Former Member

      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.

      Author's profile photo Former Member
      Former Member

      You can also check table VBFA...

      Author's profile photo Jonathan Christhian Mejia Anchante
      Jonathan Christhian Mejia Anchante
      Blog 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.

      Author's profile photo Jelena Perfiljeva
      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' 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.

      Author's profile photo Bruno Esperança
      Bruno Esperança


      Would you endorse reading table VBFA directly over using function module SD_DOCUMENT_FLOW_GET?

      Author's profile photo Jelena Perfiljeva
      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.

      Author's profile photo Marius Greeff
      Marius Greeff

      This function module may be outdated.

      FICA documents are 12 Characters long. Even though this function module shows FICA documents, it cuts of the last two digits of the document number. FICA documents are not stored in table VBFA.

      Function module 'FKK_DETERMINE_FICA_DOCUMENT' can be used to get the VICA documents for the billing documents that is stored in table VBFA. There is better ways to get them. I used the FMOD to get the document status and a couple other fields that is not so easy to get.

      Author's profile photo Suwandi Cahyadi
      Suwandi Cahyadi

      But FM FKK_DETERMINE_FICA_DOCUMENT is not released for customer.