Skip to Content
0
Former Member
Jan 09, 2008 at 11:54 AM

module pool program

25 Views

hi,

i have created a module pool program ( for the first time!!) which has 2 screens 100 and 200.there is a employee table 'ztabemp'.screen 100 has dlete save and add buttons.the delete command tht i have written in the code doesnt work also i need help in knwowing how to tranfers data from screen 200 into tablecontrol in screen 100.

kindly help me out !.

&----


*& Module pool ZEMPMP *

*& *

&----


*& *

*& *

&----


PROGRAM ZEMPMP MESSAGE-ID zz .

&----


*& Module STATUS_0100 OUTPUT

&----


  • text

----


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

  • Tables Declaration

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

tables ztabemp.

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

  • Internal table Declaration

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

data : lt_ztabemp type standard table of ztabemp with header line.

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

  • Table control Declaration

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

CONTROLS TC_EMPLOYEE TYPE TABLEVIEW USING SCREEN 0100.

&----


*& Module GET_DATA OUTPUT

&----


*Populating Data.

----


MODULE GET_DATA OUTPUT.

SELECT * INTO CORRESPONDING FIELDS OF TABLE LT_zTABEMP

FROM ZTABEMP.

ENDMODULE. " GET_DATA OUTPUT

&----


*& Module set_status OUTPUT

&----


  • Setting the GUI status

----


module STATUS_0100 output.

  • SET PF-STATUS 'xxxxxxxx'.

  • SET TITLEBAR 'xxx'.

ZTABEMP = LT_ZTABEMP.

endmodule. " STATUS_0100 OUTPUT

&----


*& Module USER_COMMAND_0100 INPUT

&----


  • text

----


module USER_COMMAND_0100 input.

SELECT * INTO CORRESPONDING FIELDS OF TABLE LT_zTABEMP

FROM ZTABEMP.

data :LV_FCODE LIKE SY-UCOMM,

LV_ANSWER(1) TYPE C,

FLG.

  • LV_FCODE = SY-UCOMM.

  • CASE LV_FCODE.

CASE SY-UCOMM.

WHEN 'DELETE'.

FLG = 'Y'.

CALL FUNCTION 'POPUP_TO_CONFIRM'

EXPORTING

TITLEBAR = 'CONFIRM '

  • DIAGNOSE_OBJECT = ' '

text_question = 'ARE YOU SURE TO DELETE FROM DATABASE?'

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 = LV_ANSWER.

  • TABLES

  • PARAMETER =

  • EXCEPTIONS

  • TEXT_NOT_FOUND = 1

  • OTHERS = 2

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

IF LV_ANSWER EQ '1'.

UPDATE ZTABEMP FROM LT_ZTABEMP.

DELETE LT_ZTABEMP WHERE PICK = 'X'.

DELETE FROM ZTABEMP WHERE PICK = 'X'.

MESSAGE s005(100) WITH 'DELETED SUCCESSFULLY!'.

ENDIF.

leave program.

when 'EXIT'.

leave program.

when 'ADD'.

leave to screen 0200.

WHEN 'SAVE'.

MODIFY ZTABEMP FROM TABLE LT_ZTABEMP.

MESSAGE s005 WITH 'SAVED SUCCESSFULLY!'.

endcase.

endmodule.

&----


*& Module USER_COMMAND_0200 INPUT

&----


  • text

----


module USER_COMMAND_0200 input.

CASE SY-UCOMM.

WHEN 'SAVE'.

LT_ZTABEMP-EMPID = ZTABEMP-EMPID.

LT_ZTABEMP-TITLE = ZTABEMP-TITLE.

LT_ZTABEMP-FNAME = ZTABEMP-FNAME.

LT_ZTABEMP-MNAME = ZTABEMP-MNAME.

LT_ZTABEMP-LNAME = ZTABEMP-LNAME.

LT_ZTABEMP-AG = ZTABEMP-AG.

LT_ZTABEMP-DU = ZTABEMP-DU.

LT_ZTABEMP-DESIG = ZTABEMP-DESIG .

LT_ZTABEMP-PRIM_SKILL = ZTABEMP-PRIM_SKILL.

LT_ZTABEMP-JOIN_DATE = ZTABEMP-JOIN_DATE.

LT_ZTABEMP-EMAIL = ZTABEMP-EMAIL.

LT_ZTABEMP-TEL1 = ZTABEMP-TEL1.

LT_ZTABEMP-TEL2 = ZTABEMP-TEL2.

MODIFY ZTABEMP FROM TABLE LT_ZTABEMP.

LEAVE TO SCREEN 0100.

ENDCASE.

endmodule. " USER_COMMAND_0200 INPUT

&----


*& Module STATUS_0200 OUTPUT

&----


  • text

----


module STATUS_0200 output.

  • SET PF-STATUS 'xxxxxxxx'.

  • SET TITLEBAR 'xxx'.

endmodule. " STATUS_0200 OUTPUT