Quick Quide How To Retrieve SAP CRM Document Flow

SAP SD

Retrieve SAP CRM Document Flow: This post will go explain how to read SAP CRM Document flow for a SAP CRM transaction using ABAP code and functions modules.

Important Tables for SAP CRM Document Flow

Basically there are three tables to see the document flow.
The first one, which works at item level, is CRMD_BRELVONAI. Here you can enter with the item GUID extracted from CRMD_ORDERADM_I.
The second one is SRRELROLES. Here you enter at header level, extracted from CRMD_ORDERADM_H

The Role Types in this table are:

  • VORGAENGER – for Preceding document
  • NACHFOLGER – for the follow-up Document
  • IOBJ – Object changed by Bdoc
  • OOBJ – Object stored in Bdoc

The third one is called CRMD_BRELVONAE and basically stores additional attributes of header document.
The main fields to consider are:

  • OBJGUID_A_SEL?: this field gives the guid of transaction.
  • OBJGUID_B_SEL?: this field will give you the guid of follow up document up to Role Type
  • ROLETYPE_A: give the role type between the two SAP CRM documents

Function Module to read the document Flow in SAP CRM

If you want to follow the previous methods to play with Guid in SAP CRM Tables, good luck.
A better performant way is the call the function module CRM_DOC_FLOW_READ_DB in SE37
Here the signature of the CRM_DOC_FLOW_READ_DB :

*"----------------------------------------------------------------------
*"*"Local?Interface:
*"??IMPORTING
*"?????REFERENCE(IV_HEADER_GUID)?TYPE??CRMT_OBJECT_GUID
*"??EXPORTING
*"?????REFERENCE(ET_DOC_LINKS)?TYPE??CRMT_DOC_FLOW_DB_WRKT
*"?????REFERENCE(ET_DOC_FLOW_PLNK_ATTR)?TYPE
*"????????CRMT_DOC_FLOW_PLNK_WRK_DBT
*"?????REFERENCE(ET_DOC_FLOW_PNT_ATTR)?TYPE??CRMT_DOC_FLOW_PNT_WRK_DBT
*"?????REFERENCE(ET_DOC_FLOW_IPLK_ATTR)?TYPE
*"????????CRMT_DOC_FLOW_IPLK_WRK_DBT
*"??EXCEPTIONS
*"??????ERROR_OCCURRED
*"----------------------------------------------------------------------

In IV_HEADER_GUID, just put the Guid of the Order or Opportunity or any relavant SAP CRM Transaction you want to read the Doc flow for.

The Output Table ET_DOC_LINKS gives you the Full SAP CRM Doc flow of the input Operation a??????????? s following:

  • OBJKEY_A: the SAP CRM Guid of a document in the Doc flow
  • OBJTYPE_A: transaction category for preceding document
  • ROLETYPE_A :
    • VORGAENGER – Preceding document
    • NACHFOLGER – followup Document
    • IOBJ – Obj changed by Bdoc
    • OOBJ – Object stored in Bdoc

Credit go to How to read the document flow within SAP CRM