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

Validating records into a maintenance view

gastn_jareo
Active Participant
0 Likes
759

Hi folks!

I have a simple Z table (say ZTABLE) and a Z view based on it with some related description (say ZVIEW). The ZTABLE has a DEC field (called COEF) with 2 decimals and it should have only numbers between 0 and 1.

I set the valid interval from 0 to 1 but, as help says, it's only checked for CHAR, NUMC, DEC, INT1, INT2 and INT4 data types. Not for DEC.

Then I use an event on ZVIEW. On SE11 I went to "Table maintenance generator" - Environment - Modification - Events. So there I put the 05 event (Creating a new entry) and I programed the check. It works fine for new entries, but if you have a record on table and you want to change the COEF field you can put there any number, even outside the 0-1 range.

I tried with the 01 event (Before saving the data in the database) but it seams to be called only for last record.

Could anybody tell me what can I do?

Thanks!

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
672

Hi,

Since it is a Z TABLE..

You can directly modify the flow logic in SE51.

Go to SE51

Give the program name - SAPL + Function group name

Screen number

Press change..

In the flow logic..

Add a module after the FIELD ztable-number, in the PAI event..

Ex..

FIELD ZTABLE-NUMBER MODULE NUMBER_CHECK.

And in the module validate the number..

MODULE NUMBER_CHECK INPUT.

IF ZTABLE-NUMBER <> '0' OR

ZTABLE-NUMBER <> '1'.

MESSAGE E208(00) WITH 'Not a valid number'.

ENDIF.

ENDMODULE.

Thanks,

Naren

Hi folks!

I have a simple Z table (say ZTABLE) and a Z view based on it with some related description (say ZVIEW). The ZTABLE has a DEC field (called COEF) with 2 decimals and it should have only numbers between 0 and 1.

I set the valid interval from 0 to 1 but, as help says, it's only checked for CHAR, NUMC, DEC, INT1, INT2 and INT4 data types. Not for DEC.

Then I use an event on ZVIEW. On SE11 I went to "Table maintenance generator" - Environment - Modification - Events. So there I put the 05 event (Creating a new entry) and I programed the check. It works fine for new entries, but if you have a record on table and you want to change the COEF field you can put there any number, even outside the 0-1 range.

I tried with the 01 event (Before saving the data in the database) but it seams to be called only for last record.

Could anybody tell me what can I do?

Thanks!

3 REPLIES 3
Read only

Former Member
0 Likes
673

Hi,

Since it is a Z TABLE..

You can directly modify the flow logic in SE51.

Go to SE51

Give the program name - SAPL + Function group name

Screen number

Press change..

In the flow logic..

Add a module after the FIELD ztable-number, in the PAI event..

Ex..

FIELD ZTABLE-NUMBER MODULE NUMBER_CHECK.

And in the module validate the number..

MODULE NUMBER_CHECK INPUT.

IF ZTABLE-NUMBER <> '0' OR

ZTABLE-NUMBER <> '1'.

MESSAGE E208(00) WITH 'Not a valid number'.

ENDIF.

ENDMODULE.

Thanks,

Naren

Read only

0 Likes
672

It worked well! Thanks!

But I have a little more question to understand exactly what I did:

On this example whats the difference between doing this?:

FIELD ZTABLE-NUMBER MODULE NUMBER_CHECK.

and doing this?:

FIELD ZTABLE-NUMBER.

MODULE NUMBER_CHECK.

The MODULE should be on the last screen field or on the field I want to check? On my example the last one is the field to check.

Very thanks again!

Read only

Former Member
0 Likes
672

Hi,

The difference between

FIELD ZTABLE-NUMBER MODULE NUMBER_CHECK.

FIELD ZTABLE-NUMBER.

MODULE NUMBER_CHECK.

Is if there is any error in the field..

The second will block all the fields for input..

The first will open the NUMBER field for input and block all the other fields..

Thanks,

Naren