‎2007 Sep 12 9:48 AM
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
‎2007 Sep 12 9:53 AM
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.
‎2007 Sep 12 9:55 AM
Hi,
the same code is working in 4.6c version but its raising error in ECC 6
‎2007 Sep 12 10:03 AM
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
‎2007 Sep 12 9:55 AM
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
‎2007 Sep 12 9:55 AM
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
‎2007 Sep 12 10:06 AM
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
‎2007 Sep 12 10:18 AM
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. //
‎2007 Sep 12 10:25 AM
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.
‎2007 Sep 12 10:54 AM
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.
‎2007 Sep 12 11:04 AM
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.
‎2007 Sep 12 11:26 AM
‎2007 Sep 12 1:15 PM
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