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: 

Make a field mandatory in custom table

Former Member
0 Kudos

Hello,

Can anyone tell me how we can make fields mandatory for a custom table, i.e. when the user enters values manually using SM30 i want these fields to be mandatorily filled before saving data.

Thanks,

David.

1 ACCEPTED SOLUTION

Peter_Inotai
Active Contributor
0 Kudos

You might try to use events. Display maint generator menu Enviroment->Midfication->Events

Try event 21, create your own form something like this:

FORM validate_data.

*======================================================================*
* Validation of COMPANY_CODE
  IF zmytable-company_code IS INITIAL.
*   Enter company code
    MESSAGE e430(fb).
  ENDIF.
...
ENDFORM.                    "VALIDATE_DATA

Peter

16 REPLIES 16

former_member181966
Active Contributor
0 Kudos

Go to SE56->Give your "view OR table name" "change " Envirmnet->modification->maintance screen->pop-up will come , click on the screen number ->( it’ll open SE51) click->Layout -> double click on your field ->select "required*........

After that Backout and activate the program and check SM30

Give 10 points and close the thread

Hope this’ll give you idea!!

<b>P.S award the points.</b>

Good luck

Thanks

Saquib Khan

"Some are wise and some are otherwise"

Former Member
0 Kudos

Hi Saquib,

That was a good answer, but when i go to click->Layout -> double click on your field ->select "required*....... There is nothing like Required there..when i click the program tab evrything is greyed out the 'input' 'output' n all..Can you tell me exactly were we have to do this required thing..

Thanks in advance,

David.

0 Kudos

did you change the layout ( with pencil button )

click->Layout -> double click on your field -> a pop-up will come ... ( that windows called Screen painter attributes ) It will have your field name ,line,column,Groups,at th bottom of screen you`ll see <u><b>Dict, Program,display tabs</b></u>,click Program tab-? you`ll see Input with drill down <u><b>values "Possible , not possible, and also required</b></u> ,click required and activate the screen . After that backout and run SM30.

Hope this’ll give you idea!!

<b>P.S award the points.</b>

Good luck

Thanks

Saquib Khan

"Some are wise and some are otherwise"

0 Kudos

David,

The solution as provided by Saquib and myself is the solution to the functionality that you are looking for.Just go step by step and your problem will be solved.

Close this thread once you are done.

Cheers

Nishanth

Peter_Inotai
Active Contributor
0 Kudos

You might try to use events. Display maint generator menu Enviroment->Midfication->Events

Try event 21, create your own form something like this:

FORM validate_data.

*======================================================================*
* Validation of COMPANY_CODE
  IF zmytable-company_code IS INITIAL.
*   Enter company code
    MESSAGE e430(fb).
  ENDIF.
...
ENDFORM.                    "VALIDATE_DATA

Peter

Former Member
0 Kudos

Hi Peter,

When i goto Modifications->events and i selected 21 and gave it some name..a popup came with some include name when i selected that and enter then it gave me a warning message that a include will be added to program name..AM i doing it correctly??..Do i have to add my code within this include??..

Thanks,

David

0 Kudos

Yes, you're doing it correctly.

The best is create an own include and put your code there, so it's separated from the SAP generated code. Probable you will get an info message about mmodification but you can ignore that one.

Peter

nishanthbhandar
Contributor
0 Kudos

David,

--- Execute transaction SE54.

--- Enter Custom table name and choose generated

objects option

--- click on create/change

--- Choose Environment->Modification->Maintenance Screens

A popup will appear with the screen numbers for view and table maintenance.Click on these screen numbers and it will take you to the screen editor.Here in the special attributes section under Element list make the field that you require as a Required entry.

This will then become a mandatory field to be entered through SM30.

Hope this solves your problem.

Please reward helpful answers.

Cheers

Nishanth

Former Member
0 Kudos

Hi Peter,

I created the Include, but now when i goto SM30 and enter any value for the fields it give me a Short dump saying that the Perform routine not found..Any idea why this happened??..the following is the error message

The current program attempted to call an externally defined routine

that does not exist.

Thanks,

David.

Former Member
0 Kudos

Hi Saquib,

I did all this

click->Layout -> double click on your field -> a pop-up will come ... ( that windows called Screen painter attributes ) It will have your field name ,line,column,Groups,at th bottom of screen you`ll see Dict, Program,display tabs,click Program tab-? you`ll see Input with drill down values "Possible , not possible, and also required ,click required and activate the screen .

Wheni click Program tab everything is greyed out i cant select anything from input..Thats what i wanted ask u why its all greyed out..

Thanks alot for ur help

David.

0 Kudos

Did you change the layout ? ( first change the layout ) and then follow the instructions.

Former Member
0 Kudos

Hi Saquib,

I did click change and then followed ur instructions but still when i click the program tab, everything is greyed out and not allowing me to select from it..Ne idea guys, why this is happening???..

Thanks,

David.

0 Kudos

When you change it and select the field , dont double click is it showing you white ( ready for input ) or greyed ?

Also try one thing , change it at flowlogic level , you can edit code here now ? if yes , then click "layout "

<b>Also try one more thing</b>

After changing the flowlogic , you`ll see three tabs there <b>Atrributes,Elemnet list,flowlogic</b> right ?

Click on <u>Elemnet list</u> You`ll see lots of tab there , click on "<b>Special attr"</b> in third tab which is <b>"input"</b> drill down you`ll find required

Moreover, I`m assuming you have all authrozations (to check Authorization (Tr.SU53) and you`re in editable client. ( Tr.SCC4 )and <u>also by saying custome table you create it ( Z or Y ) and it also has view ?</u>.

0 Kudos

David,

I guess you are not choosing the create/change mode from SE54.Then the objects will appear greyed out.Please choose create/change option in the initial screen.

<b>Please reward helpful answers</b>

Cheers

Nishanth

0 Kudos

David,

Still facing the same problem ?

0 Kudos

Hello,

Can anybody tell me how to validate the data while entering in table maintenance screen ? I wanted to validate data based on certain conditions on custom table. I am using VIEW_MAINTENANCE_CALL thro abap report. Also the user should not be allowed to save the data if the condition failed.

Thnx in advance

Anney