DATA : WA TYPE ZSD_VBAK.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
PARAMETERS : VBELN TYPE ZSD_VBAK-SALESORDERNUM.
SELECTION-SCREEN SKIP 2.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN PUSHBUTTON 15(10) W_TEXT1 USER-COMMAND INS.
SELECTION-SCREEN PUSHBUTTON 25(10) W_TEXT2 USER-COMMAND DEL.
SELECTION-SCREEN PUSHBUTTON 35(10) W_TEXT3 USER-COMMAND CLR.
SELECTION-SCREEN PUSHBUTTON 45(10) W_TEXT4 USER-COMMAND DIS.
SELECTION-SCREEN PUSHBUTTON 65(10) W_TEXT5 USER-COMMAND UPD.
SELECTION-SCREEN PUSHBUTTON 79(10) W_TEXT6 USER-COMMAND MOD.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN SKIP 2.
PARAMETERS : CDATE TYPE ZSD_VBAK-CREATIONDATE ,
ETIME TYPE ZSD_VBAK-ENTRYTIME ,
CREATED TYPE ZSD_VBAK-CREATEDBY,
NETCURR TYPE ZSD_VBAK-SALESCURR.
SELECTION-SCREEN END OF BLOCK B1.
INITIALIZATION.
W_TEXT1 = 'INSERT'.
W_TEXT2 = 'DELETE'.
W_TEXT3 = 'CLEAR'.
W_TEXT4 = 'DISPLAY'.
W_TEXT5 = 'UPDATE'.
W_TEXT6 = 'MODIFY'.
AT SELECTION-SCREEN.
CASE SY-UCOMM.
WHEN 'INS'.
WA-SALESORDERNUM = VBELN.
WA-CREATIONDATE = CDATE.
WA-ENTRYTIME = ETIME.
WA-CREATEDBY = CREATED.
WA-SALESCURR = NETCURR.
INSERT ZSD_VBAK FROM WA.
IF SY-SUBRC = 4.
MESSAGE 'RECORD ALREADY EXISTS. PLEASE TRY WITH ANOTHER VBELN' TYPE 'I'.
ELSEIF SY-SUBRC = 0.
MESSAGE 'RECORD IS INSERTED' TYPE 'S'.
ELSE.
MESSAGE 'RECORD IS NOT INSERTED' TYPE 'I'.
ENDIF.
WHEN 'DEL'.
DELETE FROM ZSD_VBAK WHERE SALESORDERNUM = VBELN.
IF SY-SUBRC = 4.
MESSAGE 'RECORD DOESNT EXIST. PLEASE TRY WITH ANOTHER VBELN' TYPE 'I'.
ELSEIF SY-SUBRC = 0.
MESSAGE 'RECORD IS DELETED' TYPE 'S'.
ELSE.
MESSAGE 'RECORD IS NOT DELETED.' TYPE 'I'.
ENDIF.
WHEN 'CLR'.
CLEAR : VBELN , CDATE , ETIME , CREATED , NETCURR.
WHEN 'DIS'.
CLEAR WA.
SELECT SINGLE * FROM ZSD_VBAK INTO WA WHERE SALESORDERNUM = VBELN.
IF SY-SUBRC <> 0.
MESSAGE 'RECORD DOESNT EXIST. PLEASE TRY WITH ANOTHER VBELN' TYPE 'I'.
ELSE.
VBELN = WA-SALESORDERNUM.
CDATE = WA-CREATIONDATE.
ETIME = WA-ENTRYTIME.
CREATED = WA-CREATEDBY.
NETCURR = WA-SALESCURR.
ENDIF.
WHEN 'UPD'.
UPDATE ZSD_VBAK SET: CREATIONDATE = CDATE ENTRYTIME = ETIME CREATEDBY = CREATED SALESCURR = NETCURR
WHERE SALESORDERNUM = VBELN.
IF SY-SUBRC = 4.
MESSAGE 'RECORD DOESNT EXIST. PLEASE TRY WITH ANOTHER VBELN' TYPE 'I'.
ELSEIF SY-SUBRC = 0.
MESSAGE 'RECORD UPDATED SUCCESSFULLY.' TYPE 'S'.
ELSE.
MESSAGE 'RECORD IS NOT UPDATED.' TYPE 'I'.
ENDIF.
WHEN 'MOD'.
WA-SALESORDERNUM = VBELN.
WA-CREATIONDATE = CDATE.
WA-ENTRYTIME = ETIME.
WA-CREATEDBY = CREATED.
WA-SALESCURR = NETCURR.
MODIFY ZSD_VBAK FROM WA.
IF SY-SUBRC = 0.
MESSAGE 'RECORD IS MODIFIED' TYPE 'S'.
ENDIF.
ENDCASE.
No comments:
Post a Comment