Skip to Content
author's profile photo Former Member
Former Member

Primary/Composite keys combination doesn't work.

Hello Experts,

I've build a custom table with three primary/composite keys, including Customer (KUNNR), Billing Type (FKART) and Output Media (ZZ_MEDIA) (as shown below).

However, the issue is I can insert records without Billing Type and Output Media via SM30 as shown below.

Question is, is there anything I can do to prevent it?

Many thanks in Advance.

CustomTable-1.jpg (32.0 kB)
CustomTable-2.jpg (50.2 kB)
Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    Posted on Jan 13, 2016 at 07:20 AM

    Hello,

    Composite key is a combination of two or more primary keys in a table.

    When you maintain the table, it will take a unique combination of all mentioned keys. even if you enter the value of one primary key and left the remaining primary keys blank, it is a possible combination, so the entry will be added to the table.

    If you have requirement to add entry to table only when all the primary keys are entered, you can do the following:

    1. Go to table maintenance generator. (Create one if you don't created it already)

    2. Go to Menu Environment -> Modification -> Maintenance Screens

    It will take you to the screen painter. Now go to Layout. There u can see the screen, the same screen u can see when u execute transaction SM30.

    3. Go to the desired tab and make the field as mandatory.

    Once you click on respective field tab, You can see the Screen painter: attributes screen , in that go to Attributes tab, Select Program Tab and make input as required from the drop-down.

    so the respected Key field become mandatory. You can do the same procedure for other key fields. So entry will be added to table when you provide all primary key values.

    Thanks,

    Mayuresh

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 13, 2016 at 03:08 AM

    Try creating Table Maintenance Generator and from table maintenece generator screen goto

    Environment -> Modification -> Maintenece Screen and make that field mandatory.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 13, 2016 at 02:37 PM

    Did you create some foreign key relations to check value of FKART (TVFK) and ZZ_MEDIA (z-table) as I suppose you did for KUNNR with KNA1-KUNNR (check required, key fields/candidates, cardinality 1:CN)

    Sample KUNNR in KNB1, check table KNA1:

    Regards,

    Raymond


    pastedImage_0.png (59.0 kB)
    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.