SAP CRM – How to debug BOL objects

With SAP CRM and BOL (Business Object Layer) / GenIL (Generic Interaction Layer), SAP introduced an object-oriented modeling and programming framework. It takes some time to get used to this approach – and knowing OO techniques is most certainly very helpful there – but once you know how to work with BOL/GenIL some development tasks become very easy and straightforward.

With the GenIL BOL and – even more – with the GenIL model browser, SAP delivers tools to analyze and work with BOL objects without requiring custom development. Using these tools, you can browse your BOL model and determine the attributes and relations per object.

However, sometimes you do want to check you objects’ structure directly at run-time, thus in the ABAP debugger. This short post will show you, where to find the appropriate information using the data browser in the debugger. In detail, I will explain how to

  • Access the attributes of a BOL object
  • Find all related objects
  • Find all entities belonging to a BOL collection

 

To start browsing your BOL object, double-click on a BOL entity or collection. You will see something like this:

BOL entity

BOL entity

 

What you see here is the structure (classes, attributes) of a BOL entity of type BTAdminH. To navigate to the (plain) attributes, you must open (double-click) CONTAINER_PROXY -> DATA_REF, then doube-click the object type in the view below.

Data ref object type

Data ref object type

 

You will see your actually BOL type now (BTAdminH in our example) and be able to navigate one step down via ATTRIBUTE_REF.

BOL object

BOL object

 

Once again, you will have to double-click on the object type, then you will see the BOL attributes as you would for any other ABAP run-time or dictionary structure:

BOL attributes

BOL attributes

 

To find about the object related to the current BOL object, go back one step and click on the RELATIONS attribute.

Relations

Relations

 

Double-clicking this entry will display a table with all relations (relation types) as well as a list of related entries per type.

Related objects

Related objects

 

You can use the OBJECTS field to navigate to the related objects.

In most cases, you will start with a collection of BOL objects. Moving from a collection to the objects is possible via the ENTITY_LIST attribute. It is a table with all entities belonging to the current collection.

BOL collection

BOL collection

 

From there, you can use the navigational paths described above. Have fun exploring your BOL objects and collections using the ABAP debugger.

Dynamic Include Texts (IDs …) in SAP Smartforms

I have decided to open a new section in my blog: Time and again, I stumble over SAP related problems and issues that consume quiet a large amount of my (precious) time doing debugging and bug fixing. Sometimes the SCN is a helpful source of information, sometimes it is not. For the issues that I had to fix without finding helpful resources in SCN or on the internet in general, I have created the SAP category in my blog, where I will write short posts on the original problem and the solutions that I have discovered.

The problem that I spent half of my morning on, had to do with SAP Smartforms. It is – generally – possible to create a text object containing the contents of a standard text element. In its most simple form, the text element is given through a static tuple: text name, text object, text ID, and language.

Smartform Text Element Static

It is also possible, to determine the text name dynamically in ABAP coding, e. g. in the Initialization routine, and use a variable as element property. If you want to do this, you have to change the property to dynamic (see red box in the picture below) and put the variable name between &.

Smartform Text Element Dynamic

Now, if you have correctly defined and set your variable, it should work as expected. It should!

For me, it didn’t work. Instead the text name was always empty. After some debugging, I found that the value got lost during a move operation/routine that is executed before the form is really generated.

perform %move using %textkey-name ‘&GV_TEXTID&’.

Further research showed that this routine checks the dictionary object and the variable length. If the value used in the smart form coding is longer than the dictionary element type for the text name field, the value is – not truncated but – set to SPACE. Don’t ask me why the SAP developer chose to go that way; it was surely giving me some headaches 😦

Hence, the solution would be to use global variables that have exactly the same type and field length as the text element property you want to set dynamically!

How to exclude shared (notebook) notes in Evernote search

I am a big fan of Evernote; and I rely on it very heavily (makes me scared sometimes). Recently, I have started using shared notebooks. I share project-related notebooks with one of my colleagues; and he shares some of this notebooks (read + write) with me. These shared notebooks make Evernote a very nice collaboration tool.

However, shared (notebook) notes can mess up your own Evernote content sometimes: Searching for particular issues no longer return your own reminders and stuff only but also those of the people that share notebooks with you. This can be confusing. For example, I regularly search for to-do items (“todo:false”) using a saved search. All of a sudden, Evernote presents my to-do items + those of my colleague. This is obviously not what I want/need. Excluding the unwanted results, on the other hand, is not easy: Evernote does not allow to exclude notebooks from search results, i.e. using something like “-notebook:ABC” is not possible. You can exclude notes with certain tags (“-tag:ABC”), however, adding arbitrary tags to notes in a shared notebook (not owned by you) is not possible as well.

Here is the solution I went for (after a few experiments):

You may not be able to add your own tags to shared (notebook) notes. What you can do, is add/set the author of the notes. This can be done in the information view (Evernote Desktop as well as Evernote Web). So I simply set the notes’ author of the shared items to my colleague’s name. After that, I was able to exclude his notes from my search results using “-author:NAME”. This way I can use all my saved searches with only a little bit of modification.

Addendum: Unfortunately, it is not possible to select multiple notes and update the author for all. Hence, this solution is not suitable if you have to update many, many notes. There might be an easier solution for that. However, since I only had to change a few notes, I was fine with editing the author information per note.

Addendum II: Returning home to my iMac, I found that Evernote for Mac doesn’t seem to handle the author field well 😦 However, it seems possible to use the field “changed by”.