Application Development and Automation 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: 
Read only

database insert, update , delete

Former Member
0 Likes
453

Hi expert.  this code database table insert, update ,delete .this code broken. help me

DATA : BEGIN OF itab OCCURS 0,

        mandt LIKE zpsemih_insert-mandt,

        numara LIKE zpsemih_insert-numara,

        isim LIKE zpsemih_insert-isim,

        soyadi LIKE zpsemih_insert-soyadi,

   END OF itab,

   gs_1  LIKE itab.

PARAMETERS numara1 TYPE c LENGTH 25 .

PARAMETERS isim1 TYPE c LENGTH   25.

PARAMETERS soyadi1 TYPE c LENGTH 25.

SELECTION-SCREEN BEGIN OF LINE.

SELECTION-SCREEN PUSHBUTTON (10) insert USER-COMMAND inbuton.

SELECTION-SCREEN PUSHBUTTON (10) update USER-COMMAND upbuton.

SELECTION-SCREEN PUSHBUTTON (10) modify USER-COMMAND modbuton.

SELECTION-SCREEN PUSHBUTTON (10) delete USER-COMMAND delbuton.

SELECTION-SCREEN END OF LINE.

INITIALIZATION.

   insert = 'Insert'.

   update = 'Update'.

   modify = 'Modify'.

   delete  = 'Delete'.

   CASE sy-ucomm.

     WHEN 'INSERT'.

       gs_1-numara = numara1.

       gs_1-isim = isim1.

       gs_1-l = soyadi1.

       INSERT zpsemih_insert from gs_1.

       IF sy-subrc eq '0'.

      message 'kayıt eklendi' type 'I'.

       ENDIF.

     WHEN 'UPDATE'.

       UPDATE zpsemih_insert

SET   isim = isim1  soyadi = soyadi1

WHERE numara = numara1.

     WHEN 'MODİFY'.

    

gs_1-numara = numara1.

gs_1-isim = isim1.

gs_1-soyadi = soyadi1.

MODIFY TABLE itab FROM gs_1 .

     WHEN 'DELETE'.

       DELETE FROM zpsemih_insert WHERE numara = numara1.

*     WHEN OTHERS.

  ENDCASE.

2 REPLIES 2
Read only

former_member206479
Participant
0 Likes
405

Hi Sayin,

I think you have to use user-command values at WHEN condition like

TABLES sscrfields.

PARAMETERS numara1 TYPE c LENGTH 25 .

PARAMETERS isim1 TYPE c LENGTH   25.

PARAMETERS soyadi1 TYPE c LENGTH 25.

SELECTION-SCREEN BEGIN OF LINE.

SELECTION-SCREEN PUSHBUTTON (10) insert USER-COMMAND inbuton.

SELECTION-SCREEN PUSHBUTTON (10) update USER-COMMAND upbuton.

SELECTION-SCREEN PUSHBUTTON (10) modify USER-COMMAND modbuton.

SELECTION-SCREEN PUSHBUTTON (10) delete USER-COMMAND delbuton.

SELECTION-SCREEN END OF LINE.

INITIALIZATION.

   insert = 'Insert'.

   update = 'Update'.

   modify = 'Modify'.

   delete  = 'Delete'.

AT SELECTION-SCREEN.

   CASE sscrfields.

     WHEN 'INBUTON'.

       MESSAGE 'Insert command has been triggered' TYPE 'I'.

   ENDCASE.

please do the logic like above and let me know if it resolved are not.

Regards,

Venkat.

Read only

0 Likes
405

thank you