Application Development 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: 

TMG Issue

divsmart
Participant
0 Kudos
332

Hi Experts,

I create an TMG (Event 05) based on 'Plant (as primary in Ztable') so when user enter the same plant an standard error message 'An Error already exits with same key' comes.

Here issue was user remove the same entered plant and gives the 'Enter' and so the remaining values comes as per logic. User asks should not comes. Please advice .

Initial TMG screen.

Enter the same plant:

Removes the Plant and entered

Code:

*----------------------------------------------------------------------*
***INCLUDE LZCA_FGF05.
*----------------------------------------------------------------------*
FORM new_form.
TYPES: BEGIN OF ty_t001w,
werks TYPE t001w-werks,
name1 TYPE t001w-name1,
j_1bbranch TYPE t001w-j_1bbranch,
END OF ty_t001w.

TYPES: BEGIN OF ty_t001k,
bwkey TYPE t001k-bwkey,
bukrs TYPE t001k-bukrs,
END OF ty_t001k.

DATA: it_t001w TYPE TABLE OF ty_t001w,
wa_t001w TYPE ty_t001w.

DATA: it_t001k TYPE TABLE OF ty_t001k,
wa_t001k TYPE ty_t001k.
*BREAK-POINT.
IF zca_t_po_table-werks IS NOT INITIAL.

SELECT SINGLE werks name1 j_1bbranch FROM t001w INTO wa_t001w WHERE werks EQ zca_t_po_table-werks.

IF wa_t001w IS NOT INITIAL.

zca_t_po_table-name1 = wa_t001w-name1.
zca_t_po_table-j_1bbranch = wa_t001w-j_1bbranch.

SELECT SINGLE bwkey bukrs FROM t001k INTO wa_t001k
WHERE bwkey EQ zca_t_po_table-werks.
IF wa_t001k IS NOT INITIAL.
zca_t_po_table-bukrs = wa_t001k-bukrs.
ENDIF.
ENDIF.
ENDIF.
CLEAR: wa_t001w,wa_t001k.
ENDFORM.
3 REPLIES 3

shantraj
Explorer
0 Kudos
197

Hi,

It's pretty simple, as you know, primary key will not accept the duplicate entries.

So the value entered should always be unique for primary key fields.

0 Kudos
197

Thanks.

I now primary key will not allow duplicate value but my issue was as above screenshot.

Please guidance me...

raymond_giuseppi
Active Contributor
0 Kudos
197

Basically you should not add those fields in your z-table.

  • Remove your form/event
  • Create a foreign key relation between zca_t_po_table-werks and t001w-werks
  • Create a maintenance view on tables zca_t_po_table, t001w and t001k, define the fields j_1bbranch, name1 of t001w and bukrs of t001k as 'R' read only
  • Regenerate your dialog on this maintenance view