Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 
ShyamPindiproli
Active Participant

Memory consumption of ABAP programs even though a benchmark parameter to evaluate the performance and quality of the code, was never the prime object of interest during a code review activity. But over the period of time this same piece of code comes back as either a potential performance bottleneck to be resolved or a production issue or a memory overrun issue.

I came across a new an interesting improvement in the ABAP Language construct and it is quite intriguing to me. As a matter of fact, it takes only 30 lines of code to show its fascinating results. Let us take an hypothetical example of material master data wherein we select data from the table MARA.

Problem Statement:

Not all materials have an Old Material Number (BISMT) present. Typically during data migration / cutover activity new materials are created in SAP and also an old material number is also added to these. Over a period of time tens and thousands of new materials are created and these will not have the Old Material number information. And now if we have a select query and populate these in an internal table, large amount of memory is allocated just to maintain the initial values. As an ABAP developer, I never cared about this because never had any control on this memory allocation. If the internal table grows dramatically, so is the memory wastage. This is a linear growth of memory wastage and something had to be done.

This is exactly the point of concern and also the source of opportunity to conserve the program memory. And SAP has answered to this issue by the introduction of a new keyword “BOXED”.

Solution : This keyword has been kept really simple and developer friendly, you just need to add the keyword addition to the internal table definition.

TYPES:BEGIN OF address,

            ...

END OF address.

           Fig 1: Regular Internal Table Definition

TYPES:BEGIN OF address,

            ...

  alt_post_addr1   TYPE address BOXED,

  alt_post_addr2   TYPE REF TO  address, "alternative address

END OF address.

     Fig 2: Internal Table Definition with BOXED components

The actual code implementation and runtime analysis coming soon...

6 Comments