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

checks in SM30 - problem

Former Member
6,630

Hi ALL,

hope all are doing fine!!!

am entering records in the database table through table maintenance in sm30,,,,,before that am checking the entries entered in sm30 are valid or not. for that am using the event 01 before_save ....so that entries will be validated and only valid entries will be recorded in the database table.

now the problem is even the invalid entries are also recorded in the db table ,,, for which i have written the code in the 01 event ( before_save routine) under table maintanence events for validating the entries......

pls. help me outt

any solutions from which i can get rid off will be highly appreciated

thanks

jack

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
4,168

Hi,

Try using event 05,creatinf new entry and i dont think before save is useful...

Please debug and check by putting break point in the event ,when it stops in ur event checkwhether standard table total is filled with all the gud and bad records if yes then u have to delete the bad record from total by looping on it.As deleting from total is not possible set an indicator <action>

in ur event as 'D' to delete the entry.

Then u hav to use after save event also there in u copy from total to extract so that right entries are displayed after save.

please revert if any thing's not clear,

regards,

DInesh.

Hi ALL,

hope all are doing fine!!!

am entering records in the database table through table maintenance in sm30,,,,,before that am checking the entries entered in sm30 are valid or not. for that am using the event 01 before_save ....so that entries will be validated and only valid entries will be recorded in the database table.

now the problem is even the invalid entries are also recorded in the db table ,,, for which i have written the code in the 01 event ( before_save routine) under table maintanence events for validating the entries......

pls. help me outt

any solutions from which i can get rid off will be highly appreciated

thanks

jack

19 REPLIES 19
Read only

Former Member
0 Likes
4,168

Hi,

for table maintenance generator a Function group must be used. Go to that function group and add a new include. In that include add a routine for checking the entry

For example

  • Give error message in case table ZSD_TST is entered with no value in field bukrs.

if zsd_tst-bukrs eq ' ''.

message e398(00) with text-t01.

endif.

in the screen flow logic add following

field zsd_tst-bukrs module c_check.

this will help you.

anya

Read only

0 Likes
4,168

hi anya,

i have written subroutine in the top include of the function group under the table maitenance event 01(before saving in the database).

is it feasible to write the validations / checking for valid entries which are entered in the sm30 in any include of the function group??? in my case i have written logic in the top include of the function group?

thanks

jack

Read only

0 Likes
4,168

You may insert your FORMs in any include of the function group, traditionally TOP include is for global data, and L&lt;fg&gt;Fnn are for forms, but it should work.

  • Did you set sy-subrc to a not initial value in your form (if an error occurs of course)

  • Did you activate include and whole FG

  • Did you check (debug) that the event form is called when inserting/changing data

Regards

Read only

0 Likes
4,168

hi raymond,

thanks for the response,,

i have included the sub-routine under the event 01 under top include of the function group,,,,

am checking the sy-subrc value also in that routine,,but even its updating the database

.....my requirement is i have 3 fields in a table ,, am entering values for those 3 fields( either 1 record or muliplte records) in sm30,,,,,,after entering the values am clicking the save ,,as and when i press the save button ,, we should validate those entries i.e.,, for example vkorg is present in tvko or not,,if present then i have to insert the record or else to need to by-pass the record and move to next.....but in my case every record is updating in the database.

thanks

jack

Read only

0 Likes
4,168

For this kind of check, use a foreign key in the table definition ZTABLE-VKORG with TVKO-VKORG, the generated program will check the data itself.

I don't think it is possible to update some of the input records bypassing some as may suggest your answer ?

Regards

Read only

0 Likes
4,168

Hi Raymond,

Thanks for the response!!!!

as mentioned in my previous message ,,the problem for checking/validating entries is SM30 is almost solved,, but now am unable to correct the wrong value for the input disabled field,,,,which is clearly mentioned in my previous message to Dinesh...can u pls. suggest me any sol. for this???

Thanks

Jack

Read only

0 Likes
4,168

Once the maintenance dialog has checked the key fields, there are no longer input-able, so you really should use foreign keys or domain with restrictive values list, so the check will be processed by the program in-time, the exit provided are called too late (just before saving or at creation of record)...

Regards

Read only

0 Likes
4,168

Hi Raymond,

thanks for the response!!!

i think ur not getting my query....

am explaining my problem once again

in the transaction am making entries in 3 fields ,,,,whenever i enter some wrong values in all the 3 fields ;;all fields except 3rd field will be input disabled(i.e,, we cannot change the wrong value) ,,,and the first 2 fields are always input enabled even if we enter wrong values in the transaction since they are key fields in the table,, but 3rd field is not key field and its input disabled ,,,, and i cannot make 3rd field as key field as per the requirement ,,,i can enter the value in 3rd field only when i cancel the transaction and come back...... so any suggestions to make 3rd field as input enabled even after entering wrong values also and without cancelling the transaction....?????

Thanks alot for ur time in Advance

Jack

Thanks

Jack

Read only

dev_parbutteea
Active Contributor
0 Likes
4,168

Hi,

Put your codes in event 05.

Read only

0 Likes
4,168

hi dev,

i have put the code in the event 05 ( create_entry) ,but even if sy-subrc eq 0 or not,,its updating the database table ..and that should not happen

thanks

jack

Read only

0 Likes
4,168

Hi,

If sy-subrc ne 0.

"display error message.

endif.

If you display an error message , it should not allow to save the record unless it is corrected.

Read only

0 Likes
4,168

hi dev,

i have tried using error message ,but its getting failed and instead am getting a message "The selected function is not possible" in the sm30 screen,,

thanks

jack

Read only

Former Member
0 Likes
4,169

Hi,

Try using event 05,creatinf new entry and i dont think before save is useful...

Please debug and check by putting break point in the event ,when it stops in ur event checkwhether standard table total is filled with all the gud and bad records if yes then u have to delete the bad record from total by looping on it.As deleting from total is not possible set an indicator <action>

in ur event as 'D' to delete the entry.

Then u hav to use after save event also there in u copy from total to extract so that right entries are displayed after save.

please revert if any thing's not clear,

regards,

DInesh.

Read only

0 Likes
4,168

hi dinesh,,

thanks for the response,,

first i have used event 05 ( create_entry) but even then invalid entries were updating the database....

then rite now am using 01(before_save) here am unable to access total ,,,,,but i can see the values of total in the debug mode...

am writing the form routine in the top_include.....am unable to access total !!!

any example reg. the same (i.e, validating/checking entries which are maintained thru sm30 before updating in the database ) would be highly appreciated

request you to revert back if you have any clarifications on my requirement

thanks

jack

Read only

0 Likes
4,168

Hi ,

its working with create new and before save or after save.

what u can do is put all ur validations in new entry event and copy all the data from total to a temporary table

which is declared in global with the same strucutre as total. then in the before save event loop at the temporaary table because u said u cant read total, change the flag <action>

to 'D' by looping it.

This must work if not just add after save event and then in the after save event copy data from total to extract..

it should work definetely...

Read only

0 Likes
4,168

hi dinesh,,

thanks alot

its working now....

but in the transaction am making entries in 3 fields ,,,,whenever i enter some wrong values in all the 3 fields ;;all fields except 3rd field will be input disabled(i.e,, we cannot change the wrong value) ,,,and the first 2 fields are input enabled even if we enter wrong values in the transaction since they are key fields in the table,, but 3rd field is not key field and its input disabled ,,,, and i cannot make 3rd field as key field as per the req. ,,,so any suggestions to make 3rd field as input enabled even after entering wrong values also....?????

thanks

Jack

Read only

Former Member
0 Likes
4,168

Hi,

check with following link for table maintanance events

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/8129f164-0a01-0010-2a8e-87652872...

Regards,

Madhu

Read only

Former Member
0 Likes
4,168

How many screens do you have in Table maintenance generator ( 1 or 2)

I hope u r having 1 screen, in that case you can write the piece of code in the screen and stop processing using a error message.

in case 2 screen...05 event will do with error message

Read only

0 Likes
4,168

hi sayan,

thanks for the response

am using 1 screen ,,and also am using error message message e..................but am getting "the selected function is not possible"....

rite now am not using 2 screen..is using 2 screen will effect the processing of the results

thanks

jack