ABAP Trapdoors: Size Does Matter

This is a repost of an article originally posted to the SAP Community Network. There are various ways to handle XML data in ABAP, all of them more or less well-documented. If you need a downwards-compatible event-based parsing approach, for example, you might want to use the iXML library with its built-in SAX-style parser. (Note that iXML still constructs the entire document, so it’s more like a DOM parser with a SAX event output attached to it. If you’re looking for a strictly serial processing facility, check out the relatively new sXML library instead.) ...

August 20, 2015 · Volker Wegert

ABAP Trapdoors: CALL TRANSFORMATION id(ontwork)

This is a repost of an article originally posted to the SAP Community Network. I’ve been using asXML for some years now as a convenient way to serialize and deserialize arbitrary ABAP data structures. Some time ago, I learned about IF_SERIALIZABLE_OBJECT and its use to include class instances (aka objects) in an asXML representation as well. A few days ago, I decided to use this technique in a current development project. At the same time, I was trying to use CL_DEMO_OUTPUT_STREAM instead of classic lists as suggested by the online documentation, and since I was supposedly familiar with the basics of using transformations, I focused rather on the usage of this new output technology. I hacked together a small demo programm like this one: ...

June 5, 2015 · Volker Wegert

ABAP Trapdoors: R-F-Conversion on a STRING

This is a repost of an article originally posted to the SAP Community Network. A few weeks ago, I had to code some seemingly simple task: From a SAP Business Workflow running in system ABC, a sub-workflow with several steps had to be started in another system, or even a number of other systems. Since a BPM engine was not available, I decided to use simple RFC-enabled function modules to raise workflow events in the target system. The sub-workflows can then be started via simple object type linkage entries. While this approach works quite well for my simple scenario, I ran into an altogether unexpected issue that took me quite a while to figure out. ...

November 14, 2014 · Volker Wegert

ABAP Trapdoors: Death By STRING

This is a repost of an article originally posted to the SAP Community Network. As in the previous post, this one is a trapdoor to be avoided by framework and toolkit designers rather than their users. The datatype STRING is available in ABAP since 4.6A (how many of you remember working on that release, btw?), and many developers seem to think of Strings as the one and only way to transport text-like data around in an ABAP program. I can only speculate about the reasons – perhaps it’s because for most developers, ABAP isn’t the first programming language and in other languages, Strings are the common instrument to handle textual data. Some long-time ABAP developers might also have jumped on Strings because they are easier to use than the traditional C fields – you don’t have to think about the maximum length of the value any more. In many programs and frameworks, I’ve seen the following pattern: ...

November 21, 2011 · Volker Wegert

ABAP Trapdoors: Type Lock-In

This is a repost of an article originally posted to the SAP Community Network. In the past ABAP Trapdoor blogs, I’ve written about various problems that can occur when actually writing code in ABAP. Today’s issue is more about a structural or design problem. For this example, we’ll use the following class hierarchy: IMPORTING Imagine a method that takes an instance of CL_SUPER to perform an arbitrary operation: METHODS bar IMPORTING ir_object TYPE REF TO cl_super. ... DATA: lr_super TYPE REF TO cl_super, lr_sub1 TYPE REF TO cl_sub1, lr_sub2 TYPE REF TO cl_sub2. ... lr_foo->bar( lr_super ). lr_foo->bar( lr_sub1 ). lr_foo->bar( lr_sub2 ). This is pretty straightforward - when calling this method, we can either pass a variable of TYPE REF TO cl_super or any of the subclasses because every instance of CL_SUB1 “is-a” CL_SUPER. This also holds true for subclasses that the creator of the original classes does not know about - for instance, any customer implementations that extend the existing framework. ...

October 5, 2011 · Volker Wegert