Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Difference between MACRO & SUBROUTINE

Former Member
0 Likes
3,752

Hi,

What is the difference between MACRO & a SUBROUTINE?

Regards,

Amruth

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,878

Hi Amruth,

Macro

Macros can only be used in the program that are defined in and only after the definition are expanded at compilation/generation.

*Subroutine *

Subroutines (FORM) can be called from both the program that are defined in & other programs.

A MACRO is more or less an abbrevation for some lines of code that are used more than once or twice.

A FORM is a local subroutine(which can be called external). A FUNCTION is(more or less) a subroutine that is called external.

Since debugging a MACRO is not really possbile, prevent the use if them(I've never used them, but seen them in action).

If the subroutine is used only local(called internal) use FORM. If the subroutine is called external(used by more than one program) use a FUNCTION.

Regards,

Chandru

3 REPLIES 3
Read only

former_member156446
Active Contributor
0 Likes
1,878

Macros can only be used in the program the are defined in and only after the definition are expanded at compilation / generation. Subroutines (FORM) can be called from both the program the are defined in and other programs . A MACRO is more or less an abbreviation for some lines of code that are used more than once or twice. A FORM is a local subroutine (which can be called external). A FUNCTION is (more or less) a subroutine that is called external. Since debugging a MACRO is not really possible, prevent the use of them (I’ve never used them, but seen them in action). If the subroutine is used only local (called internal) use a FORM. If the subroutine is called external (used by more than one program) use a FUNCTION.

Read only

Former Member
0 Likes
1,879

Hi Amruth,

Macro

Macros can only be used in the program that are defined in and only after the definition are expanded at compilation/generation.

*Subroutine *

Subroutines (FORM) can be called from both the program that are defined in & other programs.

A MACRO is more or less an abbrevation for some lines of code that are used more than once or twice.

A FORM is a local subroutine(which can be called external). A FUNCTION is(more or less) a subroutine that is called external.

Since debugging a MACRO is not really possbile, prevent the use if them(I've never used them, but seen them in action).

If the subroutine is used only local(called internal) use FORM. If the subroutine is called external(used by more than one program) use a FUNCTION.

Regards,

Chandru

Read only

matt
Active Contributor
0 Likes
1,878

There are macros which are defined globally - specifically in the HR module.

matt