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

Modify Column attributes in the Table Maintenance Generator

Former Member
0 Likes
7,250

I have an existing Table Maintenance View that was built earlier for a custom table. 

1st requirement: make BRAND, PROGRAMID, and PROGNAME all required fields (the row should not be saved without a non-blank, non-null entry being put in any of these columns).  Currently, you can enter data in some and leave one or more blank.

2nd requirement: PROGRAMID should not allow any duplicate values.

On the Fields tab of this table, MANDT, BRAND, and PROGRAMID are selected for Key and Initial Value.

How can I adjust the TMG to meet these requirements?

Thank you

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
4,586

1st requirement: make BRAND, PROGRAMID, and PROGNAME all required fields (the row should not be saved without a non-blank, non-null entry being put in any of these columns).  Currently, you can enter data in some and leave one or more blank.

Go to Table Maintenance --> Environments --> Modification --> Maintenance screens

Choose screen number --> Go to Layout Editor

Choose columns BRAND; on Attribute choose tab Program; Choose Input fields Required

Do the same for PROGAMID and PROGNAME.

After that, i should require user to enter value for those fields before they can save entry.

2nd requirement: PROGRAMID should not allow any duplicate values.

You should follow PRAVEEN PATIL.

I have an existing Table Maintenance View that was built earlier for a custom table. 

1st requirement: make BRAND, PROGRAMID, and PROGNAME all required fields (the row should not be saved without a non-blank, non-null entry being put in any of these columns).  Currently, you can enter data in some and leave one or more blank.

2nd requirement: PROGRAMID should not allow any duplicate values.

On the Fields tab of this table, MANDT, BRAND, and PROGRAMID are selected for Key and Initial Value.

How can I adjust the TMG to meet these requirements?

Thank you

14 REPLIES 14
Read only

arindam_m
Active Contributor
0 Likes
4,586

Hi,

If its a custom table maintenance generator. Why don't you try to put in events to validate the entries before they are created. Also the below requirement

make BRAND, PROGRAMID, and PROGNAME all required fields

You can do this by making them key fields in the table.

Cheers,

Arindam

Read only

Former Member
0 Likes
4,586

Hello,

Thanks for the response.  BRAND and PROGRAMID are already keys, but accept blank entries in SM30 for this table. 

I read some posts about the PBO events that I might be able to edit to adjust logic for various requirements with regards to validation.  I haven't worked that kind of validatin in the PBO event of a TMView before.  Do you know of a good tutorial/post regarding how to handle custom column validation in the PBO of the maint. screen.  CHecking google....

Thank you!

Read only

ronaldo_aparecido
Contributor
0 Likes
4,586

This message was moderated.

Read only

Former Member
0 Likes
4,586

HI Jeremy,

Even if you make table fields as key and Non Initial table will allow all unique primary keys . When Brand has value and other two does not have value it is a valid primary key. You have to implement events for your requirement and you have to check whether the fields are initial and if they are initial they gave a error message.

Hope this is helpful.

Thanks,

Vinay

Read only

Former Member
0 Likes
4,586

Hi Jeremy,

You can achieve this by maintaining the events before it got saved in the DB table.

Let me know if any clarification/help required.

Thanks & Best Regards.

Pavan Neerukonda.

Read only

Former Member
0 Likes
4,586

Hi,

There are many events in TMG using which you can achieve your requirements.

In SE11 Goto Table Maintainance Generator

Environment -> Modification -> Events

Choose the event and write appropriate code.

Regards,

Praveen

Read only

Former Member
0 Likes
4,587

1st requirement: make BRAND, PROGRAMID, and PROGNAME all required fields (the row should not be saved without a non-blank, non-null entry being put in any of these columns).  Currently, you can enter data in some and leave one or more blank.

Go to Table Maintenance --> Environments --> Modification --> Maintenance screens

Choose screen number --> Go to Layout Editor

Choose columns BRAND; on Attribute choose tab Program; Choose Input fields Required

Do the same for PROGAMID and PROGNAME.

After that, i should require user to enter value for those fields before they can save entry.

2nd requirement: PROGRAMID should not allow any duplicate values.

You should follow PRAVEEN PATIL.

Read only

Former Member
0 Likes
4,586

Thank you for this information so far everyone.  I'm new to this TMG data validation, though and I don't follow all of the guidance.  I've been looking for a more step by step example that can help me, but I didn't find many.

To follow Thien and others above, if I try the 1st requirement, I get to Layout Editor, but I don't see the "Attribute choose tab Program; Choose Input fields Required" setting/area within the Screen Painter.  (see my image below from within the TMG maintenance screen).


I failed at my attempte to followi Praveen Patil's instructions yet for the 2nd requirement.  When I used event "01 Before Saving Data in the database, I got lost on how to write that code against the TOTAL table.  (It wanted to create and include, which I didn't but SM30 dumped after I activated my INCLUDE with my code attempt.

For requirement 1:



Read only

Former Member
0 Likes
4,586

Just following up as I explored the TMG Maintenance Screen for my "Input Required" attribute requirement number 1 mentioned above.  At first I didn't see the Attributes button and the Program tab for that column, but I found it.  Now the challenge is that the Input attribute and the Input Box with the drop-down for "Required" are both grayed out and I cannot change them.  What setting is driving this?  I will begin looking more online, but hopefully one of you can answer this as well?  Thanks!  

Read only

Former Member
0 Likes
4,586

Again, thank you all for the help.  I have figured out the input field attribute settings in the Maintenance Screen after poking around a little (you have to place your cursor on one of the blanks in the column (not on the heading).  So you've all helped me get requirement 1 finished.

As for requirement 2:  Not allowing duplicates to be entered in the Program ID column.  Can someone help me with the code to write against the TOTAL table for the 01 Event that I created?  The maintenance view now no longer dumps on my new include (i figured that part out), but I haven't written this kind of code before.  Perhaps some breakpoints will help me figure out how not to allow duplicate values.  Any help would be great.

Thanks!

Read only

0 Likes
4,586

Hi Jeremy,

It's quite complicated when you want to restrict user don't input duplicate entries for one of many key fields. You must do the check against database as well as in table control. And key fields are combination of 2 fields not only one. I think you should ask the Business Analysis person to simplify the requirements. Otherwise, you have to know how to compare entries within table control.


Good luck,

Thien

Read only

ronaldo_aparecido
Contributor
0 Likes
4,586

This message was moderated.

Read only

0 Likes
4,586

Hi Jeremy,

For duplicate entry

Create a routine with event 01

Then when in source code you can put a query on your z table itself please see below mention code

Always in event you have a work area of same name of your table like here my table name is ZDJ_PRAC so there is a work area of same name and type ZDJ_PRAC which contain the new entry using which you can put a query on your z table in where clause just pass the programid = <table name>- program id and you can check like I did and display error message also.

In case of mutiple new entries use extract table present which contain the new entries and use it for checking duplicate entry.

Hope it will be helpfull.

Regards,

Deepak Jain.

Read only

Former Member
0 Likes
4,586

Thank you, everyone, for the help here.  Deepak, I will try variations of the code you suggested in my 01 Event.  I may need to bring in the EXTRACT table as well (potential multiple entries are always a possibility, I suppose), but I'll figure it out.

Thank you

Regards,

Jeremy