start-of-selection.
select single from * your ztable where ...
if sy-subrc ?> 0
  message ... with 'Primary key exists!!!'
else
  perform the insert.
endif.
Or...
start-of-selection.
 insert ztable.
 if sy-subrc ?> 0.
   message ... with 'Primary key exists!'.
 endif.
then use pop_up_to_confirm_step:
   data: l_respuesta. "local variable to hold the answer. 
   clear l_respuesta.
   call function 'POPUP_TO_CONFIRM_STEP'
                 exporting
                     defaultoption = 'N'
                  textline1  = 'Primary key exists in the database'
                 textline2  = 'Do you want to update?'
                  titel      = 'popup Title'
*           START_COLUMN  = 25
*           START_ROW     = 6
                 importing
                    answer        = l_respuesta
                 exceptions
                      others        = 1.
           if l_respuesta = 'J'.
     modify ztable.
     if sy-subrc = 0.
      mesage i ... with 'Data updated'
     endif.
    else.
      mesage i ... with 'No row updated'
         endif. 


Serkan AKKAVAK
Computer Engineer
ABAP Developer & SAP MM SD Consultant
Contact : serkurumsal@yandex.com