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

Test Logical System Field

mrahhaoui
Participant
0 Likes
2,374

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.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,211

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

14 REPLIES 14
Read only

Sm1tje
Active Contributor
0 Likes
2,211

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.....?

Read only

0 Likes
2,211

the enhancement is called but each fields. I want it test only the LOGSYSTEM field not all of my screen.

Read only

Former Member
0 Likes
2,211

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.

Read only

Former Member
0 Likes
2,212

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

Read only

0 Likes
2,211

Do I need also to loop in my internal table?

Read only

0 Likes
2,211

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

Read only

0 Likes
2,211

Why you do your select from CSKSP and not CSKS?

Read only

0 Likes
2,211

oh sorry that was a typing mistake....

Read only

0 Likes
2,211

when I write this code and I activate it I have the following error message

Field list without INTO clause is not allowed.. allowed ...

Read only

0 Likes
2,211

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.

Read only

0 Likes
2,211

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

Read only

0 Likes
2,211

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.

Read only

0 Likes
2,211

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.

Read only

0 Likes
2,211

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