- Go to SE80 and design the screen.
- Flow logic
PROCESS BEFORE OUTPUT.
MODULE STATUS_9000.
*
PROCESS AFTER INPUT.
MODULE FORCE_EXIT AT EXIT-COMMAND.
MODULE USER_COMMAND_9000.
MODULE STATUS_9000.
*
PROCESS AFTER INPUT.
MODULE FORCE_EXIT AT EXIT-COMMAND.
MODULE USER_COMMAND_9000.
- Top include
TABLES : MARA.
TYPES : BEGIN OF T_MARA,
MATNR TYPE MARA-MATNR,
ERSDA TYPE MARA-ERSDA,
ERNAM TYPE MARA-ERNAM,
MTART TYPE MARA-MTART,
END OF T_MARA.
DATA : WA_MARA TYPE T_MARA,
WA TYPE MARA.
DATA : OK_CODE TYPE SY-UCOMM.
TYPES : BEGIN OF T_MARA,
MATNR TYPE MARA-MATNR,
ERSDA TYPE MARA-ERSDA,
ERNAM TYPE MARA-ERNAM,
MTART TYPE MARA-MTART,
END OF T_MARA.
DATA : WA_MARA TYPE T_MARA,
WA TYPE MARA.
DATA : OK_CODE TYPE SY-UCOMM.
- INPUT include.
module USER_COMMAND_9000 input.
DATA : ANS TYPE C.
CASE OK_CODE.
WHEN 'DISP'.
SELECT SINGLE MATNR ERSDA ERNAM MTART FROM MARA INTO
WA_MARA WHERE MATNR = WA_MARA-MATNR.
WHEN 'CLEA'.
CLEAR WA_MARA.
WHEN 'SAVE'.
SELECT SINGLE MATNR FROM MARA INTO MARA-MATNR WHERE
MATNR = WA_MARA-MATNR.
IF SY-SUBRC EQ 0.
MESSAGE 'RECORD ALREADY EXISTS' TYPE 'I'.
ELSE.
MOVE-CORRESPONDING WA_MARA TO WA.
MODIFY MARA FROM WA.
IF SY-SUBRC = 0.
MESSAGE 'RECORD HAS BEEN SUCESSFULLY SAVED! ' TYPE 'S'.
ENDIF.
ENDIF.
WHEN 'DELE'.
SELECT SINGLE MATNR FROM MARA INTO MARA-MATNR WHERE
MATNR = WA_MARA-MATNR.
IF SY-SUBRC NE 0.
MESSAGE 'RECORD DOES NOT EXISTS' TYPE 'I'.
ELSE.
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
* TITLEBAR = ' '
* DIAGNOSE_OBJECT = ' '
text_question = 'ARE YOU SURE DELETE THIS RECORD?'
TEXT_BUTTON_1 = 'YES'(001)
* ICON_BUTTON_1 = ' '
TEXT_BUTTON_2 = 'NO'(002)
* ICON_BUTTON_2 = ' '
* DEFAULT_BUTTON = '1'
* DISPLAY_CANCEL_BUTTON = 'X'
* USERDEFINED_F1_HELP = ' '
* START_COLUMN = 25
* START_ROW = 6
* POPUP_TYPE =
* IV_QUICKINFO_BUTTON_1 = ' '
* IV_QUICKINFO_BUTTON_2 = ' '
IMPORTING
ANSWER = ANS
* TABLES
* PARAMETER =
EXCEPTIONS
TEXT_NOT_FOUND = 1
OTHERS = 2
.
IF sy-subrc <> 0.
IF ANS = 1.
MOVE-CORRESPONDING WA_MARA TO WA.
DELETE MARA FROM WA.
MESSAGE 'RECORD HAS BEEN DELETED' TYPE 'S'.
ELSEIF ANS = 0.
MESSAGE 'REQUEST HAS BEEN CANCELLED' TYPE 'I'.
ENDIF.
ENDIF.
ENDCASE.
endmodule. " USER_COMMAND_9000 INPUT
MOVE-CORRESPONDING WA_MARA TO WA.
DELETE MARA FROM WA.
MESSAGE 'RECORD HAS BEEN DELETED' TYPE 'S'.
ELSEIF ANS = 0.
MESSAGE 'REQUEST HAS BEEN CANCELLED' TYPE 'I'.
ENDIF.
ENDIF.
ENDCASE.
endmodule. " USER_COMMAND_9000 INPUT
- FORCE_EXIT input
module FORCE_EXIT input.
CASE OK_CODE.
WHEN 'BACK' OR 'EXIT' OR 'CANC' .
LEAVE PROGRAM.
ENDCASE.
endmodule. " FORCE_EXIT INPUT
- Output Include.
module STATUS_9000 output.
SET PF-STATUS 'STATUS'.
* SET TITLEBAR 'xxx'.
endmodule. " STATUS_9000 OUTPUT
SET PF-STATUS 'STATUS'.
* SET TITLEBAR 'xxx'.
endmodule. " STATUS_9000 OUTPUT
No comments:
Post a Comment