-1

I am learning ABAP, and one of the excersises is to make a table control with a table that has a foreign key in it.

I already did the Table control, but, how can I validate that the foreign key is correct or not?

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
  • Could you please explain what you mean by "validating" the foreign key, validate what? A foreign key doesn't need to be "validated". Or are you saying that you want to check the value in the screen field input by the user over the foreign key defined in the table related to the screen field? – Sandra Rossi Oct 10 '18 at 12:21
  • yeah, I want to check if the Id exists in the related table. Im sorry for the grammar issues, english isn't my native language. – Marinel Chávhez Oct 10 '18 at 17:25
  • When you define the foreign key for a field of a table (or structure) in the ABAP dictionary ("DDIC"), there's a checkbox to say that if an invalid value is entered in a screen field based upon that DDIC field, an error will happen automatically. Is that what you need? – Sandra Rossi Oct 11 '18 at 07:09

1 Answers1

1
  1. Go to SE11.
  2. Select the table .
  3. Select the field.
  4. Click button 'Foreign keys' enter image description here.
  5. Type the control table in Check table and click button 'Generate proposal' and confirm the key proposed. If not type the fieldname(s) of the check table. Include field MANDT first.

enter image description here

  1. Select the relation type (Not specified is default).
  2. Click button 'Copy' or press 'Enter'. enter image description here

Hope it helps.

Nelson Miranda
  • 5,484
  • 5
  • 33
  • 54