Skip to Content
0
Former Member
Jan 17, 2008 at 04:09 AM

Delete modify in itab

23 Views

hi gurus,

i am new in abap and i have a report in which in a selection screen

has 3 fields as months cur. date and material no.

and two parameters as chkbox on selection of these chkbox

one for delete and other for modify data in table.

plz send the codes abt delete and modify

i make it this but have an error.

TABLES: S225.

*************************************************************************

  • D A T A

*************************************************************************

DATA: OK_CODE LIKE SY-UCOMM.

*DATA: ITAB LIKE S225 OCCURS 0 WITH HEADER LINE.

*************************************************************************

  • SELECTION SCREEN / PARAMETERS *

*************************************************************************

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.

SELECT-OPTIONS:S_spmon FOR s225-spmon OBLIGATORY LOWER CASE,

s_sptag FOR s225-sptag OBLIGATORY,

S_MATNR FOR S225-MATNR OBLIGATORY.

SELECTION-SCREEN SKIP 1.

PARAMETERS: P1 AS CHECKBOX DEFAULT 'X',

P2 AS CHECKBOX.

SELECTION-SCREEN END OF BLOCK b1.

**************************************************************************

  • START OF SELECTION

***************************************************************************

START-OF-SELECTION.

PERFORM GET_DATA.

PERFORM DELETE_DATA.

*forms to fetch data in fields

FORM GET_DATA.

SELECT spmon sptag matnr FROM s225

*INTO CORRESPONDING FIELDS OF TABLE ITAB

WHERE SPMON IN S_SPMON AND

SPTAG IN S_SPTAG AND

MATNR IN S_MATNR.

ENDFORM.

*form for delete data

FORM DELETE_DATA.

CASE OK_CODE.

WHEN 'P1'.

DELETE SPMON FROM s225.

MESSAGE I002 WITH 'Data is Deleted'.

*WHEN 'P2'.

*INSERT: SPMON,SPTAG, MATNR INTO ITAB.

*MESSAGE S004 WITH 'Data is Saved Successfully'.

ENDCASE.

ENDFORM.

plz help me and send information to correct it.

thanks.