Académique Documents
Professionnel Documents
Culture Documents
Products
Products Industries
Industries Support
Support Training
Training Community
Community Developer
Developer Partner
Partner
About
About
Ask a Question Write a Blog Post Login
Tobias Trapp
more by this author
ABAP Development
abap | package | sapmentor
share
0 share tweet share
Follow
https://blogs.sap.com/2012/03/01/abap-package-concept-part-3-package-hierarchy-coupling-and-cohesion/ 1/18
10/3/2018 ABAP Package Concept Part 3 Package Hierarchy, Coupling and Cohesion | SAP Blogs
In the first part of this weblog series I introduced the ABAP package concept
(ABAP Package Concept Part 1 – The Basics ) and package interfaces (ABAP
Package Concept Part 2 – Package Interfaces of Development Packages).
Now I introduce packages hierarchies and discuss how they can be used to
structure applications: what packages build an application and how to define
functional cohesion in an application. Please be aware that I describe package
concept in Releases 6.10 up to 7.02 and things will change slightly in 7.30 but
this is topic for another blog.
Hierarchies of Packages
Why are package hierarchies useful? When you have a look at legacy
development classes there was no concept of package hierarchies. As a
consequence there was no concept which set of development classes form an
application. Using package hierarchies you can make this explicit. Why is this
necessary?
I can give you lots of more examples but the consequence is clear: at a certain
time you will have to violate naming conventions. And even if you manage to
avoid violations there is the danger that those naming conventions will be
forgotten in the long run or they are getting too complex.
Let me summarize: With structure packages you can define the overall
structure of a huge development. Using them you can define dependencies to
structure packages from SAP standard. But you have to use this option
because those dependencies are only checked in a special package check
mode (called “R3ENTERPRISE”). There are also weaker package check
modes (“RESTRICTED”) that don’t require structure packages.
https://blogs.sap.com/2012/03/01/abap-package-concept-part-3-package-hierarchy-coupling-and-cohesion/ 3/18
10/3/2018 ABAP Package Concept Part 3 Package Hierarchy, Coupling and Cohesion | SAP Blogs
https://blogs.sap.com/2012/03/01/abap-package-concept-part-3-package-hierarchy-coupling-and-cohesion/ 4/18
10/3/2018 ABAP Package Concept Part 3 Package Hierarchy, Coupling and Cohesion | SAP Blogs
This has many advantages: there is an explicit main package for financial
toolset. Every contained package can propagate its interface to the main
package so you can reduce the number of use accesses at the side of the
client because interfaces are bundled:
Now I will discuss how to declare a use access for function modules in FIMA
package. Only if you want to express the dependencies between structure
packages (package check mode R3ENTERPRISE) you have to declare a use
access to the structure package at the top of the package hierarchy containing
the FIMA package which is structure package ABA. ABA exposes many
interfaces: a default interface, a virtual default interface and a filter interface:
In fact you have the choice: You can declare a use access to the default
interface or to the virtual default interface (and on the level of structure
package the access to the filter interface). A virtual default interface is a kind
of carte blanche that grants access to all elements but can be restricted to a
certain namespace using the filter interface.
https://blogs.sap.com/2012/03/01/abap-package-concept-part-3-package-hierarchy-coupling-and-cohesion/ 6/18
10/3/2018 ABAP Package Concept Part 3 Package Hierarchy, Coupling and Cohesion | SAP Blogs
the next installment of this series where I show how to perform package
checks.
There can be many different grouping criteria – let me first give some
examples for development objects:
Using package hierarchies you can group packages according special criteria
– let me mention a few:
https://blogs.sap.com/2012/03/01/abap-package-concept-part-3-package-hierarchy-coupling-and-cohesion/ 7/18
10/3/2018 ABAP Package Concept Part 3 Package Hierarchy, Coupling and Cohesion | SAP Blogs
A software architect has a clear vision of the application that has to be created
and knows about cohesion aspect within the application, he know interfaces to
SAP standard and to SAP applications that are extended. Let’s look at an
example in SAP Standard (a SOA tool called Error & Conflict Handler – ECH)
where in most cases the structure has been chosen with regards to functional
aspects like archiving:
https://blogs.sap.com/2012/03/01/abap-package-concept-part-3-package-hierarchy-coupling-and-cohesion/ 8/18
10/3/2018 ABAP Package Concept Part 3 Package Hierarchy, Coupling and Cohesion | SAP Blogs
I made the experience that many SAP customers don’t care about cohesion
and the reason is very simple: the package concept is new and many SAP
customers only know the concept of naming convention. As a consequence
they create packages like ZFI for FI development, ZCO for CO development
and so on. Software engineering finds the correct words for it: “coincidental
cohesion” which Wikipedia calls the worst cohesion type because it has the
semantics like: “develop here something with FI”. Of course this is the worst
thing you can do: Is the development an extension of an existing FI process or
a new process? Or is it used for migration? What about cross-cutting concerns
used both for FI and CO – is it automatically BC? Sometimes those design
criteria for packages are mixed with organizational aspects: FI guys develop in
ZFI and are responsible for that package – but what happens if Basis
developers develop parts of an FI process – is it part of package ZFI or ZBC?
What happens if the organizational structure changes?
The answer is simple: If the development consists only of one or two reports
resp. BAdIs, packages like ZFI and ZCO are useful. If the development gets
more and more complex then packages with coincidental cohesion which have
no clear focus tend to grow exuberantly. The consequence is that such
maintenance will be difficult and expensive.
Summary
In this blog I discussed how packages can be structured and nested
hierarchically. I explained how this affects to package checks: In a package
hierarchy you can control access to contained packages: the packages may
be coupled by using each other’s interfaces but not every interface has to be
propagated by the surrounding packages.
Use naming conventions but don’t try to use them for challenges the
package concept was made for.
Try to find a meaningful set of packages and think in terms of functional
cohesion.
Don’t try to use all features of the package concept – use the ones that
help you most.
Try to avoid complex package hierarchies. Have a look at recent
developments in SAP standard to get inspiration.
Alert Moderator
12 Comments
You must be Logged on to comment or reply to a post.
Peter Inotai
Hi Tobias,
https://blogs.sap.com/2012/03/01/abap-package-concept-part-3-package-hierarchy-coupling-and-cohesion/ 10/18
10/3/2018 ABAP Package Concept Part 3 Package Hierarchy, Coupling and Cohesion | SAP Blogs
>What about cross-cutting concerns used both for FI and CO – is it automatically BC?
Maybe for FI and CO you can still group them as some kind of mixed Accounting
package.
However when you mix different components like ERP and CRM you have to go to the
direction to component ABA. I have the impression more and more SAP standard
objects are moved here. I just recently discovered ABA_GEN and all the subpackages.
I wonder what will happen in customer systems, when package check won’t be optional
anymore. It will be an interesting story
Cheers,
Peter
Hi Peter,
in NW 7.30 you can still switch off package checks – in fact you have to
change a system parameter. In fact the docu is wrong and I gave this
feedback already to the docu writers – in some parts of SAP Help portal this
is very simple because of the feedback mechanism.
Cheers,
Tobias
https://blogs.sap.com/2012/03/01/abap-package-concept-part-3-package-hierarchy-coupling-and-cohesion/ 11/18
10/3/2018 ABAP Package Concept Part 3 Package Hierarchy, Coupling and Cohesion | SAP Blogs
Peter Inotai
Hi Tobias,
Cheers,
Peter
Paul Hardy
Greetings,
I was at your talk at the SAP inside track in the Netherlands and I found it fascinating. Until
such time as such a check does become compulsory you are going to have a hard time
getting this concept over to people, as you will get the good old “it works fine as it is”
argument. You need a big list of “this is what problem you are going to get eventually if you
do not do this correctly” type examples.
Also, can you really trust not only developers but SAP itself not to change the exposed
elements of the interface, or is it enforced somehow?
Cheersy Cheers
Paul
Hi Paul,
I think the SAP package SAI is a good example. SAP introduced it very early
and there have been many changes to it in 6.40, NW 7.0 SP 15, NW 7.01 and
so on. The reason was simple: SAP optimized the web service infrastructure
several times. Do you remember the transaktions WSCONFIG and WSADMIN
https://blogs.sap.com/2012/03/01/abap-package-concept-part-3-package-hierarchy-coupling-and-cohesion/ 12/18
10/3/2018 ABAP Package Concept Part 3 Package Hierarchy, Coupling and Cohesion | SAP Blogs
– now you use SOAMANAGER. But if you used only elements that are exposed
in packages interfaces everything was fine – although SAP changed even the
data model.
You are asking a good question: is it possible that SAP removes exposed
elements? Of course it is – but it is also so possible that SAP deletes some
data elements as it happened in CRM 7.0 upgrade. It is even worse: From a
legal point of view most function modules and classes are not supported by
SAP. But is it really a problem? From my experience ABAP developers can
develop stable software if they look at SAP Business Suite:
If a framework is used in SAP Business Suite quite often then
incompatible changes are not likely.
If development elements are exposed in package interface it is not that
likely that SAP will do incompatible changes. Within SAP package
checks are used, too.
Let me summarize: Of course incompatible changes are possible and I give you
examples: function module WS_UPLOAD is of no use in unicode systems.
There have been even incompatible changes to ABAP language for unicode
systems. If you want to minimize the risk of having trouble after a release
upgrade then think of both advices from above: use frameworks hat are heavily
used within SAP Business Suite and try to use only exposed elements.
Cheers,
Tobias
Former Member
and surely it is the best strategy to start development with a clear concept of packages
and package dependencies.
But for systems that have already been visited for a decade or so by many developers,
coming from various consulting teams, each of them making not more than bringing
precisely his particular task to work, usually leaves a chaos of Z packages and
dependencies. Nobody will pay the effort for cleaning this up.
For such a situation, I found a pragmatic approach for bundling development objects
together without caring too much about their package membership: the piece lists of
CTS (SE01).
It doesn’t save me the work of decoupling, but it defines a new way of grouping
development objects together, independent of the package hierarchy/ies. The piece list
https://blogs.sap.com/2012/03/01/abap-package-concept-part-3-package-hierarchy-coupling-and-cohesion/ 13/18
10/3/2018 ABAP Package Concept Part 3 Package Hierarchy, Coupling and Cohesion | SAP Blogs
is a development object itself which can be maintained, transported and extended, like
any other development object. On the other hand, it is a kind of “non-transportable
transport”, which can be copied into a “real” transport.
Regards,
Rüdiger
Hi Rüdiger,
I like your blog and you cover cool and interesting topics like programming
JavaScript in ABAP, DSLs and so on. Great work! I think many people
would love to see your blogs on SCN.
Please, can you explain the advantage working with a piece list? Another
approach would be to create a structure package with dependencies only to
ABA and BASIS. The package check in mode R3ENTERPRISE would
show you unwanted dependencies.
Cheers,
Tobias
Former Member
Hi Tobias,
https://blogs.sap.com/2012/03/01/abap-package-concept-part-3-package-hierarchy-coupling-and-cohesion/ 14/18
10/3/2018 ABAP Package Concept Part 3 Package Hierarchy, Coupling and Cohesion | SAP Blogs
You are surely right: In a fresh SAP system, I would model the
package dependencies from the beginning, as you outlined it
in this blog series. But this is not feasible in a system which is
already productive since 10 years, and dozens of consulting
teams contributed their stuff. From time to time, new SAP
systems with dedicated purposes are added to the system
landscape. We then use a piece list, which has only
dependencies to SAP_ABA and SAP_BASIS, to import some
of our core reusable software parts and tools into that system.
Regards,
Rüdiger
Paul Hardy
Hello, I have a question on this, which may well show my total alck of understanding of
the whole concept.
I copied an example class from the book “Design Patterns in Object Orientated ABAP”
into my PI system, as it was the only one on Netweaver 7.0 at the time.
https://blogs.sap.com/2012/03/01/abap-package-concept-part-3-package-hierarchy-coupling-and-cohesion/ 15/18
10/3/2018 ABAP Package Concept Part 3 Package Hierarchy, Coupling and Cohesion | SAP Blogs
A red light in the extended program check would prevent a transport out of the
development system in our head office SAP system.
Luckily I get pointed at an analysis tool which then throws up some more cryptic
messages.
I think I am being told to add some interfaces into the pacakge of the custom ABAP class
under analysis. Would that be correct?
Cheersy Cheers
Paul
P.S. I am at Heathrow waiting to fly to Australia at the moment but all flights are delayed
for an hour, to allow for the arrival of the Olympic Torch!
Rudy Clement
Hi Tobias,
Thanks a lot for sharing your knowledge with the community! I was also present at the
SAP Inside Track in Eindhoven last year were I saw your presentation. I found it very
interesting!
Me and my colleagues are currently trying to use the package concept within a new
project at our customer. We are on a NW 7.02 system. But there is one thing we don’t
understand. Some ‘common’ SAP objects are not exposed in any package interface. For
example, when using class CL_ABAP_TABLEDESCR, the package check will give
errors. There is no package interface that exposes this class while several other
CL_ABAB_*DESCR classes are exposed via _AKB_INITIAL.
Same problem for persistent classes: when using persistent classes, we want to catch
exceptions from package SOS_EXCEPTION like CX_OS_OBJECT_NOT_EXISTING.
But this package doesn’t have any package interface. The package check even gives an
error on the base agent class which is fully generated by SAP!
Do you have any explanation for this? Maybe (hopefully) we are just missing a part of
the theory and you can guide us in the right direction… Or did SAP simply forget to add
objects like these to package interfaces? If that’s the case, how should we handle this?
Kind regards,
https://blogs.sap.com/2012/03/01/abap-package-concept-part-3-package-hierarchy-coupling-and-cohesion/ 16/18
10/3/2018 ABAP Package Concept Part 3 Package Hierarchy, Coupling and Cohesion | SAP Blogs
Rudy Clement.
Hi Rudy,
I don’t have any Access to a 7.02 system. Moreover I don’t know the check
mode you are using(transparent table PAKPARAM). If you use mode
R3ENTERPRISE you package has to include _BASIS_VIRTUAL_DEFAULT
and the ABAP package must be contained in a structure package that
contains package Interfaces _BASIS_VIRTUAL_DEFAULT and
_BASIS_VIRTUAL_FILTER.
Best Regards,
Tobias
Joachim Rees
Hey, Tobias,
you link to the first 2 Parts in the start of your blog, very nice.
How about also linking to the next part (https://blogs.sap.com/2012/07/22/abap-package-
concept-part-4-how-to-perform-package-checks/) in the end?!
-> That would make it easiert for your readers to read on (or even know that there is
another part!)
best
Joachim
PS: I stumbled about this when trying to get up to date with ABAP Packages – would you
today (5 Years later, NW7.5 being around) still recommend you series as a good read?
Or have things change drastically since then?
https://blogs.sap.com/2012/03/01/abap-package-concept-part-3-package-hierarchy-coupling-and-cohesion/ 17/18
10/3/2018 ABAP Package Concept Part 3 Package Hierarchy, Coupling and Cohesion | SAP Blogs
Trademark Sitemap
Newsletter
https://blogs.sap.com/2012/03/01/abap-package-concept-part-3-package-hierarchy-coupling-and-cohesion/ 18/18