2022 Nov 08 10:10 AM
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.
2022 Nov 08 11:31 AM
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.
2022 Nov 09 2:59 AM
Thanks.
I now primary key will not allow duplicate value but my issue was as above screenshot.
Please guidance me...
2022 Nov 14 3:03 PM
Basically you should not add those fields in your z-table.