I have a question in the SYNTAX-CHECK statement. As far as my understanding goes, the additions - DIRECTORY ENTRY or PROGRAM serves the purpose of setting the attributes for syntax check. The Important program attributes for the syntax check are, the program type (TRDIR-SUBC) and whether the program is a Unicode program (TRDIR-UCCHECK), and we specify such info via the DIRECTORY ENTRY or PROGRAM additions.
Suppose I use the SYNTAX-CHECK statement on the source code of an Include program (type 'I'), and use the addition DIRECTORY ENTRY it still gives the error "REPORT/PROGRAM statement missing, or program type is INCLUDE.". My question is - why is the compiler not able to understand that it is an include program when the structure after DIRECTORY ENTRY addition clearly has a SUBC value as 'I'.
To elaborate what I said:
DATA: P_LV_PROGNAME TYPE PROGNAME VALUE '<some include program's name>' ,
LV_PROG TYPE PROGNAME.
LV_PROG = P_LV_PROGNAME.
SELECT SINGLE *
WHERE NAME = P_LV_PROGNAME.
"""Now LS_DIR-SUBC has the value ' I '. I have verified it.
** Get the source code into an internal table
CALL FUNCTION 'RPY_PROGRAM_READ'
PROGRAM_NAME = P_LV_PROGNAME
* WITH_INCLUDELIST = 'X'
ONLY_SOURCE = 'X'
WITH_LOWERCASE = 'X'
SOURCE_EXTENDED = LT_PROG_SOURCE
****Perfom syntax check for the main level program
SYNTAX-CHECK FOR LT_PROG_SOURCE MESSAGE LV_MESS LINE LV_LIN
DIRECTORY ENTRY LS_DIR "PROGRAM lv_prog
ID 'ERR' TABLE LT_E_MESSAGES
ID 'MSG' TABLE LT_W_MESSAGES.
After the SYNTAX-CHECK, the LT_E_MESSAGES[ ] contains the message - "REPORT/PROGRAM Statement missing/ program type is INCLUDE". My question is - "The LS_DIR-SUBC has a value ' I '. That means, I am telling the compiler that it is an include program. Therefore, I don't expect it to give the error message - "...../program type is INCLUDE" "
I have also used the PROGRAM addition appropriately, I have used both PROGRAM and DIRECTORY ENTRY additions. Still, I get the same error message.
Where am I going wrong?