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:
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.