How to add new row / element to context node collection in SAP CRM using ABAP
Sometimes performing even basics tasks in ABAP may confuse, especially if you are a newbie in ABAP. Today I’m going to show how to add new row (line, element) to context node collection in SAP CRM using ABAP. At the end of the post you can find the final code example, implementing the discussed task. Feel free to copy, paste and run this code snippet.
Theory. In order to add new element to context node you have to:
- Define a structure line of the context node element
- Create data reference, based on the structure line, defined at the previous step
- Define the new context node object that will contain the new values, we’re going to add to the context node
- Fill the new context node object with the new values
- Add new context node object, filled with the data to the context node
Practice. The final code:
As you can see, even such basic stuff in ABAP SAP CRM may contain some pitfalls.