SCN Wiki upgrade to version 6.13 on Tuesday 19.11.2019 - beginning 07:30 am CET

During upgrade process new content will not be transported to new Wiki version

Registration

Dear SAP Community Member,
In order to fully benefit from what the SAP Community has to offer, please register at:
http://scn.sap.com
Thank you,
The SAP Community team.
Skip to end of metadata
Go to start of metadata

Link to Content's target Space:

http://wiki.sdn.sap.com/wiki/display/ABAP/SAPlink

Summary

This document provides technical details of SAPlink chain and rename enhancement. If you wish to add some functionality to this open source project, make sure you read this document first.

Author(s):  Marcin Pciak
Company:  NorthgateArinso
Created on:  11.05.2011
Author(s) Bio:  After I graduated IT in 2007, I started my first professional job at NorthgateArinso. Here I became a member of Nearshore team. My goals were to learn SAP and explore its technologies, with focus on HR ABAP development. We supported several countries for various customers which we outsource HR-PA and PY for. Together with my knowledge growth I started to actively contribute on SDN, especially in ABAP forums.

Concept

Each object after serialization to XML node contains several attributes. Each of these attributes can potentially point to another subobject definition. The point is to examine all these "suspicious" attributes and obtain object definition from them (name and type of object suffice).  If such object is not found in XML document it is added to it (via standard SAPlink method addObjectToNugget ). Such attribute and any reference in XML to this object is then buffered in case user wants to rename it later.

Example

  • if we run application w/o option Only customer objects selected for object ZSCARR TABL, we will get following structure 

 

  • in XML document table ZSCARR TABL contains reference (via attribute) to data element Z_CARR_ID DTEL

  • Z_CARR_ID DTEL contains reference to Z_CARR_ID DOMA and so on

  • if we now want to export and rename object Z_CARR_ID DTEL, we must remember to rename both ROLLNAME attribute in TABL and DTEL node (so its definition + all its references in other nodes). For this we need to remember which attributes whe should rename in which node for which object.
  • to make the above happen we have to tell the SAPlink which attributes it should examine for each object - these are buffered in attribute ATTRSTOSEARCHTAB of class ZSAPLINK to which every plugin should append its "suspicious" spots. This can be done using new method REGISTERFORCHAIN and should take place in plugin CONSTRUCTOR. Following entry must therefore be added (one for one spot in node).
    ZSAPLINK_TABLES constructor - registering one attribute ROLLNAME for DTEL object
    registerforchain( objecttype = 'DTEL' objectname = 'ROLLNAME' ).
    



Component type

Component name

Description

TYPES

T_ATTRTOSEARCH,
TT_ATTRSTOSEARCH,
T_OBJECTTABLE,
TT_OBJECTTABLE

required types, can be addressed externally

LOCAL TYPES

TYPE-POOLS icon

to define image for tree node for plugin

ATTRIBUTE

ME_REAL

to store actual reference of SAPlink object

ATTRIBUTE

PLUGINS

to buffer plugin list

ATTRIBUTE

ATTRSTOSEARCHTAB

to store attribute list which should be traversed during XML document analysis

METHOD

GETATTRSTOSEARCH

to be called by client application and return list of XML attributes to search through

METHOD

CHECKPLUGINEXISTS

to determine node icon for given object, should be redefined in plugin class if non default image to be set

METHOD

GETTREEIMAGE

to determine node icon for given object, can be redefined in plugin class

METHOD

REGISTERFORCHAIN

to be used to register new attribute to be searched and remembered for renaming in XML document



Component type

Component name

Description

METHOD

ADDOBJECTTONUGGET

now returns object of the plugin



Component type

Component name

Description

TEXT

ABANDON

text for exception when no object was added to XML document

TEXT

NO_NEW_OBJECT

text for exception when action of exporting object(s) abandoned by user



Component type

Component name

Description

METHOD

CONSTRUCTOR

each class that supports chain object extraction and rename facility must register all attributes in the constructor, more detials in below sections



Component type

Component name

Description

SELECTION SCREEN

-

now inlcudes options _Chain_ , _Rename_ , _Only customer objects_ when _Add object_ in _Nugget_ tab choosen

SCREEN

0200, 0201

two screen showing object's structure. Depenign on whether _Renaming option_ was choosen, appropriat one will be used

GUI status

-




Component type

Component name

Description

SUBROUTINE

PREPARE_TREE

creates ALV tree object and container

SUBROUTINE

INIT_TREE_STATE

initializes tree, like expanding and selecting nodes

SUBROUTINE

REGISTER_TREE_EVENTS

registers events ALV tree will respond too

SUBROUTINE

ADD_TREE_NODE

adds new node to tree

SUBROUTINE

SHOW_PROCESSING_STATUS

shows processing status on GUI process bar

MODULE

PAI_20X

PAI module shared for screens 0200, 0201

MODULE

PBO_20X

PBO module shared for screens 0200, 0201

METHOD

HANDLE_ITEM_DBL_CLK

handles ALV tree event ITEM_DOUBLE_CLICK

METHOD

HANDLE_CHECKBOX_CHANGE

handles AVL tree event CHECKBOX_CHANGE



Component type

Component name

Description

SUBROUTINE

ADDOBJECTTOXML

adds object's definition to XML (nugget)

SUBROUTINE

RENAMEATTRINXML

renames XML attributes based on stored attributes list

SUBROUTINE

REMOVEXMLNODES

removes renaming (unselected) attributes list from XML

SUBROUTINE

UPDATERENAMING

updates attributes list based on user input on screen


What's next?

If you feel that SAPlink chain and rename enhancement could work with some other SAPlink plugin, please follow these steps to support it.

  • In plugin class create public CONTRUCTOR method with the following signature
    constructor's signature
      methods CONSTRUCTOR
        importing
          NAME type STRING.
    

  • In its body call superclass contructor, then register ALL attributes which should be searched both for potential subdefinitions and which should be renamed during other object rename
    constructor
    METHOD constructor.
    * example for ZSAPLINK_TABLES constructor
    
      CALL METHOD super->constructor
        EXPORTING
          name = name.
    
      registerforchain( objecttype = 'DTEL' objectname = 'ROLLNAME' ).
      registerforchain( objecttype = 'DOMA' objectname = 'DOMNAME' ).
      registerforchain( objecttype = 'TABL' objectname = 'ENTITYTAB' ).
      registerforchain( objecttype = 'DOMA' objectname = 'DOMNAME3L' ).
      registerforchain( objecttype = 'SHLP' objectname = 'SHLPNAME' ).
      registerforchain( objecttype = 'INDX' objectname = 'DBINDEX' ).
      registerforchain( objecttype = 'TABL' objectname = 'SQLTAB' ).
    
    ENDMETHOD.

Notes

  • This enahcement was designed to work with DDIC objects, therefore core SAPlink application may not be appropriate to support other plugins subdefinitions.
  • For all currently supported plugins it is possible that I have missed some attributes which should be renamed together with object itself. If you notice any malfunction, please report it on project issue list.

Related Content

SAPlink chain and rename

SAPlink chain and rename user manual  

Useful Information

Developer manual for SAPlink chain and rename ehancement