2008 Jun 16 4:05 PM
Hi experts,
I have a Z table with a check table(T706B1) for the field SPKZL, it also has a BEGDA(Begin date) and ENDDA(end date). What I want to do is when inserting new data the table would verify if the fields BEGDA and ENDDA in my Z table are in the corresponding intervals of the field SPKZL in the check table(T706B1- also named BEGDA and ENDDA), if they aren't in the interval it should not allow the new entry to be inserted.
Is there any way to do this?
Thank You
David Pereira
2008 Jun 16 4:10 PM
Try this:
select single *
from T706B1
where MOREI = ztable-MOREI
and SPKZL = ztable-SPKZL.
if sy-subrc = 0.
if T706B1-BEGDA <> ZTABLE-BEGDA or
T706B1-ENDDA <> ZTABLE-ENDDA.
message e001(zz) with 'Invalid entry'.
endif.
endif.
Regards,
Ravi
2008 Jun 16 4:10 PM
Try this:
select single *
from T706B1
where MOREI = ztable-MOREI
and SPKZL = ztable-SPKZL.
if sy-subrc = 0.
if T706B1-BEGDA <> ZTABLE-BEGDA or
T706B1-ENDDA <> ZTABLE-ENDDA.
message e001(zz) with 'Invalid entry'.
endif.
endif.
Regards,
Ravi
2008 Jun 16 4:15 PM
Thank you for the quick answer!
Now I have another question, where should I put the code? I'm new to check tables and I don't know where to put the code you suggested.
David Pereira
2008 Jun 16 4:26 PM
2008 Jun 16 4:46 PM
I'll go try it out, if it works i'll give points, if not i'm back with more questions!
Thank you for your help.