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: 

Checking for values in a check table with an interval

Former Member
0 Kudos
281

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

1 ACCEPTED SOLUTION

former_member181962
Active Contributor
0 Kudos
122

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

4 REPLIES 4

former_member181962
Active Contributor
0 Kudos
123

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

0 Kudos
122

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

0 Kudos
122

I suppose you are doing a table maintenance for your Z Table.

If yes, you can have a look at this thread to get an Idea :

Regards,

Ravi

0 Kudos
122

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.