Application Development 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: 

syntax error in ECC 6

Former Member
0 Kudos

HI All,

can any one please suggest me that cant we assign any prg to sy-repid.

i have ana error for this code SY-REPID = 'PRGNAME'.

error is:the field SY-REPID cant be changed

12 REPLIES 12

Former Member
0 Kudos

Hi,

SY-REPID is the system field and it assigned automatically by the system.

So you can't manully assign the values to system field.

Thanks.

0 Kudos

Hi,

the same code is working in 4.6c version but its raising error in ECC 6

0 Kudos

Hi sureshrayudu,

although it worked in 46C it is completely useless: With the next statement it will retain the name of the program runningf as value.

Just remove this and check for any difference.

Regards,

Clemens

Former Member
0 Kudos

Hi the error is because:

The system field SY-REPID is not part of SYST or SY. Instead, every program contains the predefined constants SY-REPID and SYST-REPID, which both contain the name of the corresponding program. Furthermore, there are two predefined types of the same name, SY-REPID and SYST-REPID.

All system fields are addressed using SY field name and their types using SYST field name.

Go through this link....

http://help.sap.com/saphelp_nw2004s/helpdata/en/7b/fb96c8882811d295a90000e8353423/content.htm

Regards

vasu

Former Member
0 Kudos

Hi.....sy-repid is a system variable and it cant be changed in the program......

jus like u cant change sy-datum....

Plz reward points if helpful

rahul_srivastava3
Participant
0 Kudos

Hi,

No you Cant do this . Actually SY_REPID already has assigned the program name once you call it in ur program. No need to assign the program name again to SY_REPID.

If you want to pass your program name to any FM's or anywhere , you can directly pass SY_REPID there. OR you can pass SY_REPID to any variable of type SY_REPID and pass that variable where you want to pass the program name.

May be i am not 100% correct to my statement but If anyhow i solved your problem do reward points.

Regards,

Rahul

Former Member
0 Kudos

hi,

SY-REPID is a field of database table SYST, which is a database table developed by sap.

it holds the name of current program under execution. we can use this variable to get current prgm name. we cant change the value of this variable.

for eX:

data: prgname like sy-repid.

prgname = sy-repid. // then both prgname and sy-repid contains the name of program under execution.

but u cant use it as IT IS A system field.

with regards,

Suresh Aluri.

prgname = 'SURESH ALURI'.

sy-repid = prgname. //

varma_narayana
Active Contributor
0 Kudos

Hi Suresh..

ECC 6.0 Performs certain additional checks like this which may be ignored in 4.6C

So if you want to Assign the Value .. do like this:

DATA: V_REPID LIKE SY-REPID.

V_REPID = 'PRGNAME'.

or

V_REPID = SY-REPID

This will not Give any error

reward if Helpful.

0 Kudos

Hi Varma,

i'm not assigning the same program to sy-repid.

i'm assigning another program to sy-repid.

like....i'm in xyz prg. and in the xyz prg i'm trying to assign abc prg name to sy-repid.

0 Kudos

Hi Suresh..

We should not change the System field values .. bcoz they are filled by Runtime only.

So u can use another variable for this :

DATA: V_REPID LIKE SY-REPID.

V_REPID = 'PRGNAME'. "Assign the program u want..

reward if Helpful.

0 Kudos

varma,

its not working.

0 Kudos

Hi sureshrayudu,

the question remains: Why?

If yopu want to pass a manipulated SY-REPID to a function, it will change as soon the function is entered.

If you need it in your program, then you can exchange all occurences of SY-REPID with a global constant declared as CONSTANTS: gc_repid typs syrepid value 'whatyoulike'.

And is there no other way of doing it properly?

Regards,

Clemens