Cookbook SAP Recycling Administration - REA Datamodel Extensibility
Cookbook SAP Recycling Administration - REA Datamodel Extensibility
Cookbook SAP Recycling Administration - REA Datamodel Extensibility
extensibility
Applies to:
SAP Recycling Administration (SAP REA) on EhP6 or higher
Summary
This document explains how to extend the existing REA data model so that the extensions can be used in
dialogs, checks and the declaration system.
Author Bio
Dr. Bernd Roedel joined SAP SI in 2000. Later he moved to SAP AG and became a
Development Architect. His responsibilities include the technical governance of SAP
Recycling Administration. He has also worked on the SAP Enterprise Portal and in Java
and Objective C projects.
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BA - boc.sap.com | UAC - uac.sap.com
© 2012 SAP AG 1
Cookbook SAP REA Data Model extensibility
Table of Contents
Preliminary Remark ............................................................................................................................................ 3
Changes.............................................................................................................................................................. 3
Introduction to the REA master data model ........................................................................................................ 4
Extending the REA Data Model .......................................................................................................................... 6
Extension Points ............................................................................................................................................. 6
User Exits ........................................................................................................................................................ 8
REA Article Dialog Exit ................................................................................................................................................ 8
REA Article Consistency Check Exit ............................................................................................................................ 9
REA Billing Document Data Collector Exit ................................................................................................................... 9
Demo Scenario ................................................................................................................................................... 9
Business Case ................................................................................................................................................ 9
Defining an Data Model Extension to the Article Header.............................................................................. 10
New DDIC Data Element / Domain ............................................................................................................................ 10
New Append to Structure J_7L_ARTICLE_HEADER_APP ....................................................................................... 10
Implementing the Article Dialog User Exit..................................................................................................... 10
Design and Data Flow................................................................................................................................................ 10
Preparation ................................................................................................................................................................ 11
New Function Module Encapsulating the User Exit’s Subscreen ............................................................................... 11
New Class Implementing Interface J_7L_IART_DIALOG_EXIT ................................................................................ 12
Activating the Article Dialog User Exit ........................................................................................................... 13
Implementing the Consistency Check User Exit ........................................................................................... 14
New Function Module as copy of J_7LCHECK_ART_TEMPLATE ............................................................................ 14
Activating Consistency Check User Exit .................................................................................................................... 14
Implementing the Billing Document Data Collector User Exit ....................................................................... 15
New Function Module as copy of J_7L_VBRP_FILTER_EXIT .................................................................................. 15
Activating the Billing Document Data Collector User Exit ............................................................................. 16
Testing the Scenario ..................................................................................................................................... 17
Appendix ............................................................................................................ Error! Bookmark not defined.
Related Content ................................................................................................................................................ 18
Copyright........................................................................................................................................................... 19
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BA - boc.sap.com | UAC - uac.sap.com
© 2012 SAP AG 2
Cookbook SAP REA Data Model extensibility
Preliminary Remark
The following document is a cookbook for extending the REA data model in customer namespace. It
provides an overview on the “extension points” and explains in example how data model extension and REA
user exits help to enhance an REA instance according to individual customer requirements. This cookbook
does not explain in depth how to use the ABAP workbench or how to create DDIC structures.
Changes
This is the initial version.
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BA - boc.sap.com | UAC - uac.sap.com
© 2012 SAP AG 3
Cookbook SAP REA Data Model extensibility
Article
Component
Fraction
REA article and REA components refer to the material number in the ERP Material master (MARA-MATNR).
Hence REA article cannot exist without a corresponding MM entry. REA packaging components may exist
without a material master entry, if configured appropriately. In addition it also is possible that a REA article
and a REA component refer to the identical MM entry (Figure 2).
Article
Artikel
Access is
Read- only
Component
Material master
im
R/3
REA internal fractions are maintained in the REA customizing and assigned to one or many recycling partner
fractions (Figure 3). It is also possible to assign an internal fraction to a recycling partner fraction without
specifying a partner fraction. In this case there is no settlement with this particular recycling partner for that
internal fraction. This mechanism is called cancellation of partner fraction requirement. This fraction
assignment is out of scope for this document.
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BA - boc.sap.com | UAC - uac.sap.com
© 2012 SAP AG 4
Cookbook SAP REA Data Model extensibility
Internal fraction
Synthetic fibre
An internal fraction in REA is a packaging material that can be assigned 1 to n times to a REA packaging
with a defined weight / weight unit.
A REA component consists of one or many internal fractions and that can be settled with one or many
recycling partners. Both assignments are time dependent, so that several packaging versions with a non-
overlapping timeframes can be created. A REA component can be of type consumed packaging, which can
be directly identified in material movements by the declaration system, or of type sales packaging, which
can be assigned to one or many REA articles as a component.
A REA article represents finished product that must be reported to a recycling partner due to the legal
obligations of the REA user. In addition to the material number, a REA article is identified by the key values
company code, country and sales unit. REA components and recycling partners are assigned to REA articles
in a time dependent manner. A REA article is directly identified in billing documents and/or material
movements by the declaration system.
Figure 4 depicts the REA master data structuring. The REA article and the REA components are the two
main components that form the REA master data. In addition to the keys and relationships explained so far,
REA articles and REA components can hold various attribute values that are generally dependent on the
assigned recycling partner.
(n:m)
Cap
REA Component Bottle
(1-n)
REA Fraction
Aluminium Plastic Label Glass Label
REA components are maintained by the transactions J7L5/J7L6/J7L7. The tab fraction is used to maintain
the internal fraction assignment. The tab partner is used to maintain the recycling partner assignment. A
REA component can only be settled with partners that are assigned to the packaging in a particular
timeframe.
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BA - boc.sap.com | UAC - uac.sap.com
© 2012 SAP AG 5
Cookbook SAP REA Data Model extensibility
REA articles are maintained by transactions J7L1/J7L2/J7L3. The tab packaging is used to maintain the
REA component assignment. The tab partner is used to maintain the recycling partner assignment. A REA
article can only be settled with partners that are assigned to the article in a particular timeframe. In case
there are multiple recycling partners assigned in the same timeframe, license fee splitting rules enable the
user to split the license fee of the packaging between the assigned recycling partners dependent on the
business process.
REA articles can alternatively be maintained as reference articles by transaction J7L0. Reference articles
are settled exactly as their referenced article. Reference articles are not discussed in detail in this document.
Figure 5 summarizes the REA master data maintenance process.
Ar
Article
ticle
Ar
Article
ticle Ar
Article
ticle
Com p on en t
Com
Comppon
onen
entt Com p on en t
Fr act io n Fr act io n Fr act io n
Using extension point number 1 means extending REA article information on the article header
level. Using extension point number 8 means extending REA packaging information on the
level of the recycling partner assignment to packaging.
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BA - boc.sap.com | UAC - uac.sap.com
© 2012 SAP AG 6
Cookbook SAP REA Data Model extensibility
2. Rpartner
(n:m) 3. RPartner-Splitting
7. Packaging Cap
REA Packaging header Bottle
4. Packaging
8. RPartner 5. Packaging-Rpartner
6. BOM
(1-n)
9. Fraction
10. Fraction-RPartner
REA Fraction
Aluminium Plastic Label Glass Label
Figure 6: Extension Point in REA Master Data Model indicated by a Numbered and Colored Lollypop
Symbol
Table 1 links the extension points to the DDIC structures. Each structure has got a suffix to avoid naming
conflicts. Renaming can be used to address the structures’ content easily. The DDIC structures are the
technical representation of the anchor. For technical reasons they contain one field as placeholder. They can
be used to extend the REA data model to the desired level, by appending them with fields in customer
namespace.
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BA - boc.sap.com | UAC - uac.sap.com
© 2012 SAP AG 7
Cookbook SAP REA Data Model extensibility
In case I would like to use extension point 1 to extend the REA article information on the article
header level, I have to create an append to DDIC structure J_7L_ARTICLE_HEADER_APP.
When planning a data model extension the second challenge is to leverage the new information provided by
the extended data model in the business process. Therefore the next section will introduce various user exits
provided by REA.
User Exits
In general SAP note 891715 gives on overview on the user existing in REA. In our example we will focus on
the REA article dialog exit, on the exit of the article consistency check and on the exit of billing document
data collector in the declaration system.
This exit produces, when implemented, an additional tab in the REA article dialog (Figure 7). The user exit
can display its own content in a dynpro subscreen on this tab. Technically the user exit is defined by the
interface J_7L_IART_DIALOG_EXIT. This interface offers full read/write access to the master data of the
REA article by reference semantics. In addition the user exit interface may communicate with the REA article
dialog by several methods of the interface:
Method
IS_CONSISTENT Is called prior to saving the article. The method
may prevent the article from being saved by
signaling an inconsistent state.
IS_CHANGED Is called prior to leaving the article dialog. The
method may prevent the loss of data by
signaling that saving the article is required.
SAVE Is called when the article is saved and can be
used to persist data outside the REA database
tables.
REQUESTS_FOCUS Is called when the user changes tabs. The
method may used to direct the focus to the tab
implemented by the user exit.
Event
CONTENT_UPDATE Signals that the internal data is updated by the
user exit implementation and that the controls
showing packaging and partner assignments
need to be updated.
Table 2: Methods/Events of J_7L_IART_DIALOG_EXIT
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BA - boc.sap.com | UAC - uac.sap.com
© 2012 SAP AG 8
Cookbook SAP REA Data Model extensibility
Figure 7: REA Article Dialog with Implemented User Exit on Right Hand Side
Demo Scenario
Business Case
The demo scenario’s business case entails the idea to mark REA articles, whether they are relevant for
packaging only settlement, for packaging plus WEEE settlement or for packaging plus battery plus WEEE
settlement. In REA this is called the recycling system. Marking shall be executed on the article header level
(material number, company code, country, sales unit). The mark shall be used in the declaration system and
consistency check to ensure a high data quality plus a full compliance to the legal requirements. The
consistency check validates the mark with the material group in MM, because in our business case the
material group determines the recycling system. The declaration system filters out the item, in case the mark
does not match the recycling partner of the declaration. This improves performance and ensures we have
only article in the declaration’s log that match the recycling system of the declaration’s recycling partner.
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BA - boc.sap.com | UAC - uac.sap.com
© 2012 SAP AG 9
Cookbook SAP REA Data Model extensibility
Figure 8: Creating a New Domain Z_REA_SYSTEM_SELECTOR in DDIC with Type INT1 with fixed
Values (Packaging only is default)
It is useful to set the enhancement category of the append to cannot be enhanced to avoid
problems during activation.
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BA - boc.sap.com | UAC - uac.sap.com
© 2012 SAP AG 10
Cookbook SAP REA Data Model extensibility
Preparation
First we create a new structure in DDIC ZKM1 that encapsulates a reference to structure J_7LKM1.
Figure 11: Function Module serving as Interface to Function Group Global Variables
Function group <zmy_group> has got following variables defined in the TOP include:
DATA: g_km1 TYPE zkm1, "global reference to J_7LKM1
wa_km1 TYPE j_7lkm1, "local representation of J_7LKM1
g_modus TYPE c. " X=> change mode/space = display mode
Next we create dynpro 1000 in function group <zmy_group> containing the following flow logic :
PROCESS BEFORE OUTPUT.
MODULE init_1000.
*
PROCESS AFTER INPUT.
MODULE USER_COMMAND_1000.
The PBO ensures that the global data is passed to the local data and takes care of change/display mode.
Screen-group1 is used to identify input fields:
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BA - boc.sap.com | UAC - uac.sap.com
© 2012 SAP AG 11
Cookbook SAP REA Data Model extensibility
*&---------------------------------------------------------------------*
*& Module INIT_1000 OUTPUT
*&---------------------------------------------------------------------*
* Transfers global values to Dynpro
*----------------------------------------------------------------------*
MODULE init_1000 OUTPUT.
MOVE g_km1-km1->* TO wa_km1.
LOOP AT SCREEN.
IF screen-group1 = '001' AND g_modus = space.
screen-input = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDMODULE. " INIT_1000 OUTPUT
The PAI ensures that the local data is passed back to the global data.
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_1000 INPUT
*&---------------------------------------------------------------------*
* Transfers dynpro values to global values
*----------------------------------------------------------------------*
MODULE user_command_1000 INPUT.
MOVE-CORRESPONDING wa_km1 TO g_km1-km1->*.
ENDMODULE. " USER_COMMAND_1000 INPUT
The dynpro itself contains a text field and in input/output field defined as dropdown Listbox. Screen group
1 is set to 001. The dropdown listbox refers to the local variable WA_KM1-S_SELECTORHEA. (<variable> -
<componentname> <suffix>).
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BA - boc.sap.com | UAC - uac.sap.com
© 2012 SAP AG 12
Cookbook SAP REA Data Model extensibility
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BA - boc.sap.com | UAC - uac.sap.com
© 2012 SAP AG 13
Cookbook SAP REA Data Model extensibility
ENDFUNCTION.
The coding compares the entered recycling system in REA (field S_SELECTORHEA) to the material group
of the article. The comparison uses constants defined in the coding.
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BA - boc.sap.com | UAC - uac.sap.com
© 2012 SAP AG 14
Cookbook SAP REA Data Model extensibility
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BA - boc.sap.com | UAC - uac.sap.com
© 2012 SAP AG 15
Cookbook SAP REA Data Model extensibility
OR b~kz_weee = 'X'
OR b~kz_battery = 'X' ).
IF sy-subrc <> 0. "pack or WEEE or battery
CLEAR filter_ok.
ENDIF.
ENDCASE.
The coding reads the recycling system (field in extension point) and compares it to the recycling system of
the declaration’s recycling partner, which is derived from the FORMGROUP settings in REA customizing.
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BA - boc.sap.com | UAC - uac.sap.com
© 2012 SAP AG 16
Cookbook SAP REA Data Model extensibility
Figure 15 shows the consistency check for recycling partner DSD after activating the user exit for DSD. The
user exit message is displayed, in case the check fails.
If the declaration is started for billing documents, the user exit for the declaration is executed by the
declaration system. The billing document item rejection by the user exit is visible in the single log protocol
only, if the settings for protocol are set to log filter item (REA customizing general control define general
control or document type detail screen).
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BA - boc.sap.com | UAC - uac.sap.com
© 2012 SAP AG 17
Cookbook SAP REA Data Model extensibility
Related Content
[1] Cookbook_Rpartner
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BA - boc.sap.com | UAC - uac.sap.com
© 2012 SAP AG 18
Cookbook SAP REA Data Model extensibility
Copyright
© Copyright 2012 SAP AG. All rights reserved.
No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG.
The information contained herein may be changed without prior notice.
Some software products marketed by SAP AG and its distributors contain proprietary software components of other software vendors.
Microsoft, Windows, Excel, Outlook, and PowerPoint are registered trademarks of Microsoft Corporation.
IBM, DB2, DB2 Universal Database, System i, System i5, System p, System p5, System x, System z, System z10, System z9, z10, z9,
iSeries, pSeries, xSeries, zSeries, eServer, z/VM, z/OS, i5/OS, S/390, OS/390, OS/400, AS/400, S/390 Parallel Enterprise Server,
PowerVM, Power Architecture, POWER6+, POWER6, POWER5+, POWER5, POWER, OpenPower, PowerPC, BatchPipes,
BladeCenter, System Storage, GPFS, HACMP, RETAIN, DB2 Connect, RACF, Redbooks, OS/2, Parallel Sysplex, MVS/ESA, AIX,
Intelligent Miner, WebSphere, Netfinity, Tivoli and Informix are trademarks or registered trademarks of IBM Corporation.
Linux is the registered trademark of Linus Torvalds in the U.S. and other countries.
Adobe, the Adobe logo, Acrobat, PostScript, and Reader are either trademarks or registered trademarks of Adobe Systems
Incorporated in the United States and/or other countries.
Oracle is a registered trademark of Oracle Corporation.
UNIX, X/Open, OSF/1, and Motif are registered trademarks of the Open Group.
Citrix, ICA, Program Neighborhood, MetaFrame, WinFrame, VideoFrame, and MultiWin are trademarks or registered trademarks of
Citrix Systems, Inc.
HTML, XML, XHTML and W3C are trademarks or registered trademarks of W3C®, World Wide Web Consortium, Massachusetts
Institute of Technology.
Java is a registered trademark of Oracle Corporation.
JavaScript is a registered trademark of Oracle Corporation, used under license for technology invented and implemented by Netscape.
SAP, R/3, SAP NetWeaver, Duet, PartnerEdge, ByDesign, SAP Business ByDesign, and other SAP products and services mentioned
herein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and other countries.
Business Objects and the Business Objects logo, BusinessObjects, Crystal Reports, Crystal Decisions, Web Intelligence, Xcelsius, and
other Business Objects products and services mentioned herein as well as their respective logos are trademarks or registered
trademarks of Business Objects S.A. in the United States and in other countries. Business Objects is an SAP company.
All other product and service names mentioned are the trademarks of their respective companies. Data contained in this document
serves informational purposes only. National product specifications may vary.
These materials are subject to change without notice. These materials are provided by SAP AG and its affiliated companies ("SAP
Group") for informational purposes only, without representation or warranty of any kind, and SAP Group shall not be liable for errors or
omissions with respect to the materials. The only warranties for SAP Group products and services are those that are set forth in the
express warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting an
additional warranty.
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BA - boc.sap.com | UAC - uac.sap.com
© 2012 SAP AG 19