Problem solve Get help with specific problems with your technologies, process and projects.

Syntax-check

This is a small program, which will check syntax errors of programs.

This Program uses Internal statement in SAP, SYNTAX-CHECK. This is a small program, which will check syntax errors...

of programs (the programs should be down loaded to .txt file and the name of those program files should be available in one index file (again .txt)). This will be useful during an upgrade.


REPORT ZCHECK LINE-SIZE 255 LINE-COUNT 60 NO STANDARD PAGE HEADING.
TABLES: RLGRAP.

DATA: BEGIN OF INDEX_TAB OCCURS 0,
  LINE(255),
END OF INDEX_TAB.

DATA: BEGIN OF DATA_TAB OCCURS 0,
  LINE(255),
END OF DATA_TAB.

DATA: F(240),
      G TYPE I,
      H(72),
      FNAME LIKE RLGRAP-FILENAME,
      COUNT TYPE P DECIMALS 0, ERROR TYPE P DECIMALS 0,
      LENGTH TYPE I.
PARAMETER INDXFILE LIKE RLGRAP-FILENAME DEFAULT
                    'C:WINDOWSDESKTOPCHECKINDEX.TXT'.

CALL FUNCTION 'WS_UPLOAD'
    EXPORTING
    FILENAME = INDXFILE
    FILETYPE = 'DAT'
   TABLES
     DATA_TAB =   INDEX_TAB.

LOOP AT INDEX_TAB.
   AT FIRST.
     WRITE:/50 'SYNTAX CHECK SUMMARY REPORT'.
     skip 1.
     uline.
     WRITE:/2 'Sr No:', 10 'Program', 27 'Line no:',
      45 'Incorrect Word'.
     WRITE:/12 'Sytax error'.
     uline.
   ENDAT.


CLEAR FNAME.
CONCATENATE 'C:WINDOWSDesktopCHECK' INDEX_TAB-LINE+0(12)
         INTO FNAME.
CALL FUNCTION 'WS_UPLOAD'
    EXPORTING

   FILENAME = FNAME
   FILETYPE = 'DAT'
     TABLES
          DATA_TAB            = DATA_TAB.
  IF SY-SUBRC EQ 0.
CLEAR: SY-MSGID, SY-MSGNO, SY-MSGTY.
COUNT = COUNT + 1.


    SYNTAX-CHECK FOR DATA_TAB MESSAGE F LINE G WORD H.
         CONDENSE: F, H.
         IF F IS INITIAL.
           F = 'No syntax errors'.
         ELSE.
           ERROR = ERROR + 1.
         ENDIF.
     WRITE:/2(5) COUNT, 10(8) INDEX_TAB-LINE+0(8), 27 'Line: ',
                 G LEFT-JUSTIFIED NO-ZERO, H.
     WRITE:/12 F.
     ULINE.
*     SKIP 1.
     CLEAR: F, G, H.
  ENDIF.
  REFRESH DATA_TAB. CLEAR DATA_TAB.


ENDLOOP.
  MESSAGE S000(0K) WITH COUNT
         'programs has been checked for syntax errors...'
         ERROR ' program/s got syntax errors...'.

This was last published in October 2002

Dig Deeper on SAP ABAP

PRO+

Content

Find more PRO+ content and other member only offers, here.

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

-ADS BY GOOGLE

SearchManufacturingERP

SearchOracle

SearchDataManagement

SearchAWS

SearchBusinessAnalytics

SearchCRM

SearchContentManagement

SearchFinancialApplications

Close