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

explain please

Former Member
0 Likes
1,908

Can anyone please for what do we use each of the below.

constants: c_3(1) type c value '3' ,

c_i(1) type c value 'I' ,

c_x(1) type c value 'X' ,

c_eq(2) type c value 'EQ' ,

c_pl03 like p0001-werks value 'PL03'.

For example:

constants: c_1(1) type c value '1' ."checks if reading is succesful

Thanks.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,759

Hi Shakeen,

It's a <b>CONSTANT</b> (It's value never change at any point)

c_3(1) = 3.

Whereever u use the c_3 it's value will be 3.

Variable - value change often,

Constant - value never change.

Rgds,

Jothi.P

15 REPLIES 15
Read only

Former Member
0 Likes
1,760

Hi Shakeen,

It's a <b>CONSTANT</b> (It's value never change at any point)

c_3(1) = 3.

Whereever u use the c_3 it's value will be 3.

Variable - value change often,

Constant - value never change.

Rgds,

Jothi.P

Read only

Former Member
0 Likes
1,759

Hi shaheen,

Here we r assigning some constant values for those variables which are of char type and p0001-werks type.

Read only

Former Member
0 Likes
1,759

Hi!

use

constants: c_3(1) type c value '3' ,

c_i(1) type c value 'I' ,

c_x(1) type c value 'X' ,

c_eq(2) type c value 'EQ' ,

c_pl03(4) value 'PL03'.

I think it's help you.

And you can do this too:

data: c_pl03 like p0001-werks value 'PL03'.

Read only

Former Member
0 Likes
1,759

Hi Shaheen,

The Code that has been wirtten is called as constant decleration.

Constatns are used in coding for keeping a fixed value in a varible.

Suppose say

constants: c_3(1) type c value '3' .

Whereever you use c_3 it will be replaced with value 3 in runtime of the program.

And constants are used for avoiding hardcoing in the coding also and it will easy to change a value in the code which is used many times.

Regards,

Harsha

  • Reward points if helpful.

Read only

Former Member
0 Likes
1,759

using CONSTANT u can define a constant whose value will not change, i mean in prog if u r using one value at more than one places then u can assign it to one constant and use that constant everywhere and lateron if u want to change that value then u need to change it only at one place ...

Variable - data objects whose value change often,

Constant - data objects whose value never changes.

reward if useful.

Read only

Former Member
0 Likes
1,759

what does c_i , c_x, c_eq and c_pl03 stands for?

Read only

0 Likes
1,759

that is just a naming convension c for constant and i for integer and so on....

reward if useful.

Read only

0 Likes
1,759

Thanks alot. So if I want to set a default value for active employee do I need to have the following code

pnpstat2-sign = c_i.

pnpstat2-option = c_EQ.

pnpstat2-low = c_3. " active employee

append pnpstat2.

Or simply can I write

pnpstat2-low = c_3. " active employee

append pnpstat2.

Read only

0 Likes
1,759

Hi Shaheen,

You need to use the first code i.e. :

pnpstat2-sign = c_i.

pnpstat2-option = c_EQ.

pnpstat2-low = c_3. " active employee

append pnpstat2.

Thanks,

Imran

Read only

0 Likes
1,759

Thanks, but can you explain why? aren't they just a naming convention

Read only

0 Likes
1,759

Shaheen,

naming conventions are the rules that ur organization follows.

nothing more than that.

Regards,

Sujatha.

Read only

0 Likes
1,759

Hi Shaheen,

Naming conventions are set of rules defined by a org/pers. It's not <b>mandatory.</b>

It's easy to use.You can give any name for your variable,internal table,structure in your program.But if someother person wants to modify your code he may be confused.So you hav to define naming convention for your org.

For example..

All the variables should start with V_xxx,

Internal tables should start with Itab_xxxx,

All the program names should start with YHRxxxx -> for customized HR pgms.

YFIxxxx -> for customized FI pgms

Hope you got idea.

Rgds,

Jothi.P

Read only

Former Member
0 Likes
1,759

Hi ,

those r some variable names ,it can be anything.

c_i(1) means its a variable the name c_i occupying 1 char.

c_x(1) means varaible c_x having 1 char memory.

c_eq(2) means variable can hold 2 characters

Read only

Former Member
0 Likes
1,759

Hi,

select-options:pnpstat2 like ........ default 'c_3'.

Read only

Former Member
0 Likes
1,759

Hi,

select-options: s_ppnstat2 for .......default 'c_3'.

here s_ppnstat2 is a variable .but its select-option ,so using s_ppnstat2.

then if we give default value that will be assigned to low only,so no need to specify as ppnstat2-low = 'c_3'.