abap class upload-download utilities

Upload: brett-hall

Post on 13-Oct-2015

48 views

Category:

Documents


0 download

TRANSCRIPT

  • 5/22/2018 ABAP Class Upload-Download Utilities

    1/6

    SDN Contr ibut ion

    Utilities for downloading and uploading OO ABAPclasses in XML format

    Appl ies 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 usedfor 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 componentlibraries and proprietary applications. Since 1999 he has been working as an Workflow/ABAPconsultant and developer. Now he is a senior Workflow/ABAP consultant at Deloitte & Touch

    RCS working for various customers.

    2006 SAP AG 1

  • 5/22/2018 ABAP Class Upload-Download Utilities

    2/6

    Table of Contents

    Utilities to download and upload OO ABAP class in XML format.................................................... 1Why?................................................................................................................................................ 3Why XML? ....................................................................................................................................... 3Usage............................................................................................................................................... 3

    Download utility ............................................................................................................................ 3Selection screen parameters.................................................................................................... 3

    Upload utility................................................................................................................................. 4Versions supported.......................................................................................................................... 4Weaknesses .................................................................................................................................... 4Source Code.................................................................................................................................... 5Copyright.......................................................................................................................................... 6

    2006 SAP AG 2

  • 5/22/2018 ABAP Class Upload-Download Utilities

    3/6

    Why?

    If you are closely acquainted with ABAP Objects and more generally with OO technology and paradigm, thenit is likely that you have your own OO developments you want to reuse. Personally I have some. Theproblem is that for one reason or another not always you can use SAP transport system to port your classesfrom one system to another. There is a standard program RWBPRINT which can be used (with debuggingtricks) 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 functionalitywhich uses XML format. Also I was already familiar with CL_XML_DOCUMENT class which offers DOMmodel functionality for XML documents. And also I had an idea of utilizing XSLT transformation somehow tomake myself familiar with it (unfortunately, there were no need, as SAP function modules for reading andcreating ABAP classed have fully compatible parameters which can be converted from/to XML withoutspecial 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 bedownloaded. Can be selected viasearch help

    Show XML file in browser Flag If set, resulting file will bedisplayed in additional window,

    2006 SAP AG 3

  • 5/22/2018 ABAP Class Upload-Download Utilities

    4/6

    Parameter Type Notes

    else file open dialog will bedisplayed and file will bedownloaded to the workstation.

    Languages for class text pool Select option Restricts set of text pool

    languages to be downloadedwithin XML file. If not set then allavailable languages will bediwnloaded

    Upload utility

    Report YRS_CLASS_UPLOAD_XML has the only selection screen parameter XML file name which can beselected 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 beoverwritten

    Versions supported

    I tested both utilities (not thoroughly though) on 4.7 and ECC 6.0. As utilities employ OO class exceptionsthey cannot be used on 4.6c, though backport seems to be possible.

    Notes

    Both utilities extensively use CL_XML_DOCUMENT functionality and also someCL_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

  • 5/22/2018 ABAP Class Upload-Download Utilities

    5/6

    Source Code

    Object Type Notes

    Object 1 Report Source code of ReportYRS_CLASS_DOWNLOAD_XML

    Object 2 Report Source code of ReportYRS_CLASS_UPLOAD_XML

    Object 3 Include Include YRS_CLASS_XML_CONST containscommon constants declaration.

    2006 SAP AG 5

    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/business_packages/a1-8-4/abap-code-samples/ABAP%20Class%20Upload%20-%20Download%20Utilities%20Object%201.txthttps://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/business_packages/a1-8-4/abap-code-samples/ABAP%20Class%20Upload%20-%20Download%20Utilities%20Object%202.txthttps://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/business_packages/a1-8-4/abap-code-samples/ABAP%20Class%20Upload%20-%20Download%20Utilities%20Object%203.txthttps://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/business_packages/a1-8-4/abap-code-samples/ABAP%20Class%20Upload%20-%20Download%20Utilities%20Object%203.txthttps://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/business_packages/a1-8-4/abap-code-samples/ABAP%20Class%20Upload%20-%20Download%20Utilities%20Object%202.txthttps://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/business_packages/a1-8-4/abap-code-samples/ABAP%20Class%20Upload%20-%20Download%20Utilities%20Object%201.txt
  • 5/22/2018 ABAP Class Upload-Download Utilities

    6/6

    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 aretrademarks or registered trademarks of IBM Corporation.

    Adobe, the Adobe logo, Acrobat, PostScript, and Reader are either trademarks or registered trademarks of Adobe SystemsIncorporated 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 ofCitrix Systems, Inc.

    HTML, XML, XHTML and W3C are trademarks or registered trademarks of W3C, World Wide Web Consortium, MassachusettsInstitute of Technology.

    Java is a registered trademark of Sun Microsystems, Inc.

    JavaScript is a registered trademark of Sun Microsystems, Inc., used under license for technology invented and implemented byNetscape.

    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 theirrespective logos are trademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world. Allother product and service names mentioned are the trademarks of their respective companies. Data contained in this document servesinformational 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 oromissions with respect to the materials. The only warranties for SAP Group products and services are those that are set forth in theexpress warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting anadditional warranty.

    These materials are provided as is without a warranty of any kind, either express or implied, including but not limited to, the impliedwarranties 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 mayresult 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 thesematerials. SAP has no control over the information that you may access through the use of hot links contained in these materials anddoes 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 ofcertain coding. SAP does not warrant the correctness and completeness of the Code given herein, and SAP shall not be l iable for errorsor damages caused by the usage of the Code, except if such damages were caused by SAP intentionally or grossly negligent.

    2006 SAP AG 6