cancel
Showing results for 
Search instead for 
Did you mean: 

Declaration in include

Former Member
0 Kudos

<b>Is it good program practice</b> to keep all declaration in an INCLUDE?

If yes <b>what we can we keep in an INCLUDE</b>?

Global declarations??

only global itabs or global variables also.

Thanks,

RAJA

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi all thanks for replies.

ateeq,

we can maintain includes for subroutine def also?

Please confirm what <b>basic criteria to maintain includes</b>?

what are the <b>other items</b>(other than itabs & variables) we can keep in an include?

ur help will be appreciarted

Former Member
0 Kudos

it is a gud practice to segregate data declarations, module definitions, subroutine definitions and the program logic itself....

one advantage you get out of this is that when u r required to make modifications to one of these parts,

you can easily change at one location and do not have to worry about the whole program being affected.

for example, if for some reason the data type of a variable is changed....u need to change only in the data declarations....

...plus the fact that if u club everything together...it gets messy after some time and it will not be very easy for you to locate (say) a particular subroutine or a data variable...

apart from variables and itabs, u can have includes for modules, subroutines, and even you can have whole programs being included in other programs

rgds,

PJ

Former Member
0 Kudos

raja,

u can maintain for subroutines also. its a good practice. in my earlier mail i had written briefly. u can use the zprog1_fxx for subrotines not for func's.

rewards points and close the thread if ur satisfied with replies.

Ateeq

Answers (6)

Answers (6)

Former Member
0 Kudos

Kim u opened a new dimension of this thread.

Can u explain me abt the <b>Naming convention</b> to use for includes?

Former Member
0 Kudos

Hi,

Report Zfr_accounts_....

'Z'........... you know.

'F' for Finance..........

'R' for report....

include Zfr_accounts_...._top for global decleration.

include Zfr_accounts_...._s01 for selection screen.

include Zfr_accounts_...._f01 for function coding and for subroutines.

Thanks.

Former Member
0 Kudos

Has been mantined.

If you write a dialog program the naming convention is SAPMZ*****

If you created this in SE80 SAP will automaticly created/propose the following includes :

MZ*****TOP for top include : variables, selection screen

MZ*****F01 for FORM rutines

MZ*****I01 Process before input

MZ*****O01 Process after input

And you can created MZ*****E01 for EVENTS

Former Member
0 Kudos

Here is some text from SAPTechEd CD200 (ABAP Objects –Programming Guidelines) by Horst Keller:

Situation:

The source code of a program can be organized with:

Include programs

Macros

Rules

Include programs

Allowed for the source code modularization of exactly one ABAP program

No reuse for type definitions, declarations, or implementations

Must follow naming conventions of the ABAP Workbench

Strongly recommended for large programs (e.g. Top-Include)

Macros

Not allowed

Please Observe that include programs are not meant to be used by servaral program (according to the new guidelines). I guess that SAP has had a lot of problems re-writing old code because include were used (abused) by many programs.

Former Member
0 Kudos

Hi,

You can check any module pool (using SE80) to see what SAP puts into includes.

There can be Data declaration, PBO/PAI includes, selection screens, macros, Subroutines..

Sudha

jayanthi_jayaraman
Active Contributor
0 Kudos

Hi,

It is very much advisable to put global declarations in a include[global internal table,constants,types,variable,workarea].

KIndly reward points by clicking the star on the left of reply,if it helps.

Former Member
0 Kudos

its a good programming if u keep the includes..

u can maintain the includes as follows.

suppose ur program is zprog1.

for variable declarations: zprog1_top

for functions: zprog1_fXX.

for pbo:zprog1_oXX.

for pai:zprog1_iXX.

for selection-scr: zprog1_sXX.

its helps u to trace them easily.

hope this answer will helpful. reward points .

Former Member
0 Kudos

Hi,

Yes it is good practise to keep all the global decleration in an INCLUDE.

You can put all the selection screen in one INCLUDE,and all the function code in one INCLUDE.

Thanks.