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

Mandatory field in data dictionary

Former Member
0 Likes
2,219

Hi,

I have created a ztable and did table maintainance generator. Even though first 3 fields are primary keys but still system is allowed to store the entries without any value (blank). pls suggest how to make it mandatory?

thanks,

Pradeep

1 ACCEPTED SOLUTION
Read only

manuel_bassani
Contributor
0 Likes
1,891

Hi Pradeep,

if you don't want blank entries you can

- set the allowed values in the field domain

- if the table can only be modified by the maintainance view, modify the logic flow of the screen (insert a module in which you check the values and display an error message if the user inserts a blank value)

Regards, Manuel

Hi,

I have created a ztable and did table maintainance generator. Even though first 3 fields are primary keys but still system is allowed to store the entries without any value (blank). pls suggest how to make it mandatory?

thanks,

Pradeep

12 REPLIES 12
Read only

Former Member
0 Likes
1,890

Hi,

It is possible to create one line as blank line,but not one more.

Read only

Former Member
0 Likes
1,890

Hello Pradeep,

field entry mandatory( shud not left blank)

This cannot be done in SE11 while creating a table.

This needs to be done in screen painter.

regards,

Kinshuk Saxena

Read only

Former Member
0 Likes
1,890

you have to add your own custom checks in table maintenance by modifying the generated code. Go to the screen editor and create your own module in PAI and create a z include and add ur validations there.

Read only

manuel_bassani
Contributor
0 Likes
1,892

Hi Pradeep,

if you don't want blank entries you can

- set the allowed values in the field domain

- if the table can only be modified by the maintainance view, modify the logic flow of the screen (insert a module in which you check the values and display an error message if the user inserts a blank value)

Regards, Manuel

Read only

0 Likes
1,890

Hi Manuel,

Thanks for the answer. it will be great if you could let me know where to do add the pai (own logic). I am able to write the code but do't know where to write.

Thanks,

Pradeep

Read only

0 Likes
1,890

Hi,

- Se11 -> Modify

- choose Utilities -> Table maintenance generator (i presume that a maintenace view already exists)

- Environment -> Modification -> Maintenace screen

- Double click on dynpro number

- Inside the LOOP statement (because you have to check all the entries) for example just before the ENDLOOP statement, insert:


FIELD ZFIELD.
  MODULE CHECK_ZFIELD.

Regards, Manuel

Read only

0 Likes
1,890

Hi Manuel,

As you suggested I have added the code but during debugging still system is not able to recognised this module "MODULE CHECK_ZPRPTN1_SPART INPUT."

Code is given below :

Flow Logic :

**

PROCESS AFTER INPUT.

MODULE LISTE_EXIT_COMMAND AT EXIT-COMMAND.

MODULE LISTE_BEFORE_LOOP.

LOOP AT EXTRACT.

FIELD ZPRPTN1-SPART .

MODULE CHECK_ZPRPTN1_SPART.

endloop.

-


code in include is :

MODULE CHECK_ZPRPTN1_SPART INPUT.

IF ZPRPTN1-spart eQ ' '.

MESSAGE E000(VA) WITH 'PLS FILL VALUE'.

EXIT.

ENDIF.

ENDMODULE. " MODULE CHECK_ZPRPTN1_SPART

-


Pls suggest how to resolve this problem.

Thanx,

Read only

0 Likes
1,890

Try with

IF ZPRPTN1-spart <b>IS INITIAL</b>.

Sudha

Read only

0 Likes
1,890

system is not going at if condition during debugging.

Read only

0 Likes
1,890

Here is a way. Go to SE54. Enter you table name. In the menu, 'Environment-->Events'. Hit 'enter' on the subsequent popup warning. In the next screen, you will see a table control with three columns. First one is 'T' and the next one is 'FORM routine' and the last one is 'Editor'. Click on 'New Entries' button. Enter '01' in the column 'T' and 'VALIDATE_BEFORE_SAVE' under the 'FORM routine' column. I am just taking an example here, but the name can be anything. What is important is the 01.

Now click on the source code icon that appears in the third column. Next you will get a popup asking for the include name where you want to write the code for this routine. This include will be part of your function group's main program. Once you are in the editor, use the following code for validating the blank values.


FORM validate_before_save.

  DATA: BEGIN OF s_myztable.
          INCLUDE STRUCTURE zmyztable.
          INCLUDE STRUCTURE vimtbflags.
  DATA: END OF s_myztable.

  LOOP AT total.
    CLEAR s_myztable.
    MOVE total TO s_myztable.
*-- only if it is not marked for deletion
    CHECK s_myztable-vim_action <> neuer_geloescht.
    IF s_myztable-keyfield1 IS INITIAL OR
       s_myztable-keyfield2 IS INITIAL.
      MESSAGE i000 WITH 'Key Field1 and Key Field2 cannot be blank.'.
      sy-subrc = 4.
      EXIT.
    ENDIF.
  ENDLOOP.

ENDFORM.                                    " VALIDATE_BEFORE_SAVE

Read only

0 Likes
1,890

Hi Manuel,

problem got resolved, thanx a lot.

Rgds,

Pradeep

Read only

0 Likes
1,890

Hi Pradeep,

can u tell me the code or explain what u have done as i have the same issue.

Thanxs in advance.