<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: constants use in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/constants-use/m-p/3081651#M730862</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;lt;b&amp;gt;Constants &amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;Constants are named data objects that you create statically using a declarative statement. They allow you to store data under a particular name within the memory area of a program. The value of a constant must be defined when you declare it. It cannot subsequently be changed. The value of a constant cannot be changed during the execution of the program. If you try to change the value of a constant, a syntax error or runtime error occurs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CONSTANTS: BEGIN OF myaddress,&lt;/P&gt;&lt;P&gt;           name     TYPE c LENGTH 20 VALUE 'Fred Flintstone',&lt;/P&gt;&lt;P&gt;           street   TYPE c LENGTH 20 VALUE 'Cave Avenue',&lt;/P&gt;&lt;P&gt;           number   TYPE p           VALUE  11,&lt;/P&gt;&lt;P&gt;           postcode TYPE n LENGTH 5  VALUE  98765,&lt;/P&gt;&lt;P&gt;           city     TYPE c LENGTH 20 VALUE  'Bedrock',&lt;/P&gt;&lt;P&gt;           END OF myaddress.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 04 Dec 2007 03:10:17 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-12-04T03:10:17Z</dc:date>
    <item>
      <title>constants use</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/constants-use/m-p/3081648#M730859</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Freinds,&lt;/P&gt;&lt;P&gt;why we are using constants in prg...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;pls.. explain any one with EXAMPLE...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REGARDS,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Dec 2007 18:41:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/constants-use/m-p/3081648#M730859</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-03T18:41:57Z</dc:date>
    </item>
    <item>
      <title>Re: constants use</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/constants-use/m-p/3081649#M730860</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Constants are data objects that you can create statically in the program using that statement &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
constants : c_x type c value 'X'.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It cannot subsequently be changed. The value of a constant cannot be changed during the execution of the program. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
constants : c_x type c value 'X'.
if v_value eq c_x.
   " Here you are check v_value = 'X' using constant c_x.
endif.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;a®&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Dec 2007 18:47:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/constants-use/m-p/3081649#M730860</guid>
      <dc:creator>former_member194669</dc:creator>
      <dc:date>2007-12-03T18:47:08Z</dc:date>
    </item>
    <item>
      <title>Re: constants use</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/constants-use/m-p/3081650#M730861</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the client requirement is fixed for a particular thing..you use Constants...&lt;/P&gt;&lt;P&gt;For eg U have a report to list materials for specific plant lets say 'C'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;U can give this plant 'C' as constant in ur where condition .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select matnr from MARA into table itab where werks = c_plant .&lt;/P&gt;&lt;P&gt;Where c_plant = 'C' .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;praveen&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Dec 2007 01:16:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/constants-use/m-p/3081650#M730861</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-04T01:16:42Z</dc:date>
    </item>
    <item>
      <title>Re: constants use</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/constants-use/m-p/3081651#M730862</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;lt;b&amp;gt;Constants &amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;Constants are named data objects that you create statically using a declarative statement. They allow you to store data under a particular name within the memory area of a program. The value of a constant must be defined when you declare it. It cannot subsequently be changed. The value of a constant cannot be changed during the execution of the program. If you try to change the value of a constant, a syntax error or runtime error occurs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CONSTANTS: BEGIN OF myaddress,&lt;/P&gt;&lt;P&gt;           name     TYPE c LENGTH 20 VALUE 'Fred Flintstone',&lt;/P&gt;&lt;P&gt;           street   TYPE c LENGTH 20 VALUE 'Cave Avenue',&lt;/P&gt;&lt;P&gt;           number   TYPE p           VALUE  11,&lt;/P&gt;&lt;P&gt;           postcode TYPE n LENGTH 5  VALUE  98765,&lt;/P&gt;&lt;P&gt;           city     TYPE c LENGTH 20 VALUE  'Bedrock',&lt;/P&gt;&lt;P&gt;           END OF myaddress.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Dec 2007 03:10:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/constants-use/m-p/3081651#M730862</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-04T03:10:17Z</dc:date>
    </item>
    <item>
      <title>Re: constants use</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/constants-use/m-p/3081652#M730863</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi venu,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   You can use a constant when you need to include the same literal many times in a program. You can define a constant with the same value as the literal and use the constant in the body of the program in place of the literal. After some time, if you want to change the values means, you can simply change the value where you define the constant.&lt;/P&gt;&lt;P&gt;   ABAP/4 has one pre-defined constant: SPACE ( You can use ' ' this also both are same ). &lt;/P&gt;&lt;P&gt;   It is a constant having a value equal to spaces.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Defining constants:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;--&amp;gt; CONSTANTS C_EX(4) TYPE C VALUE 'VENU'.&lt;/P&gt;&lt;P&gt;--&amp;gt; CONSTANTS C_EX LIKE C VALUE 'BB'.&lt;/P&gt;&lt;P&gt;--&amp;gt; CONSTANTS C_NUM TYPE I VALUE 5.&lt;/P&gt;&lt;P&gt;--&amp;gt; CONSTANTS C_DATE LIKE SY-DATUM VALUE '19970305'.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Dec 2007 04:45:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/constants-use/m-p/3081652#M730863</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-04T04:45:56Z</dc:date>
    </item>
    <item>
      <title>Re: constants use</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/constants-use/m-p/3081653#M730864</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Variants: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. CONSTANTS c.     ... VALUE [ val | IS INITIAL ]. &lt;/P&gt;&lt;P&gt;2. CONSTANTS c(len) ... VALUE [ val | IS INITIAL ]. &lt;/P&gt;&lt;P&gt;3. CONSTANTS: BEGIN OF crec, &lt;/P&gt;&lt;P&gt;                ... &lt;/P&gt;&lt;P&gt;              END   OF crec. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Effect &lt;/P&gt;&lt;P&gt;The CONSTANTS statement defines global and local constants. By using constants, you can read statically declared data objects, since they always have a particular data type. You can use constants in any position where fields are allowed, and also in the following positions: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To specify length in a DATA STATICS, CONSTANTS, PARAMETERS, or TYPES statement. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As a DECIMALS value in a DATA, STATICS, CONSTANTS, PARAMETERS, or TYPES statement. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As an OCCURS value in a DATA, STATICS, RANGES, or TYPES statement. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the VALUE addition of a DATA, STATICS, or CONSTANTS statement. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As an offset or length specification in a field specification. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As a value for an exception (EXCEPTIONS) in the CALL FUNCTION statement. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Constants always have a defined data type. Data types and data objects are integral parts of the ABAP type concept. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In contrast to variables defined with the DATA statement, you cannot change the value of a constant once it has been defined. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Apart from the additions ... TYPE typ OCCURS n, ... LIKE f1 OCCURS n and WITH HEADER LINE, all the additions used with the DATA statement are allowed. However, in contrast to the DATA statement, the addition ... VALUE val or VALUE IS INITIAL is obligatory with variants 1 and 2. See additions with DATA. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example&lt;/P&gt;&lt;P&gt;CONSTANTS  CHAR1 VALUE 'X'. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CONSTANTS  INT   TYPE I VALUE 99. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CONSTANTS: BEGIN OF CONST_REC, &lt;/P&gt;&lt;P&gt;             C(2) TYPE I VALUE 'XX', &lt;/P&gt;&lt;P&gt;             N(2) TYPE N VALUE '12', &lt;/P&gt;&lt;P&gt;             X    TYPE X VALUE 'FF', &lt;/P&gt;&lt;P&gt;             I    TYPE I VALUE 99, &lt;/P&gt;&lt;P&gt;             P    TYPE P VALUE 99, &lt;/P&gt;&lt;P&gt;             F    TYPE F VALUE '9.99E9', &lt;/P&gt;&lt;P&gt;             D    TYPE D VALUE '19950101', &lt;/P&gt;&lt;P&gt;             T    TYPE T VALUE '235959', &lt;/P&gt;&lt;P&gt;           END OF CONST_REC. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note &lt;/P&gt;&lt;P&gt;You cannot declare XSTRINGs, references and internal tables - or structures that include internal tables - as constants.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Dec 2007 12:17:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/constants-use/m-p/3081653#M730864</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-04T12:17:54Z</dc:date>
    </item>
  </channel>
</rss>

