Skip to Content
author's profile photo
Former Member

Constants for all

Hi,

i want to know if is it possible to create a file with constants which can be used for all pages of a bsp application (globals constants) ? Or is there another way to do this ?

Thanks

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • author's profile photo
    Former Member
    Jun 15, 2004 at 03:20 PM

    Hello,

    your could define constants as attributes in your application class.

    How do you like this?

    Regards, Bernd

    Add comment
    10|10000 characters needed characters exceeded

    • One way is as constants of the application class. However, constants can be defined on <b>any</b> class. So just create a small class, call it CL_MY_CONSTANTS, and define all the constants on that class. You can also define constants on interfaces. For an example, see IF_BSP_WRITER.

      Alternatively, just define the constants inside a page fragment.

      <%
        constants CO_RED   type C value 'R'.
        constants CO_GREEN type C value 'G'.
        constants CO_BLUE  type C value 'B'.
      %>
      

      Now you can include this page fragment in all pages (effectively expanded inline) and just refer to the constants.

      <%@include file="myConstants.htm"%>
      <%=CO_RED%>
      

      ++bcm

  • author's profile photo
    Former Member
    Jun 16, 2004 at 12:19 PM

    Thanks a lot

    Add comment
    10|10000 characters needed characters exceeded