How to read the document flow within SAP CRM: Example Use Case Suppose I have created a lead in the system. Next, in the sales process I might be creating a follow-up opportunity. As such I press the button “follow-up” where in the list of potential follow-up transaction types I choose ‘lean opportunity’. At this moment, in the assignment block this document flow is already visible. Author: Davy Pelssers – [email protected] www.dasap.be Pagina 1 To illustrate the relationship I have added some fields such as transaction ID, and relation type using the personalization option of that assignment block. We can see that the lead with ID 831 is a preceding document. Now, from that initial lead with ID 831; I will also create a follow-up appointment of type ‘Store visit’. So now I have created 3 documents in total: 1) The original lead with ID 831 (transaction type LEAD) 2) The follow-up opportunity with ID 1447 (transaction type ZOPL) 3) The follow-up store visit with ID 12217 (transaction type ZCPG) Author: Davy Pelssers – [email protected] www.dasap.be Pagina 2 If for some reason the opportunity is LOST ; this would mean the employee would set the status of the opportunity to LOST. Now suppose our business requirement would be the following: When the status is set to LOST, we want the system to automatically change the status of the LEAD to LOST. This means that the setting the status of the opportunity to LOST will be the trigger to not only save the opportunity itself, but also change the preceding document of type LEAD where the status should be automatically set to LOST. Somewhere in this logic it means that we’ll need to retrieve the preceding document of type LEAD to know which preceding document we’ll need to update. Relevant Tables 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. Author: Davy Pelssers – [email protected] www.dasap.be Pagina 3 The second one is SRRELROLES. Here you enter at header level, extracted from CRMD_ORDERADM_H. Role Types in this table: VORGAENGER - Preceding document NACHFOLGER - followup Document IOBJ - Obj changed by Bdoc OOBJ - Object stored in Bdoc The third one is called CRMD_BRELVONAE and basically stores additional attributes of header document. OBJGUID_A_SEL field you can give the guid of transaction. OBJGUID_B_SEL will give you the guid of follow up document Example: using table SRRELROLES to find back the previous document (lead) starting from the opportunity. We know that the opportunity is the Follow-up document, so Role Type NACHFOLGER. Step 1: Via table CRMD_ORDERADM_H we first lookup the GUID of the opportunity with ID 1447. GUID: E39EE280C481ABF1960400E081B02B67 Step 2: Now; in table SRRELROLES I enter this GUID as OBJKEY, and additionally set the ROLETYPE as NACHFOLGER. Author: Davy Pelssers – [email protected] www.dasap.be Pagina 4 RoleID found: uvxYn3tklV6M103WWR0hPm Step 3: Go to table CRMD_BINREL where you enter role GUID B and get the role GUID A. A is for preceding documents and B is for follow-up documents. Now we copy the value obtained in ROLE A uvxYn3tklF6M103WWR0hPm (which is the role guid of the preceding document). Step 4: Go back to table SRRELROLES and now enter the value obtained in step 3 in the field ROLEID. Author: Davy Pelssers – [email protected] www.dasap.be Pagina 5 This will show us the GUID of the preceding document which would be the Lead. OBJKEY obtained now is : E39EE1CE74E2D4F1960400E081B02B67 Step 5: enter the OBJKEY as GUID in table CRMD_ORDERADM_H and finally we will retrieve the Object ID (transaction number) of the preceding lead. Now – that’s a hell of a job to perform all these actions just to know the OBJECT ID (transaction number) of the preceding document. Therefore, your Abap consultant will probably need a better and more efficient way to obtain this information. That’ s where the next function module will come in handy. Author: Davy Pelssers – [email protected] www.dasap.be Pagina 6 Relevant Function Module to read the document Flow: CRM_DOC_FLOW_READ_DB When I test out this function module via transaction code SE37 I have following input parameters. Previously we already checked the GUID of the opportunity: GUID: E39EE280C481ABF1960400E081B02B67 Executing this will show me the following: Author: Davy Pelssers – [email protected] www.dasap.be Pagina 7 So what you should retrieve is the GUID of the preceding document , so - OBJKEY_A (guid of preceding document) - Based on conditions: OBJTYPE_A (BUS2000108) transaction category for leads ROLETYPE_A VORGAENGER as we are searching for the preceding document And using input the GUID of the preceding document. Author: Davy Pelssers – [email protected] www.dasap.be Pagina 8
© Copyright 2024 ExpyDoc