Abap Coding Std

download Abap Coding Std

of 54

Transcript of Abap Coding Std

  • 8/11/2019 Abap Coding Std

    1/54

    2004 Hewlett-Packard Development Company, L.P.

    The information contained herein is subject to change without notice

    Coding Standards

    Speaker name : Anuradha GRao

    Title, HP : CodingStandards

    Date :

  • 8/11/2019 Abap Coding Std

    2/54

    9/15/2014 HP Confidential Coding Standards 2

    Introduction

    1. This document explains the standards of coding while handling differenttype of objects.

    2. This helps in understanding the standards of coding used in HP.

  • 8/11/2019 Abap Coding Std

    3/54

    9/15/2014 HP Confidential Coding Standards 3

    SAP ABAP Dictionary Naming Conventions Standard

  • 8/11/2019 Abap Coding Std

    4/54

    9/15/2014 HP Confidential Coding Standards 4

    Naming Conventions

    ABAP Dictionary naming conventions have been defined foreach of the following object types:

    TableStructureView

    Append StructureFieldData ElementDomainLock ObjectSearch Help

    Secondary IndexBAPI Fields

  • 8/11/2019 Abap Coding Std

    5/54

  • 8/11/2019 Abap Coding Std

    6/54

    9/15/2014 HP Confidential Coding Standards 6

    Database Table

    Format:

    ZyxnZ = Fixed text for custom object designation

    y = Site code

    x = Alpha characters based on the standard abbreviations of the key fieldsn = Optional numeric counter if necessary to make the object name unique

    Examples:

    Z1DFCHRFMD Default Characteristics Per Reference Model

    ZGBLDCNORN Billing Document Number Ranges

  • 8/11/2019 Abap Coding Std

    7/549/15/2014 HP Confidential Coding Standards 7

    Structure

    Format:

    ZyS_xnZ = Fixed text for custom object designation

    y = Site code

    S_ = Fixed text for structure designationx = Alphanumeric characters referring to the primary table name on whichthe structure is based. If it is based on multiple tables or not based on atable, then provide the abbreviation of a meaningful name by using theStandard Abbreviation List.n = Optional numeric counter if necessary to make the object name unique

    Examples:

    ZGS_KNA1 for standard SAP table KNA1Z1S_BWRFMD BW Reference Models

  • 8/11/2019 Abap Coding Std

    8/549/15/2014 HP Confidential Coding Standards 8

    View

    A view is a virtual table that logically relates to one or more tables. Thatis, the data of a view is not actually physically stored, but derived fromone or more other tables. A view can be tailored to the needs of aspecific application, making it possible to directly access specific data.

    Format:

    ZyV_xnZ = Fixed text for custom object designation

    y = Site codeV_ =Fixed text for view designationx = Name of the view based on primary key of table

    n = Optional numeric counter if necessary to make the object name unique

    Examples:

    ZGV_KNA1 for standard SAP table KNA1ZGV_KNA101 for standard SAP table KNA1

  • 8/11/2019 Abap Coding Std

    9/549/15/2014 HP Confidential Coding Standards 9

    Append Structure

    An Append Structure is used to extend a standard SAP table with customfields. It is not a separate dictionary object like a Structure, but isdefined/maintained only through the table definition screen. The primaryadvantage of using an Append Structure is that it is protected from beingoverwritten when the system is upgraded. Therefore, after an upgrade the

    fields in an Append Structure are added to the new standard tables, therebymaintaining any custom extensions that may have been added to SAPstandard tables.

    Format:

    During the process of creating an Append Structure, the system proposes adefault name. The current standard is to accept the proposed name.

    Examples:

    ZAVBAK

  • 8/11/2019 Abap Coding Std

    10/549/15/2014 HP Confidential Coding Standards 10

    Field

    It is important to note that a field is not an object in the ABAP Dictionary.It has no associated description, but it provides the link between a table anda data element, which contains a description. The data element provides thelink to a domain, which contains the physical characteristics of the field.

    Format:ZZxZZ = Fixed text for custom object designationx = Alphanumeric Characters from data elementCustom Table Fieldx = Alphanumeric Characters from data element

    Examples:Table type Field name Data element DomainSAP ZZWERKS WERKS WERKSCustom WERKS WERKS WERKSSAP ZZDELFLAG ZZGDELFL ZZGFLA

    Custom DELFLAG ZZ1DELFL ZZ1FLAG

  • 8/11/2019 Abap Coding Std

    11/549/15/2014 HP Confidential Coding Standards 11

    Data Element

    A Data Element stores field descriptions. All fields assigned to a dataelement will have the same description. Data Elements also store the domainname which contain the physical characteristics of a fieldZZyx

    Format:

    ZZ = Fixed text for custom object designationy = Site codex = Alpha characters based on the standard abbreviations of the DataElement description

    Examples:

    ZZ7ORHDSTCD Order Hold Status CodeZZGATTGNO Asset Tag Number

  • 8/11/2019 Abap Coding Std

    12/549/15/2014 HP Confidential Coding Standards 12

    Data Element Supplement

    Data Element Supplements are used to create screen-specificdocumentation for a field. This documentation will be displayed when help isrequested for that screen-specific field

    Format:

    Data Element Supplement Names must be a number equal to 9000 orgreater.

    Example: N/A

  • 8/11/2019 Abap Coding Std

    13/549/15/2014 HP Confidential Coding Standards 13

    Domain

    A Domain stores physical characteristics of a field; i.e., Data Type, Length,and Range of Values, Validation Table are defined for a Domain.

    Format:

    ZZyxZZ = Fixed text for custom object designation

    y = Site codex = Alpha characters based on the standard abbreviations of the Domaindescription

    Examples:

    ZZ7ORHSTCD Order Hold Status CodeZZGAPOPCTY APO Procurement Type

  • 8/11/2019 Abap Coding Std

    14/549/15/2014 HP Confidential Coding Standards 14

    Lock Object

    Lock Objects prevent two or more users from simultaneously accessing thesame logical unit of data. Locks on the data are set or released by callingcertain function modules in an ABAP program. These functions areautomatically generated during the creation of the lock objects. Lock objectsmust be defined in the ABAP Dictionary.

    Format:

    ExtE = Fixed text for Lock Object designationx = Name of the custom table (including the Z and site code)t = Lock type

    E = Exclusive and CumulativeS = SharedX = Exclusive

    Examples:

    EZ3TSLSORDX for a lock object for the table Z3TSLSORD

  • 8/11/2019 Abap Coding Std

    15/549/15/2014 HP Confidential Coding Standards 15

    Search Help

    Help views are used to output additional information when the online helpsystem is called.

    Format:

    Zyx

    Z = Fixed text for custom object designationy = Site codex = Name of the standard object the Search Help is based on

    Format for Custom Tables / Objectsx

    x = Name of the custom object the Search Help is based on.

    Examples:

    ZGKNA1 for SAP standard table KNA1Z3TFGFCST for custom table Z3TFGFCST

  • 8/11/2019 Abap Coding Std

    16/549/15/2014 HP Confidential Coding Standards 16

    Secondary Index

    The function of an index is to speed up the retrieval of data from a table.An index is usually created on specific fields on the table based on theretrieval search criteria.

    Format:

    ZnZ = Custom Designationn = A Number from 1-9

    Examples:

    Z1Z2

  • 8/11/2019 Abap Coding Std

    17/549/15/2014 HP Confidential Coding Standards 17

    BAPI Fields

    BAPIs are interfaces for Business Objects. Together with the BusinessObjects, BAPIs define and document the interface standard at the businesslevel. BAPI fields are merely fields within a structure in the ABAPDictionary. A BAPI structure is used to pass data to and from a BAPIfunction module. Because the structure has visibility outside of SAP, itmakes sense to use meaningful descriptive names for the structure fields.

    Format:

    Program BAPIFELD, offered in SAP 4.6, generates English defaults forexternal BAPI structures. The recommended default values should be usedwhen creating BAPI related structures.

    Examples: N/A

  • 8/11/2019 Abap Coding Std

    18/549/15/2014 HP Confidential Coding Standards 18

    SAP ABAP Program Documentation Standard

  • 8/11/2019 Abap Coding Std

    19/549/15/2014 HP Confidential Coding Standards 19

    Source Code Documentation

    Source code documentation is intended to help the IT support anddevelopment teams understand the technical implementation of a program.At some point in time, someone else will more than likely need to understand

    your source code in order to modify its behavior. Source codedocumentation helps:

    Improve the readability of the programReduce the time required to understand the source codeDocument relevant thoughts, concerns, assumptions, and intentionsthat are not self evident

    The standardcomponents of this documentation are:

    A standardized comment block with a revision historyGeneral source code commentsGeneral FORM documentationSAP Exit documentation (Userexit / Function Exit)Programming conventions / guidelines

  • 8/11/2019 Abap Coding Std

    20/549/15/2014 HP Confidential Coding Standards 20

    Programming Conventions

    Readability of the source code can be improved dramatically by followingcertain standard programming conventions and style guidelines as follows:Type 1 (executable) programs should be arranged in the following generallyaccepted sequence:

    Report statement

    Table declarationsData declarationsData INCLUDESSelection screen definitionInitializationAt selection-screen

    Top-of-page, End-of-pageAt line-selection, At user-commandStart-of-selectionEnd-of-selectionFormsForm INCLUDES

  • 8/11/2019 Abap Coding Std

    21/549/15/2014 HP Confidential Coding Standards 21

    Copying Custom Program Standard

  • 8/11/2019 Abap Coding Std

    22/549/15/2014 HP Confidential Coding Standards 22

    Custom Program Cloning Procedures

    Cloning a program is never the preferred solution. Occasionally, we simply

    cannot change the original program to meet new requirements. But, the lastthing we want to do is clone a program that is a known performanceproblem. Before cloning any program, determine if the original has everbeen identified as a performance issue. If the program has been modifiedfor performance reasons, determine if the current program runsefficiently. Checking the current program's database utilization will

    confirm how well or poorly the clone will perform.

    Guidelines

    Here are some guidelines to follow: Modify the custom program if the modifications are simple, and

    apply globally or can be parameterized. Copy the program if significant functional changes are being

    implemented. Do not modify or copy the program if only a fraction of the

    functionality is needed. In this case, start from scratch andcreate a custom program that is performance efficient.

  • 8/11/2019 Abap Coding Std

    23/54

    9/15/2014 HP Confidential Coding Standards 23

    Security for Custom SAP Programs Standard

  • 8/11/2019 Abap Coding Std

    24/54

    9/15/2014 HP Confidential Coding Standards 24

    Early Planning For Security

    It is necessary to plan early for security and to incorporate securityneeds at the start of development work. The concepts of who the usersare, what data groups of users are allowed access (or not allowed access),and the field values that should be checked in the ABAPs must all beconsidered.

    As the business owner of the business process, they are responsible todefine this business groups and users.

  • 8/11/2019 Abap Coding Std

    25/54

    9/15/2014 HP Confidential Coding Standards 25

    Authorization Check Objects

    Custom development work should not reference any SAP deliveredauthorization objects. SAP Authorization objects are linked to SAPinterpretation of the business processes. Thus, using an SAP deliveredauthorization object may inadvertently result in allowing access when SAPchanges the interpretation of the object. In addition, custom programswhich use SAP delivered authorization objects may also be affected if theauthorization object is changed or deleted in future releases. However,there may be exceptions

  • 8/11/2019 Abap Coding Std

    26/54

    9/15/2014 HP Confidential Coding Standards 26

    Programming Authority-Checks

    All custom ABAP programs and reports must address the need for security.Some reports may not need to have an authority check if they do notdisplay sensitive data. Corporate guideline for Handling and Managing HPsInformation Assets, http://legal.hp.com/linkpub/chart.pdf, should befollowed. Document required special handling should have an authorizationcheck. This check allows Security Administration

    http://legal.hp.com/linkpub/chart.pdfhttp://legal.hp.com/linkpub/chart.pdf
  • 8/11/2019 Abap Coding Std

    27/54

    9/15/2014 HP Confidential Coding Standards 27

    Securing Transaction Codes

    Security authorization group includes t-code for all programs. T-code canbe a custom t-code or generated when program is added to the report tree.Therefore, all programs should be secured by t-code. This is the preferredway to protect custom report.

    When a user enters a transaction at the command line, a check is executed

    to test user access. This check object is usually one of the same objectsreferenced in the program. Whereas programming authority-checks allowsfor checks during run-time, securing access at the transaction code levelprevents a user from even starting the program. The user will not even beable to display the first screen.

    However, security access at this level does not check access if a CALLTRANSACTION in another program is done to this one.

  • 8/11/2019 Abap Coding Std

    28/54

    9/15/2014 HP Confidential Coding Standards 28

    Development Steps

    Identify the field and values that are to be checked in the ABAP program.

    Fields and values check are defined by the business processes as definedby business owner. Past practices of linking the program attributesauthorization group to user security is not used.Document the field and values required for this object to SecurityAdministration. Security Administration then creates the object with thefields defined by the developer and notifies the developer of the

    authorization object name. Security Administration will create a user totest the object with.

    Validate the authorization checks with the test user for that object. Thismust be a joint effort between Security Administration and thedeveloper. Different values in the authorization need to be checked in

    order to determine if all possible values are controlled by the program.Once the testing and the object is ready for implementation, it will betransport to production.Inform the appropriate application module team of the authorizationobjects so that it can be incorporated into programs and reports.

  • 8/11/2019 Abap Coding Std

    29/54

    9/15/2014 HP Confidential Coding Standards 29

    Custom Data Element Documentation

  • 8/11/2019 Abap Coding Std

    30/54

    9/15/2014 HP Confidential Coding Standards 30

    Process

    CMOD

    Goto

    Text Enhancements

    Data Elements

    New DE Cust. Docu.

    Customer Documentation Pop-Up screen appears. Enter the data elementname and press green check.

    Document Maintenance: Initial Screen. Hit the DISPLAY button (or

    CREATE if no documentation exists).

    If DISPLAY was pressed, hit the CHANGEDISPLAY button.Enter the following tags and text into new lines below any existingdocumentation text:

    U1 &data element name&ASU1 &USE&ASU1 &EXAMPLE&BL

  • 8/11/2019 Abap Coding Std

    31/54

    9/15/2014 HP Confidential Coding Standards 31

    Examples for data element ZP_STCLAS*

    U1 & ZP_STCLAS &AS Status ClassificationU1 &USE&AS Code indicating classification of the part by HP P into a groupAS according to the part's activity and acceptability.

    AS &EXAMPLE&BL 0 = (code no longer used; was 'Unclassified Part')BL 1 = First level choiceBL 2 = Second level choiceBL 3 = Third level choiceBL 4 = Not recommended for new designs

    BL 5 = All production usage discontinuedBL 6 = Void part numberBL # = Code not applicableBL ? = Not yet coded

  • 8/11/2019 Abap Coding Std

    32/54

    9/15/2014 HP Confidential Coding Standards 32

    SAP 4.6 Custom Development Class and ProgramObject Naming Standard

  • 8/11/2019 Abap Coding Std

    33/54

    9/15/2014 HP Confidential Coding Standards 33

    Development Classes

    Used to specify the transport layer for all included objectsUsed to secure development access via S_DEVELOP authorization objectUsed as nodes in the Application Hierarchy (transaction SE81)Used as an object listing mechanism in the ABAP WorkbenchCan easily transport all objects in a development class

  • 8/11/2019 Abap Coding Std

    34/54

    9/15/2014 HP Confidential Coding Standards 34

    Development Class Convention: ZYXWWWWWWWW_B

    Code Description Examples

    Z Fixed code for object ownership Z = Custom development

    Y Fixed code that defines the site code origin

    G = Global1 = EMEA3 = NA7 = AP

    X Fixed code that defines object type

    R = ReportE = EnhancementsC = ConversionsI = Interfaces

    M = Modifications(copies of SAP programs, orincludes inside SAP programs userexits,function exits, etc.)

    W

    Variable length application component from the SAPdelivered application component hierarchy or reasonableequivalent.

    The application component is usually 4-8 characters. The

    first two characters typically identify the base levelapplication (FI, SD, MM). Additional levels are usually 2 or3 characters each. The complete code usually consists of2-3 component levels.

    FIAA = Asset AccountingFIAROI = Accounts Receivable\Open ItemsFIARDU = Accounts Receivable\DunningFIARCR = Accounts Receivable\CorrespondenceSDCM = Credit ManagementSDEDI = IDoc interfaces for EDISDSLSSO = Sales\Sales Orders

    SDPR = Pricing and ConditionsLOLIS = Logistics Information SystemLOMM = Material MasterLOPDM = Product Data ManagementMMPURPO = Purchasing\Purchase OrdersLESHP = Shipping

    _BOptional underscore and short description / acronym. Usedfor identifying partner systems, or significant blocks ofdevelopment created for specific business solutions.

    HERT, BACKPLANE, PIT, SMART_ATP

  • 8/11/2019 Abap Coding Std

    35/54

    9/15/2014 HP Confidential Coding Standards 35

    Example Development Classes

    Category Development Class Description

    ReportsZGRFIAROIZ1RSDPR

    Global A/R ageing reportsEMEA SD pricing reports

    Interfaces Z3ILESHP_HEARTZGISDPR_CPL NA shipping interfaces for HEARTGlobal pricing interfaces for CPL

    ConversionsZGCSDSLSSOZ7CFIAPOI

    Global Sales order conversionsAP FI A/P conversions

    EnhancementsZGESDOCZ1ESDPRZ3EFIARDU

    Global Sales enhancements for output determinationEMEA Sales enhancements for pricingNA Finance enhancements for A/R dunning

  • 8/11/2019 Abap Coding Std

    36/54

    9/15/2014 HP Confidential Coding Standards 36

    Object Type Convention Explanation Examples

    Executableprograms(Non-IM3development)

    dad = Developmentclassa = Description

    Z3RSDPR_OPENITEMSZGRFIAR_OVER90DAYSZ3ILESHP_HEART_DELIVERIESCurrent & Future

    Executableprogram includes

    bcnn

    b = main programnamec = TOP for gobaldata

    O for outputmodules

    I for inputmodules

    F for formroutinesnn = two digitnumber for O, I, andF

    Z3RSDPR_OPENITEMSTOPZ3RSDPR_OPENITEMSO01Z3RSDPR_OPENITEMSI01Z3RSDPR_OPENITEMSF01Current & Future

    Module pool SAPMdnn

    SAPM = fixed prefix

    d = developmentclassnn = 2 digit number

    SAPMZGECSSE01Current & Future

    Module poolincludes

    Mdnntnn

    M = fixed prefixdnn = module poolsuffixtnn = TOP, Onn, Inn,Fnn(e.g. SAPs internalconvention)

    MZECSSE01TOPMZECSSE01O01MZECSSE01I01MZECSSE01F01Current & Future

    Program Objects

    http://localhost/var/www/apps/conversion/tmp/Local%20Settings/cur_fut_program.xlshttp://localhost/var/www/apps/conversion/tmp/Local%20Settings/cur_fut_include.xlshttp://localhost/var/www/apps/conversion/tmp/Local%20Settings/cur_fut_module.xlshttp://localhost/var/www/apps/conversion/tmp/Local%20Settings/cur_fut_module_include.xlshttp://localhost/var/www/apps/conversion/tmp/Local%20Settings/cur_fut_module_include.xlshttp://localhost/var/www/apps/conversion/tmp/Local%20Settings/cur_fut_module.xlshttp://localhost/var/www/apps/conversion/tmp/Local%20Settings/cur_fut_include.xlshttp://localhost/var/www/apps/conversion/tmp/Local%20Settings/cur_fut_program.xls
  • 8/11/2019 Abap Coding Std

    37/54

    9/15/2014 HP Confidential Coding Standards 37

    Transaction code dnn

    Best practice is touse the same suffixas correspondingmodule pool. Whenimpractical, theformat Zyb may beused, where:Z = Customdevelopment

    y = Site codeb = Shortdescription

    In addition, systemgenerated tcodesnames are alsopermitted.

    ZGECSSE01

    Function Group dnnd = developmentclassnn = 2 digit number

    ZGELESHP01Current & FutureFuture

    Function Module Zy_b

    Z = Customdevelopment

    y = Site codeb = Shortdescription

    ZG_SERIAL_NUMBER_STATUS

    Z3_IDOC_OUTPUT_ZORDERS2Current & Future

    Layout Set Zyxx_b_c

    Z = Customdevelopment

    y = Site codexx = Applicationareab = Org code, regioncode, or country

    identifierc = Document type

    Z1SD_NA_BILLING_DOCUMENTCurrent & Future

    Contd.

    http://localhost/var/www/apps/conversion/tmp/Local%20Settings/cur_fut_functiongroup.xlshttp://localhost/var/www/apps/conversion/tmp/Local%20Settings/functional_group.xlshttp://localhost/var/www/apps/conversion/tmp/Local%20Settings/Temporary%20Internet%20Files/OLK1C/CUR_FUR_FUNCTION_MODULEhttp://localhost/var/www/apps/conversion/tmp/Local%20Settings/cur_fut_layoutset.xlshttp://localhost/var/www/apps/conversion/tmp/Local%20Settings/cur_fut_layoutset.xlshttp://localhost/var/www/apps/conversion/tmp/Local%20Settings/Temporary%20Internet%20Files/OLK1C/CUR_FUR_FUNCTION_MODULEhttp://localhost/var/www/apps/conversion/tmp/Local%20Settings/functional_group.xlshttp://localhost/var/www/apps/conversion/tmp/Local%20Settings/cur_fut_functiongroup.xls
  • 8/11/2019 Abap Coding Std

    38/54

    9/15/2014 HP Confidential Coding Standards 38

    Classes ZyCL_b

    Z = Customdevelopment

    y = Site codeCL = Class identifierB = Short description

    Z3CL_IM_C_CALC_BADI

    Business objects new

    Zyxxxxnn

    Z = Customdevelopment

    y = Site codexxxx = SAPapplication componentnn = 2 digit number

    Z3MMIM0001

    Business objects custom SAP subtype Zyb

    Z = Customdevelopment

    y = Site codeb = SAP Businessobject

    ZGBUS2032

    Contd.

  • 8/11/2019 Abap Coding Std

    39/54

    9/15/2014 HP Confidential Coding Standards 39

    Local Date and Local Time Usage Standard

  • 8/11/2019 Abap Coding Std

    40/54

    9/15/2014 HP Confidential Coding Standards 40

    The SAP run time values for system date (SY-DATUM) and system time(SY-UZEIT) are set by the application server system date and time. The

    SAP run time values for local date (SY-DATLO) and local time (SY-TIMLO)are calculated as an offset from system time, based on the time zonespecified in the user master. If no time zone is specified, then the localdate and time will be identical to the system date and time

    Use SY-DATLO and SY-TIMLO for all application specific dates and times.

    This would include such things as (but not limited to); document date,posting date, shipping date, billing date, requested date, materialavailability date, effective date - all sorts...pricing, exchange rates, salesstatus, etc.

    Only use SY-DATUM and SY-UZEIT for system level functions where, forexample, you must maintain the integrity of the sequence of events. Thiswould include such things as (but not limited to); document creation date,document change date, program execution time, date and time stamps usedin file names, etc.

  • 8/11/2019 Abap Coding Std

    41/54

    9/15/2014 HP Confidential Coding Standards 41

    SAP Reporting Tree Standard

  • 8/11/2019 Abap Coding Std

    42/54

    9/15/2014 HP Confidential Coding Standards 42

    As of 4.6 upgrade, this report tree is attached to the standard SAP areamenu (S000) via an enhancement area menu (ZREPTREE).

    Non compliant area menus on ESG Americas :

    Z9M1 Corporate Contracts Administrator MenuZ9MN Corporate Contracts Main Menu

    (attached to SAP ME00)

    ZB2B B2B ManagementZCBT Backplane InterfaceZCSO Report SelectionsZCSO_1 Report Selections (backup copy)ZCSO_1_1 Report Selections (backup copy)

  • 8/11/2019 Abap Coding Std

    43/54

    9/15/2014 HP Confidential Coding Standards 43

    There are 3 types of Area menus enhancement to SAP menu

    requires a repair to SAP

    Name of object should be the Development Class (w/o optionalextension) with underscore and SAP area menu attached toExample: Z3MSO_S000

    Only one attachment to SAP per functional area and only oneowner for changes

    Sub menu of other HP area menuMaintained with SE43Name of object should be the Development Class (w/o optional

    extension) with underscore and 4 digit number controlled byenhancement area menu owner.

    Example: Z3ESO_0001

    Freestanding menu that works like a TcodeNot available on menu treeName of object should conform to Tcode naming convention with

    underscore and MENUNaming conflicts between Tcode and Area menu will always resolve

    to the Tcode

    Example: Z3ESO01_MENU

  • 8/11/2019 Abap Coding Std

    44/54

    9/15/2014 HP Confidential Coding Standards 44

    Restricted ABAP Coding Standard

  • 8/11/2019 Abap Coding Std

    45/54

    9/15/2014 HP Confidential Coding Standards 45

    The following ABAP keywords are not to be used in any customprogram on any production SAP system, with the exception of

    controlled objects or 3rd party software interfaces with theappropriate approvals:

    INSERT REPORTDELETE REPORT

    The following ABAP keyword may only be used in any custom programon any production system following review and approval:

    GENERATE SUBROUTINE POOL

  • 8/11/2019 Abap Coding Std

    46/54

  • 8/11/2019 Abap Coding Std

    47/54

    9/15/2014 HP Confidential Coding Standards 47

    Fusion SAP Filename and Directory Standard

  • 8/11/2019 Abap Coding Std

    48/54

  • 8/11/2019 Abap Coding Std

    49/54

    9/15/2014 HP Confidential Coding Standards 49

    Logical File Name Standard

    The following example illustrates the logical path and logical filenaming convention for the PRS projects CPL price data extract files.

    Logical File Path Naming ConventionZPRS_CPL_REPORTS_PATH

    Description Examples

    Custom development ZProject ID PRS

    Free Form CPL_REPORTS_PATH

    Logical File Naming ConventionZPRS_CPL_REPORTS

    Description Examples

    Custom development Z

    Project ID PRS

    Free Form CPL_REPORTS

  • 8/11/2019 Abap Coding Std

    50/54

    9/15/2014 HP Confidential Coding Standards 50

    Function module FILE_GET_NAMEis used to automatically returndirectory path for a file:call function 'FILE_GET_NAME'

    exportingclient = sy-mandtlogical_filename = 'ZPRS_CPL_REPORTS'operating_system = sy-opsys

    importingfile_name = file_name

    exceptionsfile_not_found = 1others = 2.

    Example:

    The returned value file_nameis the physical path that was assigned tothe logical path. You concatenate this physical path with your file nameto establish the full path.

    Example of a physical path assigned to a logical path:/opt/z9//PRS/

    Where and are variables.

    http://localhost/var/www/apps/conversion/tmp/Local%20Settings/example_filename.doc
  • 8/11/2019 Abap Coding Std

    51/54

    9/15/2014 HP Confidential Coding Standards 51

    Contd

    Non-IM/3 program:

    Imported file name from FILE_GET_NAME function:/opt/z9/QA2/PRS/.

    Concatenate /opt/z9/QA2/PRS/ with filename to get the full path/opt/z9/QA2/PRS/filename.

    IM/3 program:

    Imported file name from FILE_GET_NAME function:/opt/z9/QA2/PRS/filename

  • 8/11/2019 Abap Coding Std

    52/54

    9/15/2014 HP Confidential Coding Standards 52

    ESG 4.6 SAP Modification Standard

  • 8/11/2019 Abap Coding Std

    53/54

    9/15/2014 HP Confidential Coding Standards 53

    This standard consists of four sections:

    1. Usage of the Note Assistant2. Usage of the Modification Assistant3. Source Code Comment Requirements4. External Documentation Requirements

  • 8/11/2019 Abap Coding Std

    54/54

    Thank You