Code listing for: ZDTP_SYNTAXCHECK

Description: Syntax checking program

***********************************************************************************************************************
* Description:
*-------------
* This program is used to syntax check programs within SAP.  The report shows compiler warning and error messages
*
***********************************************************************************************************************
*
* Author          : Copyright (C) 2006 E.G.Mellodew
* program contact : www.dalestech.com
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
*
***********************************************************************************************************************
* Version  Correction Number  Date Changed  Changed By        Description
* ---------------------------------------------------------------------------------------------------------------------
* 1.0                                       Ed Mellodew       Original version
* 1.1                         18.12.2007    Ed Mellodew       Messages for obsolete function calls were not being
*                                                             displayed in the detail ALV grid.
***********************************************************************************************************************

program zdtp_syntaxCheck message-id zdtm_syntaxCheck.

*----------------------------------------------------------------------------------------------------------------------
* Includes
*----------------------------------------------------------------------------------------------------------------------
*----------------------------------------------------------------------------------------------------------------------
initialization.
*----------------------------------------------------------------------------------------------------------------------

  noWithErrors = 0.
  noWithWarnings = 0.
  noCompiled = 0.

*----------------------------------------------------------------------------------------------------------------------
start-of-selection.
*----------------------------------------------------------------------------------------------------------------------

  case 'X'.
    when rbProg.
*     Find the programs to check
      perform findPrograms using soProg[]
                                 iProgramNames[]
                                 pMax
                                 soPack[]
                                 soAuth[]
                                 soChange[]
                                 pLocl
                                 pGen.
    when rbFunc.
      perform findFuncs using soFGroup[]
                              iProgramNames[]
                              pMax
                              soPack[]
                              soAuth[]
                              pLocl
                              pGen.

    when rbClass.
      perform findClasses using soClass[]
                              iProgramNames[]
                              pMax
                              soPack[]
                              soAuth[]
                              pLocl
                              pGen.

  endcase.

* Lets check the programs now
  if not iProgramNames[] is initial.
    numberOfPrograms = lines( iProgramNames[] ).
    message s001 with numberOfPrograms.
    perform syntaxCheckPrograms using iProgramNames[]
                                      iMessages[]
                                      pUni
                                      pObs
                                      rbMessE
                                      rbMessW.
  endif.

*----------------------------------------------------------------------------------------------------------------------
end-of-selection.
*----------------------------------------------------------------------------------------------------------------------

  case 'X'.
    when rbProg.
      perform prepareProgDataforALV using iProgramNames[]
                                          iMessages[]
                                          iProgramDetails[]
                                          pFail.

      noCompiled = ( numberOfPrograms - noWithErrors - noWithWarnings ).
      message s002 with numberOfPrograms noWithErrors noWithWarnings.

      if not iProgramDetails[] is initial.
        sort iProgramDetails ascending by alvStatus subc programName.
        call screen 0100.
     endif.

    when rbFunc.
      perform prepareFuncDataforALV using iProgramNames[]
                                          iMessages[]
                                          iFuncDetails[]
                                          pFail.

      noCompiled = ( numberOfPrograms - noWithErrors - noWithWarnings ).
      message s003 with numberOfPrograms noWithErrors noWithWarnings.

      if not iFuncDetails[] is initial.
        sort iFuncDetails ascending by alvStatus funcName.
        call screen 0100.
     endif.

    when rbClass.
      perform prepareClassDataforALV using iProgramNames[]
                                           iMessages[]
                                           iClassDetails[]
                                           pFail.

      noCompiled = ( numberOfPrograms - noWithErrors - noWithWarnings ).
      message s006 with numberOfPrograms noWithErrors noWithWarnings.

      if not iClassDetails[] is initial.
        sort iClassDetails ascending by alvStatus className.
        call screen 0100.
     endif.
  endcase.

  free iProgramDetails.
  free iFuncDetails.
  free iProgramNames.
  free iClassDetails.

*GUI Texts
*----------------------------------------------------------
* ZTITLE_REPORT --> Results from syntax check

*Text elements
*----------------------------------------------------------
* 001 Selection options
* 002 Message options
* 003 Show all messages
* 004 Compiler error and warning messages
* 005 E
* 006 W
* 007 Yes
* 008 No
* 009 Error messages
* 010 Error messages only
* 011 Warning messages only
* 012 Warning messages
* 013 Reporting options
* 014 Code
* 015 Auto Gen
* 016 Auto generated
* 017 Logical database name
* 018 Only process programs with transaction codes
* 019 Checking options
* 020 Check for upload/download & ws_upload/ws_download
* 021 Unicode syntax check
* 022 Check running for (&1 of &2):
* 023 Restrictions


*Selection texts
*----------------------------------------------------------
* PFAIL         Don't show successful compiles
* PGEN         Ignore generated objects
* PLOCL         Ignore local objects
* PMAX         Max number to process
* PSTATUS         Show progress messages
* RBCLASS         Global classes
* RBFUNC         Functions
* RBMESSA         Display all objects
* RBMESSE         Display only errored objects
* RBMESSW         Display only warnings
* RBPROG         Programs
* SOAUTH         Created by
* SOCHANGE         Last changed by
* SOCLASS         Class names
* SOFGROUP         Function groups
* SOPACK         Package
* SOPROG         Program name


*Messages
*----------------------------------------------------------
*
* Message class: ZDTM_SYNTAXCHECK
*001   Starting to syntax check & programs.
*002   From & programs, & failed to compile and & have only compiler warnings.
*003   From & function groups, & failed to compile and & have compiler warnings.
*006   From & classes, & failed to compile and & have compiler warnings.
*008   You must enter at least one program name or a package.
*009   You must enter at least one function group name or a package.
*010   You must enter at least one class name or a package.