Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Runtime error in my program

*& Report  ZGSCREEN                                                    *
*&                                                                     *
*&                                                                     *
*&                                                                     *
REPORT  ZGSCREEN no standard page heading
tables :zgtable,sscrfields.
data:begin of itable occurs 0,
     mandt like zgtable-mandt,
     trackid like zgtable-trackid,
     artist like zgtable-artist,
     end of itable.
selection-screen begin of block block1 with frame title txt1.
parameters:trackid(15) type n, *I changed from trackid like zgtable-trackid
           artist(30) type c.
selection-screen skip 5.
selection-screen begin of line.
selection-screen pushbutton (20) but1 user-command but1.
selection-screen position 25.
selection-screen pushbutton (8) but2 user-command but2.
selection-screen position 38.
selection-screen pushbutton (10) but3 user-command but3.
selection-screen position 55.
selection-screen pushbutton (10) but4 user-command but4.
selection-screen end of line.
selection-screen end of block block1.
but1 = 'Save to Dbase'.
but2 = 'Clear'.
but3 = 'Update'.
but4 = 'Exit'.
at selection-screen.
*move 800 to itable-mandt.
move trackid to itable-trackid.
move artist to itable-artist.
append itable.

if sscrfields-ucomm eq'BUT1'.
  insert zgtable from itable.
  commit work.
if sscrfields-ucomm eq 'BUT4'.
leave program.

The problem it that my program is working well now.I added a record Trackid:2 Artist:Gopi Kumaran and clicked 'save to database',it saved.Then again changed trackid 2 to 3 and Gopi kumaran to A R Rehman,clicked 'save to database' (without quiting the screen).I get a run time error 'The ABAP/4 Open SQL array insert results in duplicate database records'.I dont know why.That is first time the record is adding,if i repeat it without quitting the screen the error is coming.Anyhow I tried commenting 'move 800 to itable-mandt'.The error says duplicate record.I dont know why.

Not what you were looking for? View more on this topic or Ask a question