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: 

Table maintenance

Former Member
0 Kudos
404

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

1 ACCEPTED SOLUTION

Former Member
0 Kudos
218

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

13 REPLIES 13

former_member223537
Active Contributor
0 Kudos
218

Hi,

1. You need to create a authorization group. Pls. refer this thread

2. Goto SE80. Select Function Group and enter your table name. Entire auto generated program would be displayed. Change the code as per your requirement

Best regards,

Prashant

Message was edited by: Prashant Patil

Former Member
0 Kudos
218

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

Former Member
0 Kudos
218

hi,

small correction..

SY-UNAME and not sy-usname..

Former Member
0 Kudos
218

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.

Former Member
0 Kudos
218

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

Former Member
0 Kudos
218

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.

0 Kudos
218

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

Former Member
0 Kudos
218

Do you want to check the field while creating the data or do you want to check while saving the data..

Thanks,

Naren

0 Kudos
218

What is the difference Narendran?

Former Member
0 Kudos
218

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

0 Kudos
218

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

Former Member
0 Kudos
219

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

0 Kudos
218

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!