2014 Feb 13 10:21 AM
Hi ABAP Experts,
My Z table has 4 fields.
The Conditions for uniqueness are
1. Filed1 value should be unique.
2. The combination of Fields 2,3 and 4 should be unique.
How do I achieve both these, using Primary keys OR in combination of Primary Key and other methods.
Regards
Jogeswara Rao K
2014 Feb 13 11:18 AM
Hi,
The Conditions for uniqueness are
1. Filed1 value should be unique.
2. The combination of Fields 2,3 and 4 should be unique.
1. Create primary key
2. Create unique index in se11 .
Hi ABAP Experts,
My Z table has 4 fields.
The Conditions for uniqueness are
1. Filed1 value should be unique.
2. The combination of Fields 2,3 and 4 should be unique.
How do I achieve both these, using Primary keys OR in combination of Primary Key and other methods.
Regards
Jogeswara Rao K
2014 Feb 13 10:28 AM
1. For that u will have to use
EVENTS
generated in table maintanance.
2. There u can write your own code,
to validate the entries.
2014 Feb 13 10:29 AM
hi jogeswara,
only one ztabel is required or is there option to creation one another z-table?
regard,
vikas
2014 Feb 13 10:30 AM
Hi,
You can do the validation in events of TMG. Just concatentate the 2nd, 3rd and 4th fields and check in the other records similar combination is there or not. If exists, throw one error message.
Regards,
DPM
2014 Feb 13 10:37 AM
Hi all, I have a doubt will this TMG events get triggered if I am updating/modifying table from ABAP Report???
-Vijay
2014 Feb 13 10:48 AM
Hi,
If you are updating in custom report. Do the validations first and once the data is clean, update the database.
Regards,
DPM
2014 Feb 13 10:51 AM
Hi DPM,
Mine is TMG situation.
I'm in need of a sample code, and the event where I put this.
Jogeswara Rao K
2014 Feb 13 11:00 AM
Go to the Table Maintenance Generator Function group in SE80.
Go to the Screen flow logic .
Write your Code in PAI event
e.g
PROCESS AFTER INPUT.
MODULE LISTE_EXIT_COMMAND AT EXIT-COMMAND.
MODULE LISTE_BEFORE_LOOP.
LOOP AT EXTRACT.
MODULE LISTE_INIT_WORKAREA.
CHAIN.
FIELD ZTABLENAME-fldname.
FIELD ZTABLENAME-fldname .
FIELD ZTABLENAME-fldname .
FIELD ZTABLENAME-fldname.
MODULE SET_UPDATE_FLAG ON CHAIN-REQUEST.
MODULE validtate. " This is custom Module . write your validation logic with in this module.
ENDCHAIN.
FIELD VIM_MARKED MODULE LISTE_MARK_CHECKBOX.
CHAIN.
MODULE LISTE_UPDATE_LISTE.
ENDCHAIN.
ENDLOOP.
MODULE LISTE_AFTER_LOOP.
2014 Feb 13 11:01 AM
2014 Feb 13 11:10 AM
Hi,
Check event 01 for view V_FMFG_T095.
Otherwise, go to table TVIMF, display the entries, check on modules with 'CHECK' or 'VALIDATE' on its description.
Regards,
DPM
2014 Feb 13 11:18 AM
Hi,
The Conditions for uniqueness are
1. Filed1 value should be unique.
2. The combination of Fields 2,3 and 4 should be unique.
1. Create primary key
2. Create unique index in se11 .
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |