‎2009 Apr 20 10:48 AM
Hi Guru's,
I have a small question.
Changing the logical system on Stairs (transaction KS02) should be prevented. This is implemented by an enhancement (project XXXX) where exit COOMKS02 is made active.
Within this exit an error message is generated (message class XXX; message XXX) whenever the value of the logical system (ICSKSP-LOGSYSTEM) is different from the one on the database (checked with a select against table CSKS).
I've written this code below but it doesn't work.
Data :wa_CSKS like CSKS,
wa_CSKSP like CSKSP.
Select LOGSYSTEM KOSTL KOKRS from CSKS INTO wa_CSKS
WHERE LOGSYSTEM = wa_CSKSP-LOGSYSTEM,
AND KOSTL = wa_CSKSP-KOSTL,
AND KOKRS = wa_CSKSP-KOKRS. .
if sy-subrc NE 0.
MESSAGE E101(ZST1).
endif.
Endselect.
Can you help me please?
Thx,
Moh.
‎2009 Apr 20 11:08 AM
Hi,
Try with this code
Select LOGSYSTEM KOSTL KOKRS from CSKS INTO wa_CSKS
WHERE LOGSYSTEM = ICSKSP-LOGSYSTEM.
" OR
Select LOGSYSTEM KOSTL KOKRS from CSKS INTO wa_CSKS
WHERE LOGSYSTEM = wa_CSKSP-LOGSYSTEM.
" Check if any of these select query works.Regards,
Siddarth
‎2009 Apr 20 10:52 AM
So what doesn't work?
1. Is enhancement called?
2. Is there no display of the error message.
3. Error message displayed, but user can change it anyway?
4.....?
‎2009 Apr 20 11:00 AM
the enhancement is called but each fields. I want it test only the LOGSYSTEM field not all of my screen.
‎2009 Apr 20 11:11 AM
Enhancement may be called evrytime but your check fails(error msg) only if the Logical system is changed right?
so no need to bother if the enhancement is called everytime.
Are you able to check the change?
Also check that wa_CSKSP contains values .
Import param of that exit is a table type you should loop it.
Rhea.
‎2009 Apr 20 11:08 AM
Hi,
Try with this code
Select LOGSYSTEM KOSTL KOKRS from CSKS INTO wa_CSKS
WHERE LOGSYSTEM = ICSKSP-LOGSYSTEM.
" OR
Select LOGSYSTEM KOSTL KOKRS from CSKS INTO wa_CSKS
WHERE LOGSYSTEM = wa_CSKSP-LOGSYSTEM.
" Check if any of these select query works.Regards,
Siddarth
‎2009 Apr 20 11:11 AM
‎2009 Apr 20 11:15 AM
Why exactly you require to loop in your internal table......
if u just want to check for logsystem....
if there is a requirement of checking the logsystem of all the rows in the internal table then probably you can loop into an internal table or you can also use
select logsystem from CSKSP
for all entries in internal_table
where logsystem = internal_table-logsystem.Regards,
Siddarth
‎2009 Apr 20 11:23 AM
‎2009 Apr 20 11:24 AM
‎2009 Apr 20 11:41 AM
when I write this code and I activate it I have the following error message
Field list without INTO clause is not allowed.. allowed ...
‎2009 Apr 20 11:43 AM
Hi,
use this one
data t_itab like table of wa_csks.
select logsystem from CSKSP
into table t_itab
for all entries in internal_table
where logsystem = internal_table-logsystem.
‎2009 Apr 20 11:47 AM
Your code should be something like this.
Select single LOGSYSTEM KOSTL KOKRS from CSKS INTO wa_CSKS
WHERE LOGSYSTEM = wa_CSKSP-LOGSYSTEM,
AND KOSTL = wa_CSKSP-KOSTL,
AND KOKRS = wa_CSKSP-KOKRS. .
if sy-subrc NE 0.
MESSAGE E101(ZST1).
endif.
Endselect.
Rhea.
Edited by: rhea on Apr 20, 2009 12:48 PM
‎2009 Apr 20 12:46 PM
Do you know why I receive also this message when I want to create a cost number. I should normally receive my error message only on the modification screen.
Anyone have an idea?
Thank you,
Moh.
‎2009 Apr 20 12:50 PM
usually exits are triggered for both creatio and changing;
If u want to trigger only for change then put this check
if sy-tcode EQ 'KS02'.Rhea.
‎2009 Apr 20 12:51 PM
Hi,
for the cost number you will not receive your message it will give the message which is generated by the program when it is validating.....
just try to debug your program and just check which code and in which sequence gets executed you enter cost center and also check if your select query also gets executed at that point of time....
Regards,
Siddarth