08-02-2006 8:20 AM
Hello experts,
I have 4 fields in my UDT(user defined table) namely MANDT, ZEVENT, ZRECIPIENT and ZEMAIL.
Now, Only MANDT is the primary key. My question is, how can I insert duplicate values
via SM30?
Again, thank you guys and take care!
08-02-2006 8:29 AM
You cannot have only client field in the primary key if you want to maintain multiple records in your table.
In your table if you will always have one recipient per event then you should have ClientEvent as the primary key. If you might have more than one recipient per event then the primary key should be ClientEvent+Recipient.
Kiran
Please mark useful answers
08-02-2006 8:29 AM
You cannot have only client field in the primary key if you want to maintain multiple records in your table.
In your table if you will always have one recipient per event then you should have ClientEvent as the primary key. If you might have more than one recipient per event then the primary key should be ClientEvent+Recipient.
Kiran
Please mark useful answers
08-02-2006 8:44 AM
Hi again guys,
Thank you all for your helpful replies. However, I encountered another problem when I try to modify the values of the records via SM30. For example, record 1 has event 01, recipient 'AVH' and e-mail as viraylab@yahoo.com. Now lets say I want to change its recipient from 'AVH' to 'VIRAYLAB'. But when I click on save and then I check it again, it is still 'AVH'.
08-02-2006 9:05 AM
Hi viraylab,
1. we cannot change any field value
which is a part of the primary key
2. for that
3. we have to first delete that row,
4. and then add a new one.
regards,
amit m.
08-02-2006 9:17 AM
Hello guys,
Here is what I'm thinking, create another field in my UDT and name it as say, CDSEQ. This field will automatically create sequential numbers for every record added via SM30. So it will be my primary key and MANDT. My question is, after I have added the said field(CDSEQ), how do I make it invisible in maintenance view(SM30)? Also, What code can I make that for every new records, it will add 1 to its CDSEQ field?
again, thank you guys and take care!
08-02-2006 9:20 AM
Hi again,
1. What code can I make that for every new records, it will add 1 to its CDSEQ field?
For that we have to use
EVENTs for table maintenance.
We can use event 'Before Saving'
There we have to write some abap code,
which will fetch the last number,
add 1 and then update the field CDSEQ,
before saving.
regards,
amit m.
08-02-2006 9:24 AM
Hi Amit,
Thank you for your reply. So how can I make it invisible in SM30?
08-02-2006 9:37 AM
Hi again,
1. the full code for table maintenance,
is in a function group.
2. open that function group in new session
via se80 tcode.
3. in that identify the SCREEN
4. It will have table control
for the relevant fields.
5. choose your field,
and in property box,
make it INVISIBLE.
6. Activate the full function group again
7. In new session, try again with sm30.
regards,
amit m.
08-02-2006 9:43 AM
Hi again Amit,
I checked in SE80 and checked the screen for the said UDT table. Now, in the display attributes, the INVISIBLE checkbox is grayed for all the fields.
08-02-2006 9:51 AM
Hi again,
1. open the Layout of that screen
2. using drag&drop
just REMOVE the field from the table control.
3. Also
4. In the flow logic of that screen,
remove the line / commen it
which has been put in CHAIN
for eg.
FIELD YHRT_FUNMST-FUNSORT .
5. Activate everything
6. try again via sm30 in new session.
7. NOW IT WILL WORK. I JUST TRIED IT.
regards,
amit m.
08-02-2006 8:32 AM
Hi Viraylab,
You cannot insert Duplicate records if there is an Primary Key. You can do if your Table has COmposite Keys.
Hope this would have helped you .
Cheers,
Prashanth
08-02-2006 8:32 AM
Hi,
To insert duplicate values, make the following fields as key fields, MANDT, DATA & TIME in the table,
Hope this helps,
Rgds,
08-02-2006 8:35 AM