2006 Sep 21 10:54 AM
Hi All,
I am creating a custom table.
1. Can the restriction be applied for only particular users?
If so how?
2. When the data is saved i need to validate the data by cross checking the existing data. How and where can it be done.
Say for e.g there are two fields valid from and valid to.
There should not be two records overlaping the date range.
How do i do it in the table maintenance?
If this is not possible with Table maintenance, then i would have to write a seperate program.
uselful ans will be awarded
thanks
2006 Oct 02 6:12 AM
Hi,
Creating a new entry 05 means when a new entry is created in the screen and not in the database. They can even cancel and choose not to save it..
But the event 01 is called before saving the data...
TO access the field you have to do the following..
DATA: BEGIN OF WA.
INCLUDE STRUCTURE ZTABLE.
INCLUDE STRUCTURE VIMTBFLAGS.
DATA: END OF WA.
For 05 event
-
wa = <table1>.
if wa-field_name..
....
endif.
For 01 event
-
LOOP AT TOTAL.
WA = TOTAL.
if wa-fielname.
.....
endif.
ENDLOOP.
You have to move the values to the work area WA to access the fieldnames...You cannot directly use TOTAL-FIELDNAME OR <TABLE1>-FIELD..As it will give you a syntax error.
THanks,
Naren
2006 Sep 21 10:58 AM
2006 Sep 21 11:01 AM
hello,
u can do validations for table entries done vai SM30. u can do this in the program for table maintenance.
1. go to se11
2. utilities -> table maintenance generator. or SE55
3. now environment -> modifications -> events
here u can select event '05' for validations to be done before saving an entry into DBtable.
u can also check for the user like
IF SY-USNAME NE 'XXX'...
write back for more details..
reward if useful..
2006 Sep 21 11:03 AM
2006 Sep 21 11:07 AM
Hi,
Point no.2 can be done. Use se80 to view your table maintenance's function group. From here search for screen no. 1000(i can not remember, as long as the screen no. use to capture the manual input). Double click into the screen no. you will get to the screen's flow logic. Put your additional module within PAI's LOOP AT xxx. ENDLOOP. And code you validation under this module.
2006 Sep 21 11:09 AM
Hi,
1) BASIS can restrict user for creating
table using SE11 transaction using authorization
object
2) you can write your validations in table
maintainence screen in PAI block
of the Function group
Regards
amole
2006 Sep 21 12:13 PM
Hi ,
For the custom table you are creating a program SAPZ<customtable name> will be created. You can go to the program create a Z include(Z*SODB) and inside that write your validation in Module End module.
Regards,
Balaji.
2006 Oct 02 5:04 AM
thanks all for your valuable inputs.
I want to know how to access the current field entry while validating.
And i am thinking of using 01 event to write my select stmnt. if successful i do nothing, which means it would save the entry, if error then i say EXIT so that this entry is not saved and i write a error msg. please correct me.
thanks
2006 Oct 02 5:11 AM
Do you want to check the field while creating the data or do you want to check while saving the data..
Thanks,
Naren
2006 Oct 02 5:46 AM
2006 Oct 02 5:50 AM
If you are using the event '05' (Creating a new entry) you have to use the variable <table1> to get the current value..
if you are using the event '01' (Before saving the data) you have to use the internal table TOTAL to get the values...
Thanks,
Naren
2006 Oct 02 6:06 AM
Thanks Narendran,
But creating a new entry means saving the data right?
Wht is the diff in 05 and 01.
I want to validate user data before saving, and return an error if invalid. which one should i use.
Also for 05 i shoudl use
<table1>-fieldname ?
for 01.
total-feildname ?
thanks
Shashi
2006 Oct 02 6:12 AM
Hi,
Creating a new entry 05 means when a new entry is created in the screen and not in the database. They can even cancel and choose not to save it..
But the event 01 is called before saving the data...
TO access the field you have to do the following..
DATA: BEGIN OF WA.
INCLUDE STRUCTURE ZTABLE.
INCLUDE STRUCTURE VIMTBFLAGS.
DATA: END OF WA.
For 05 event
-
wa = <table1>.
if wa-field_name..
....
endif.
For 01 event
-
LOOP AT TOTAL.
WA = TOTAL.
if wa-fielname.
.....
endif.
ENDLOOP.
You have to move the values to the work area WA to access the fieldnames...You cannot directly use TOTAL-FIELDNAME OR <TABLE1>-FIELD..As it will give you a syntax error.
THanks,
Naren
2006 Nov 27 7:47 AM
Hello,
I am trying to use your example, but , for event 01 (before save) , I always set an short dump at the wa = total statement.
The error is UC_OBJECTS_NOT_CONVERTIBLE.
Do you have any ideea what's happening?
I saw that I am not the only one with this problem here...
Thank you in advance!