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

Z-table row valdiations

jogeswararao_kavala
Active Contributor
0 Likes
1,874

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,824

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

10 REPLIES 10
Read only

Former Member
0 Likes
1,824

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.

Read only

Former Member
0 Likes
1,824

hi jogeswara,

                        only one ztabel is required or is there option to creation one another z-table?

regard,

vikas

Read only

Former Member
0 Likes
1,824

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

Read only

VijayaKrishnaG
Active Contributor
0 Likes
1,824

Hi all, I have a doubt will this TMG events get triggered if I am updating/modifying table from ABAP Report???

-Vijay

Read only

Former Member
0 Likes
1,824

Hi,

If you are updating in custom report. Do the validations first and once the data is clean, update the database.

Regards,

DPM

Read only

0 Likes
1,824

Hi DPM,

Mine is TMG situation.

I'm in need of a sample code, and the event where I put this.

Jogeswara Rao K

Read only

0 Likes
1,824

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.

Read only

Former Member
0 Likes
1,824

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

Read only

Former Member
0 Likes
1,825

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 .