ABAP Class Upload-Download Utilities

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

SDN Cont ri but i on

Utilities for downloading and uploading OO ABAP


classes in XML format

Applies to:
SAP WebAS 6.20 and above.
Summary
This article will present two utility reports for downloading and uploading OO ABAP class. They can be used
for transporting classes from system to system and also they demonstrate CL_XML_DOCUMENT usage,
SEOK package functions usage, etc.
Author(s): Sergey Korolev
Company: Deloitte & Touche
Created on: 2 August 2006
Author Bio
In his pre-SAP era Sergey Korolev was a loyal Delphi programmer, developing component
libraries and proprietary applications. Since 1999 he has been working as an Workflow/ABAP
consultant and developer. Now he is a senior Workflow/ABAP consultant at Deloitte & Touch
RCS working for various customers.


2006 SAP AG 1

Table of Contents
Utilities to download and upload OO ABAP class in XML format.................................................... 1
Why?................................................................................................................................................ 3
Why XML? ....................................................................................................................................... 3
Usage............................................................................................................................................... 3
Download utility............................................................................................................................ 3
Selection screen parameters.................................................................................................... 3
Upload utility................................................................................................................................. 4
Versions supported.......................................................................................................................... 4
Weaknesses .................................................................................................................................... 4
Source Code.................................................................................................................................... 5
Copyright.......................................................................................................................................... 6


2006 SAP AG 2


Why?
If you are closely acquainted with ABAP Objects and more generally with OO technology and paradigm, then
it is likely that you have your own OO developments you want to reuse. Personally I have some. The
problem is that for one reason or another not always you can use SAP transport system to port your classes
from one system to another. There is a standard program RWBPRINT which can be used (with debugging
tricks) to download ABAP class data, but frankly it is not quite convenient, its strength is that it can be used
as a usage template of some function modules for accessing ABAP class data.
Why XML?
When thinking of file format I had remembered that SAP SmartForms has upload/download functionality
which uses XML format. Also I was already familiar with CL_XML_DOCUMENT class which offers DOM
model functionality for XML documents. And also I had an idea of utilizing XSLT transformation somehow to
make myself familiar with it (unfortunately, there were no need, as SAP function modules for reading and
creating ABAP classed have fully compatible parameters which can be converted from/to XML without
special transformations).
And yes, everybody uses XML nowadays.
Usage
Download utility
Program YRS_CLASS_DOWNLOAD_XML has quite simple selection screen (see below).

Selection screen parameters
Parameter Type Notes
Class name Parameter ABAP class name to be
downloaded. Can be selected via
search help
Show XML file in browser Flag If set, resulting file will be
displayed in additional window,

2006 SAP AG 3

Parameter Type Notes
else file open dialog will be
displayed and file will be
downloaded to the workstation.
Languages for class text pool Select option Restricts set of text pool
languages to be downloaded
within XML file. If not set then all
available languages will be
diwnloaded
Upload utility
Report YRS_CLASS_UPLOAD_XML has the only selection screen parameter XML file name which can be
selected via File Open Dialog invoked by pressing F4 button.

After parsing XML file the utility checks class existence and if successful asks if existing class have to be
overwritten
Versions supported
I tested both utilities (not thoroughly though) on 4.7 and ECC 6.0. As utilities employ OO class exceptions
they cannot be used on 4.6c, though backport seems to be possible.
Notes
Both utilities extensively use CL_XML_DOCUMENT functionality and also some
CL_GUI_FRONTEND_SERVICES class (open and save file dialogs). Also all class data manipulations are
done with function modules from SEOK package (ABAP Objects Class Builder Services).
Weaknesses
Only classes can be uploaded or downloaded (not interfaces or exceptions)
Documentation is not downloaded
Descriptions of class elements downloaded in logon language only

2006 SAP AG 4

Source Code
Object Type Notes
Object 1 Report Source code of Report
YRS_CLASS_DOWNLOAD_XML
Object 2 Report Source code of Report
YRS_CLASS_UPLOAD_XML
Object 3 Include Include YRS_CLASS_XML_CONST contains
common constants declaration.

2006 SAP AG 5

Copyright
Copyright 2006 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, Outlook, and PowerPoint are registered trademarks of Microsoft Corporation.
IBM, DB2, DB2 Universal Database, OS/2, Parallel Sysplex, MVS/ESA, AIX, S/390, AS/400, OS/390, OS/400, iSeries, pSeries, xSeries,
zSeries, z/OS, AFP, Intelligent Miner, WebSphere, Netfinity, Tivoli, Informix, i5/OS, POWER, POWER5, OpenPower and PowerPC are
trademarks or registered trademarks of IBM Corporation.
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.
J ava is a registered trademark of Sun Microsystems, Inc.
J avaScript is a registered trademark of Sun Microsystems, Inc., used under license for technology invented and implemented by
Netscape.
MaxDB is a trademark of MySQL AB, Sweden.
SAP, R/3, mySAP, mySAP.com, xApps, xApp, SAP NetWeaver, 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 in several other countries all over the world. 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.
These materials are provided as is without a warranty of any kind, either express or implied, including but not limited to, the implied
warranties of merchantability, fitness for a particular purpose, or non-infringement.
SAP shall not be liable for damages of any kind including without limitation direct, special, indirect, or consequential damages that may
result from the use of these materials.
SAP does not warrant the accuracy or completeness of the information, text, graphics, links or other items contained within these
materials. SAP has no control over the information that you may access through the use of hot links contained in these materials and
does not endorse your use of third party web pages nor provide any warranty whatsoever relating to third party web pages.
Any software coding and/or code lines/strings (Code) included in this documentation are only examples and are not intended to be
used in a productive system environment. The Code is only intended better explain and visualize the syntax and phrasing rules of
certain coding. SAP does not warrant the correctness and completeness of the Code given herein, and SAP shall not be liable for errors
or damages caused by the usage of the Code, except if such damages were caused by SAP intentionally or grossly negligent.


2006 SAP AG 6

You might also like