Module Pool Programming using Abap Objects

Hi gurus.,
I need to create a module pool program with tabstrips and tablecontrols using Abap objects...plz guide me how i can achieve this... i am very much confused.. i dont know how and where to start .. plz send me documents and sample codes related to this topic..Also hoe i can implement f4 help in screen fields.. plz help me with Sample Code....
Regards.,
S.Sivakumar

Hi Marcelo Ramos.,
     here is my code without using WebLOg ..
PROGRAM  ZACR018_BOXKOD                          .
       TABLES DECLARATION
TABLES: ZACT02_BOXKOD, ZACS018_STR, MARA.
CONTROLS TABC TYPE TABLEVIEW USING SCREEN 102.
       END OF TABLES DECLARATION
DEFINE DYN_DECLARE_CREATE.
DATA: &1 TYPE REF TO &2.
CREATE OBJECT &1.
END-OF-DEFINITION.
CONSTANTS C_WERKS TYPE WERKS_D VALUE '7600'.
CONSTANTS C_REPID TYPE SY-REPID VALUE SY-REPID.
CONSTANTS C_VERID TYPE VERID VALUE '0001'.
CONSTANTS C_MDV01 TYPE MDV01 VALUE 'F3LB02'.
CLASS CL_TABLE_CONTROL DEFINITION.
PUBLIC SECTION.
CLASS-DATA: IT_C_DISPLAY TYPE STANDARD TABLE OF ZACS018_STR.
CLASS-DATA: WA_DISPLAY TYPE ZACS018_STR.
CLASS-DATA: WA_COLS LIKE LINE OF TABC-COLS.
CLASS-METHODS M1 IMPORTING WA_C_DISPLAY TYPE ZACS018_STR EXPORTING ZACS018_STR_C TYPE ZACS018_STR.
CLASS-METHODS M2 IMPORTING ZACS018_STR_C TYPE ZACS018_STR CHANGING  IT_C_DISPLAY LIKE IT_C_DISPLAY.
CLASS-METHODS M3 IMPORTING SAVE_OK TYPE SY-UCOMM CHANGING C_TABC TYPE CX_TABLEVIEW.
CLASS-METHODS M4 IMPORTING MASTER_PATTERN TYPE ZACT02_BOXKOD-MASTER_PATTERN
                           PATTERNSLNO    TYPE ZACT02_BOXKOD-PATTERNSLNO
                           SAVE_OK TYPE SY-UCOMM
                           CHANGING C_TABC TYPE CX_TABLEVIEW.
ENDCLASS.
CLASS CL_TABLE_CONTROL IMPLEMENTATION.
METHOD M1.
ZACS018_STR_C = WA_C_DISPLAY.
ENDMETHOD.
METHOD M2.
DESCRIBE TABLE IT_C_DISPLAY.
IF TABC-CURRENT_LINE > SY-TFILL.
    APPEND ZACS018_STR_C TO IT_C_DISPLAY.
ELSE.
    MODIFY IT_C_DISPLAY FROM ZACS018_STR_C INDEX TABC-CURRENT_LINE.
ENDIF.
ENDMETHOD.
METHOD M3.
IF SAVE_OK = 'CHECK'.
LOOP AT C_TABC-COLS INTO WA_COLS.
IF WA_COLS-SCREEN-GROUP2 = 'BOT'.
WA_COLS-SCREEN-INPUT = 0.
MODIFY C_TABC-COLS FROM WA_COLS INDEX SY-TABIX.
ENDIF.
ENDLOOP.
ELSE.
LOOP AT C_TABC-COLS INTO WA_COLS.
IF WA_COLS-SCREEN-GROUP2 = 'BOT'.
WA_COLS-SCREEN-INPUT = 1.
MODIFY C_TABC-COLS FROM WA_COLS INDEX SY-TABIX.
ENDIF.
ENDLOOP.
ENDIF.
ENDMETHOD.
METHOD M4.
IF MASTER_PATTERN IS INITIAL OR PATTERNSLNO  IS INITIAL.
LOOP AT C_TABC-COLS INTO WA_COLS.
IF WA_COLS-SCREEN-GROUP2 = 'BOT'.
WA_COLS-SCREEN-INPUT = 0.
MODIFY C_TABC-COLS FROM WA_COLS INDEX SY-TABIX.
ENDIF.
ENDLOOP.
ELSE.
IF SAVE_OK NE 'CHECK'.
LOOP AT C_TABC-COLS INTO WA_COLS.
IF WA_COLS-SCREEN-GROUP2 = 'BOT'.
WA_COLS-SCREEN-INPUT = 1.
MODIFY C_TABC-COLS FROM WA_COLS INDEX SY-TABIX.
ENDIF.
ENDLOOP.
ENDIF.
ENDIF.
ENDMETHOD.
ENDCLASS.
INTERFACE I_DATA.
DATA: WA_MARA TYPE MARA.
DATA: WA_MARC TYPE MARC.
DATA: WA_MAST TYPE MAST.
DATA: WA_STKO TYPE STKO.
DATA: WA_MKAL TYPE MKAL.
DATA: IT_STPOX TYPE STANDARD TABLE OF STPOX.
DATA: WA_STPOX TYPE STPOX.
DATA: WA_ZACT02_BOXKOD TYPE ZACT02_BOXKOD.
DATA: IT_C_DISPLAY TYPE STANDARD TABLE OF ZACS018_STR.
DATA: IT_SORT_DISPLAY TYPE STANDARD TABLE OF ZACS018_STR.
DATA: WA_DISPLAY TYPE ZACS018_STR.
DATA: W_YIELD(5)  TYPE P DECIMALS 2.
METHODS PARTNO_VAL IMPORTING PARTCODE TYPE ZACS018_STR-PARTCODE.
METHODS MAINBI_VAL IMPORTING MAINB    TYPE ZACS018_STR-MAINB.
METHODS CAVITY_VAL IMPORTING CAVITY   TYPE ZACS018_STR-CAVITY.
METHODS GET_COMP_WT IMPORTING PARTCODE TYPE ZACS018_STR-PARTCODE EXPORTING GROSSWT TYPE ZACS018_STR-GROSSWT.
METHODS NETWT_VAL IMPORTING NETWT TYPE ZACS018_STR-NETWT GROSSWT TYPE ZACS018_STR-GROSSWT.
METHODS MASPAT_VAL IMPORTING MASTER_PATTERN TYPE ZACT02_BOXKOD-MASTER_PATTERN.
METHODS PATSLNO_VAL IMPORTING PATTERNSLNO TYPE ZACT02_BOXKOD-PATTERNSLNO
                              MASTER_PATTERN TYPE ZACT02_BOXKOD-MASTER_PATTERN .
METHODS MAX_REF EXPORTING VERSNO TYPE ZACT02_BOXKOD-VERSNO.
METHODS NOOFBOX_VAL IMPORTING BMSCH TYPE ZACT02_BOXKOD-BMSCH.
METHODS TOTTIME_VAL IMPORTING VGW01 TYPE ZACT02_BOXKOD-VGW01.
METHODS TOTRUNWT IMPORTING IT_C_DISPLAY LIKE IT_C_DISPLAY
                 EXPORTING W_SUM_RUNWT LIKE ZACS018_STR-NETWT.
METHODS TOTCOMP_WT  IMPORTING IT_C_DISPLAY LIKE IT_C_DISPLAY
                    EXPORTING W_SUM_COMPWT LIKE ZACS018_STR-NETWT.
METHODS CHECK_OK IMPORTING SAVE_OK TYPE SY-UCOMM.
METHODS SCREEN_DISPLAY IMPORTING MASTER_PATTERN TYPE ZACT02_BOXKOD-MASTER_PATTERN
                                 PATTERNSLNO    TYPE ZACT02_BOXKOD-PATTERNSLNO
                                 SAVE_OK TYPE SY-UCOMM.
METHODS DUP_CHECK IMPORTING IT_C_DISPLAY LIKE IT_C_DISPLAY.
METHODS BOX_YLD IMPORTING W_SUM_COMPWT LIKE ZACS018_STR-NETWT
                          W_TOT_WT LIKE ZACS018_STR-NETWT
                EXPORTING W_YIELD LIKE W_YIELD.
ENDINTERFACE.
CLASS CL_CONTROL_EVENTS DEFINITION.
PUBLIC SECTION.
CLASS-DATA: C_WERKS TYPE WERKS_D VALUE C_WERKS.
INTERFACES I_DATA.
ENDCLASS.
CLASS CL_CONTROL_EVENTS IMPLEMENTATION.
METHOD I_DATA~PARTNO_VAL.
SELECT SINGLE * FROM MARA INTO I_DATA~WA_MARA WHERE MATNR = PARTCODE.
IF SY-SUBRC <> 0.
MESSAGE TEXT-001 TYPE 'E'.
ELSE.
IF I_DATA~WA_MARA-MTART NE 'HALB'.
MESSAGE TEXT-002 TYPE 'E'.
ENDIF.
SELECT SINGLE * FROM MARC INTO I_DATA~WA_MARC WHERE MATNR = PARTCODE AND
                                             WERKS = C_WERKS.
IF SY-SUBRC <> 0.
MESSAGE TEXT-003 TYPE 'E'.
ELSE.
IF I_DATA~WA_MARC-FEVOR NE 'KOD'.
MESSAGE TEXT-004 TYPE 'E'.
ENDIF.
ENDIF.
ENDIF.
SELECT SINGLE * FROM MKAL INTO I_DATA~WA_MKAL WHERE MATNR = PARTCODE AND
                                       WERKS = C_WERKS  AND
                                       VERID = C_VERID  AND
                                       MDV01 = C_MDV01.
IF SY-SUBRC <> 0.
MESSAGE TEXT-028 TYPE 'E'.
ENDIF.
ENDMETHOD.
METHOD I_DATA~CAVITY_VAL.
SET CURSOR FIELD 'ZACS018_STR-CAVITY' LINE SY-STEPL.
IF CAVITY IS INITIAL.
MESSAGE TEXT-005 TYPE 'E'.
ENDIF.
ENDMETHOD.
METHOD I_DATA~MAINBI_VAL.
SET CURSOR FIELD 'ZACS018_STR-MAINB' LINE SY-STEPL.
IF MAINB IS INITIAL.
MESSAGE TEXT-006 TYPE 'E'.
ENDIF.
ENDMETHOD.
METHOD I_DATA~GET_COMP_WT.
SET CURSOR FIELD 'ZACS018_STR-PARTCODE' LINE SY-STEPL.
*SELECT SINGLE MAST~MATNR
            MAST~WERKS
            MAST~STLAL
            STKO~DATUV
            INTO (I_DATAWA_MAST-MATNR,I_DATAWA_MAST-WERKS,I_DATAWA_MAST-STLAL,I_DATAWA_STKO-DATUV)
            FROM MAST AS MAST INNER JOIN STKO AS STKO
            ON STKOSTLNR = MASTSTLNR AND STKOSTLAL = MASTSTLAL
            WHERE  MAST~MATNR = PARTCODE AND
                   STKO~STLST = '1' AND
                   STKO~STLTY = 'M' AND
                   STKO~LKENZ  = '' AND
                   STKO~LOEKZ  = ''.
SELECT SINGLE * FROM MAST INTO I_DATA~WA_MAST WHERE MATNR = PARTCODE AND
                                                    STLAN = '1' AND
                                                    STLAL = '01' AND
                                                    WERKS = C_WERKS.
IF SY-SUBRC <> 0.
MESSAGE TEXT-009 TYPE 'E'.
ENDIF.
*CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
  PERCENTAGE       = 50
  TEXT             = TEXT-007.
*WAIT UP TO 2 SECONDS.
REFRESH I_DATA~IT_STPOX.
CALL FUNCTION 'CS_BOM_EXPL_MAT_V2'
EXPORTING
  FTREL                       = 'X'
  ALEKZ                       = ' '
  ALTVO                       = ' '
  AUFSW                       = ' '
  AUMGB                       = ' '
  AUMNG                       = 0
  AUSKZ                       = 'X'
  AMIND                       = ' '
  BAGRP                       = ' '
  BEIKZ                       = ' '
  BESSL                       = ' '
  BGIXO                       = 'X'
  BREMS                       = 'X'
   CAPID                       = 'PP01'
  CHLST                       = ' '
  COSPR                       = ' '
  CUOBJ                       = 000000000000000
  CUOVS                       = 0
  CUOLS                       = ' '
   DATUV                       = SY-DATUM
  DELNL                       = SPACE
  DRLDT                       = ' '
  EHNDL                       = '1'
  EMENG                       = 0
  ERSKZ                       = ' '
  ERSSL                       = ' '
  FBSTP                       = ' '
  KNFBA                       = ' '
  KSBVO                       = ' '
  MBWLS                       = ' '
  MKTLS                       = 'X'
  MDMPS                       = ' '
   MEHRS                       = ' '
  MKMAT                       = ' '
  MMAPS                       = ' '
  SALWW                       = ' '
  SPLWW                       = ' '
   MMORY                       = '0'
   MTNRV                       = PARTCODE
  NLINK                       = ' '
  POSTP                       = ' '
  RNDKZ                       = ' '
  RVREL                       = ' '
  SANFR                       = ' '
  SANIN                       = ' '
  SANKA                       = ' '
  SANKO                       = ' '
  SANVS                       = ' '
  SCHGT                       = ' '
  STKKZ                       = ' '
   STLAL                       = '01'
   STLAN                       = '1'
  STPST                       = 0
  SVWVO                       = 'X'
   WERKS                       = C_WERKS
  NORVL                       = ' '
  MDNOT                       = ' '
  PANOT                       = ' '
  QVERW                       = ' '
  VERID                       = ' '
  VRSVO                       = 'X'
IMPORTING
  TOPMAT                      =
  DSTST                       =
  TABLES
    STB                         = I_DATA~IT_STPOX
  MATCAT                      =
EXCEPTIONS
   ALT_NOT_FOUND               = 1
   CALL_INVALID                = 2
   MATERIAL_NOT_FOUND          = 3
   MISSING_AUTHORIZATION       = 4
   NO_BOM_FOUND                = 5
   NO_PLANT_DATA               = 6
   NO_SUITABLE_BOM_FOUND       = 7
   CONVERSION_ERROR            = 8
   OTHERS                      = 9
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT I_DATA~IT_STPOX INTO I_DATA~WA_STPOX.
SELECT SINGLE FEVOR FROM MARC INTO I_DATA~WA_MARC-FEVOR WHERE MATNR = I_DATA~WA_STPOX-IDNRK AND
                                                       WERKS = I_DATA~WA_STPOX-WERKS AND
                                                       FEVOR = 'MLT'.
IF SY-SUBRC EQ 0.
GROSSWT = I_DATA~WA_STPOX-MNGLG.
EXIT.
ELSE.
CLEAR GROSSWT.
ENDIF.
ENDLOOP.
IF GROSSWT IS INITIAL.
MESSAGE TEXT-008 TYPE 'E'.
ENDIF.
ENDMETHOD.
METHOD I_DATA~NETWT_VAL.
SET CURSOR FIELD 'ZACS018_STR-NETWT' LINE SY-STEPL.
IF NETWT IS INITIAL.
MESSAGE TEXT-010 TYPE 'E'.
ELSE.
IF NETWT >= GROSSWT.
MESSAGE TEXT-011 TYPE 'E'.
ENDIF.
ENDIF.
ENDMETHOD.
METHOD I_DATA~MASPAT_VAL.
IF MASTER_PATTERN IS INITIAL.
MESSAGE TEXT-014 TYPE 'E'.
ENDIF.
SELECT SINGLE * FROM MARA INTO I_DATA~WA_MARA WHERE MATNR = MASTER_PATTERN.
IF SY-SUBRC <> 0.
MESSAGE TEXT-001 TYPE 'E'.
ELSE.
IF I_DATA~WA_MARA-MTART NE 'FHMI'.
MESSAGE TEXT-012 TYPE 'E'.
ENDIF.
SELECT SINGLE * FROM MARC INTO I_DATA~WA_MARC WHERE MATNR = MASTER_PATTERN AND
                                             WERKS = C_WERKS.
IF SY-SUBRC <> 0.
MESSAGE TEXT-003 TYPE 'E'.
ELSE.
IF I_DATA~WA_MARC-FEVOR NE 'MLD'.
MESSAGE TEXT-013 TYPE 'E'.
ENDIF.
ENDIF.
ENDIF.
ENDMETHOD.
METHOD I_DATA~PATSLNO_VAL.
IF PATTERNSLNO IS INITIAL.
MESSAGE TEXT-016 TYPE 'E'.
ENDIF.
SELECT SINGLE * FROM ZACT02_BOXKOD INTO I_DATA~WA_ZACT02_BOXKOD WHERE MASTER_PATTERN = MASTER_PATTERN
                                                           AND PATTERNSLNO    = PATTERNSLNO.
IF SY-SUBRC EQ 0.
MESSAGE TEXT-015 TYPE 'E'.
ENDIF.
ENDMETHOD.
METHOD I_DATA~MAX_REF.
SELECT SINGLE MAX( VERSNO ) FROM ZACT02_BOXKOD INTO VERSNO.
VERSNO = VERSNO + 1.
ENDMETHOD.
METHOD I_DATA~NOOFBOX_VAL.
IF BMSCH IS INITIAL.
LOOP AT SCREEN.
IF SCREEN-GROUP2 = 'BOT' AND SCREEN-NAME <> 'ZACT02_BOXKOD-PRD_ACT' AND SCREEN-NAME <> 'ZACT02_BOXKOD-SHOTS'.
SCREEN-INPUT = 1.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
MESSAGE TEXT-017 TYPE 'E'.
ENDIF.
ENDMETHOD.
METHOD I_DATA~TOTTIME_VAL.
IF VGW01 IS INITIAL.
MESSAGE TEXT-018 TYPE 'E'.
ENDIF.
IF VGW01 > 480.
MESSAGE TEXT-019 TYPE 'E'.
ENDIF.
ENDMETHOD.
METHOD I_DATA~TOTRUNWT.
CLEAR W_SUM_RUNWT.
LOOP AT IT_C_DISPLAY INTO I_DATA~WA_DISPLAY.
W_SUM_RUNWT = W_SUM_RUNWT + I_DATA~WA_DISPLAY-NETWT * I_DATA~WA_DISPLAY-CAVITY.
ENDLOOP.
ENDMETHOD.
METHOD I_DATA~TOTCOMP_WT.
CLEAR W_SUM_COMPWT.
LOOP AT IT_C_DISPLAY INTO I_DATA~WA_DISPLAY.
W_SUM_COMPWT = W_SUM_COMPWT + I_DATA~WA_DISPLAY-GROSSWT * I_DATA~WA_DISPLAY-CAVITY.
ENDLOOP.
ENDMETHOD.
METHOD I_DATA~CHECK_OK.
IF SAVE_OK = 'CHECK'.
LOOP AT SCREEN.
IF SCREEN-GROUP2 = 'BOT'.
SCREEN-INPUT = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ELSE.
LOOP AT SCREEN.
IF SCREEN-GROUP2 = 'BOT'.
SCREEN-INPUT = 1.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
ENDMETHOD.
METHOD I_DATA~SCREEN_DISPLAY.
IF MASTER_PATTERN IS INITIAL
OR PATTERNSLNO IS INITIAL.
LOOP AT SCREEN.
IF SCREEN-GROUP2 = 'BOT'.
SCREEN-INPUT = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ELSE.
IF SAVE_OK NE 'CHECK'.
LOOP AT SCREEN.
IF SCREEN-GROUP2 = 'BOT'.
SCREEN-INPUT = 1.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
ENDIF.
ENDMETHOD.
METHOD I_DATA~DUP_CHECK. " IMPORTING IT_C_DISPLAY
DATA: W_PARTCODE LIKE I_DATA~WA_DISPLAY-PARTCODE.
I_DATA~IT_SORT_DISPLAY = IT_C_DISPLAY.
SORT I_DATA~IT_SORT_DISPLAY BY PARTCODE.
CLEAR W_PARTCODE.
LOOP AT I_DATA~IT_SORT_DISPLAY INTO I_DATA~WA_DISPLAY.
IF W_PARTCODE = I_DATA~WA_DISPLAY-PARTCODE.
MESSAGE TEXT-027 TYPE 'E'.
ENDIF.
W_PARTCODE = I_DATA~WA_DISPLAY-PARTCODE.
ENDLOOP.
ENDMETHOD.
METHOD I_DATA~BOX_YLD.
W_YIELD = ( W_SUM_COMPWT / W_TOT_WT ) * 100.
ENDMETHOD.
ENDCLASS.
inherited class for edit mode
CLASS CL_CONTROL_EDIT DEFINITION INHERITING FROM CL_CONTROL_EVENTS .
PUBLIC SECTION.
METHODS GET_DATA IMPORTING MASTER_PATTERN TYPE ZACT02_BOXKOD-MASTER_PATTERN
                              PATTERNSLNO TYPE ZACT02_BOXKOD-PATTERNSLNO
                 EXPORTING        VERSNO  TYPE ZACT02_BOXKOD-VERSNO
                              CHANGING ZACT02_BOXKOD TYPE ZACT02_BOXKOD
                                       IT_C_DISPLAY  LIKE I_DATA~IT_C_DISPLAY
                                       IT_DEL_DISPLAY LIKE I_DATA~IT_C_DISPLAY
                                       TABC TYPE CX_TABLEVIEW.
METHODS PATSLNO_VAL_CHG IMPORTING PATTERNSLNO TYPE ZACT02_BOXKOD-PATTERNSLNO
                              MASTER_PATTERN TYPE ZACT02_BOXKOD-MASTER_PATTERN .
ENDCLASS.
CLASS CL_CONTROL_EDIT IMPLEMENTATION.
METHOD GET_DATA.
IF MASTER_PATTERN IS NOT INITIAL AND PATTERNSLNO IS NOT INITIAL.
IF IT_C_DISPLAY IS INITIAL.
IF IT_DEL_DISPLAY IS INITIAL.
SELECT SINGLE MAX( VERSNO ) FROM ZACT02_BOXKOD INTO VERSNO WHERE
                                 MASTER_PATTERN = MASTER_PATTERN AND
                                 PATTERNSLNO    = PATTERNSLNO.
SELECT SINGLE * FROM ZACT02_BOXKOD INTO ZACT02_BOXKOD WHERE
   MASTER_PATTERN = MASTER_PATTERN AND
   PATTERNSLNO    = PATTERNSLNO    AND
   VERSNO         = VERSNO..
SELECT PARTCODE MAINB CAVITY GROSSWT NETWT FROM ZACT02_BOXKOD INTO
                CORRESPONDING FIELDS OF TABLE IT_C_DISPLAY WHERE
                MASTER_PATTERN = MASTER_PATTERN AND
                PATTERNSLNO    = PATTERNSLNO    AND
                VERSNO         = VERSNO.
IT_DEL_DISPLAY[] = IT_C_DISPLAY[].
DESCRIBE TABLE IT_C_DISPLAY.
TABC-LINES = SY-TFILL.
ENDIF.
ENDIF.
ENDIF.
ENDMETHOD.
METHOD PATSLNO_VAL_CHG.
SELECT SINGLE * FROM ZACT02_BOXKOD INTO I_DATA~WA_ZACT02_BOXKOD WHERE MASTER_PATTERN = MASTER_PATTERN
                                                           AND PATTERNSLNO    = PATTERNSLNO.
IF PATTERNSLNO IS INITIAL.
MESSAGE TEXT-016 TYPE 'E'.
ENDIF.
IF SY-SUBRC <> 0.
MESSAGE TEXT-022 TYPE 'E'.
ENDIF.
ENDMETHOD.
ENDCLASS.
inheriting for display
CLASS CL_CONTROL_DISPLAY DEFINITION INHERITING FROM CL_CONTROL_EDIT .
PUBLIC SECTION.
METHODS GET_DISPLAY_DATA IMPORTING MASTER_PATTERN TYPE ZACT02_BOXKOD-MASTER_PATTERN
                                   PATTERNSLNO TYPE ZACT02_BOXKOD-PATTERNSLNO
                                   VERSNO TYPE ZACT02_BOXKOD-VERSNO
                          CHANGING IT_C_DISPLAY LIKE I_DATA~IT_C_DISPLAY
                                   ZACT02_BOXKOD TYPE ZACT02_BOXKOD
                                   TABC TYPE CX_TABLEVIEW.
ENDCLASS.
CLASS CL_CONTROL_DISPLAY IMPLEMENTATION.
METHOD GET_DISPLAY_DATA.
SELECT SINGLE * FROM ZACT02_BOXKOD INTO ZACT02_BOXKOD WHERE
   MASTER_PATTERN = MASTER_PATTERN AND
   PATTERNSLNO    = PATTERNSLNO    AND
   VERSNO         = VERSNO..
IF SY-SUBRC <> 0.
MESSAGE TEXT-026 TYPE 'E'.
ENDIF.
SELECT PARTCODE MAINB CAVITY GROSSWT NETWT FROM ZACT02_BOXKOD INTO
                CORRESPONDING FIELDS OF TABLE IT_C_DISPLAY WHERE
                MASTER_PATTERN = MASTER_PATTERN AND
                PATTERNSLNO    = PATTERNSLNO    AND
                VERSNO         = VERSNO.
DESCRIBE TABLE IT_C_DISPLAY.
TABC-LINES = SY-TFILL.
ENDMETHOD.
ENDCLASS.
DATA: O_CONTROL_EVENTS TYPE REF TO CL_CONTROL_EVENTS.
DATA: O_CONTROL_EVENTS_EDIT TYPE REF TO CL_CONTROL_EDIT.
DATA: O_CONTROL_EVENTS_DISPLAY TYPE REF TO CL_CONTROL_DISPLAY.
       SELECTION SCREEN
       END OF SELECTION SCREEN
       VARIABLE DECLARATION         BEGIN WITH W_
DATA: OK_CODE TYPE SY-UCOMM,
      SAVE_OK TYPE SY-UCOMM.
DATA: W_TOT_WT LIKE ZACS018_STR-NETWT,
      W_SUM_COMPWT LIKE ZACS018_STR-NETWT,
      W_SUM_RUNWT LIKE ZACS018_STR-NETWT,
      W_YIELD(5)  TYPE P DECIMALS 2.
DATA: W_TIMLO TYPE SY-TIMLO,
      W_MODE  TYPE SY-UCOMM.
DATA: W_SCREEN_NO TYPE SY-DYNNR.
       END OF VARIABLE DECLARATION
       WORK AREAS DECLARATION         BEGIN WITH WA_
DATA: WA_DISPLAY TYPE ZACS018_STR.
       END OF WORK AREAS DECLARATION
       INTERNAL TABLES          BEGIN WITH IT_
DATA: IT_DISPLAY TYPE ZACS018_STR OCCURS 0.
DATA: IT_DISPLAY_PRD TYPE ZACS018_STR OCCURS 0.
DATA: IT_DEL_DISPLAY TYPE ZACS018_STR OCCURS 0.
DATA: IT_ZACT02_BOXKOD TYPE ZACT02_BOXKOD OCCURS 0 WITH HEADER LINE.
DATA: IT_ZACT02_BOXKOD_DEL TYPE ZACT02_BOXKOD OCCURS 0 WITH HEADER LINE.
DATA: BEGIN OF IT_F4MASTERPAT OCCURS 0,
      MASTER_PATTERN LIKE ZACT02_BOXKOD-MASTER_PATTERN,
      END OF IT_F4MASTERPAT.
DATA: BEGIN OF IT_F4PATSLNO OCCURS 0,
      MASTER_PATTERN LIKE ZACT02_BOXKOD-MASTER_PATTERN,
      PATTERNSLNO    LIKE ZACT02_BOXKOD-PATTERNSLNO,
      VERSNO         LIKE ZACT02_BOXKOD-VERSNO,
      END OF IT_F4PATSLNO.
DATA: IT_EXCLUDE TYPE TABLE OF SY-UCOMM..
DATA : IT_DYNPRO LIKE  DYNPREAD OCCURS 0 WITH HEADER LINE.
       END OF INTERNAL TABLES DECLARATIONS
LOAD-OF-PROGRAM.
CREATE OBJECT O_CONTROL_EVENTS.
*&      Module  USER_COMMAND_0100  INPUT
      text
MODULE USER_COMMAND_0100 INPUT.
SAVE_OK = OK_CODE.
CLEAR OK_CODE.
W_MODE = SAVE_OK.
CASE SAVE_OK.
WHEN 'CREATE'.
CALL SCREEN 101.
WHEN 'CHANGE'.
CREATE OBJECT O_CONTROL_EVENTS_EDIT.
CALL SCREEN 101.
WHEN 'DISPLAY'.
APPEND 'SAVE'  TO IT_EXCLUDE.
APPEND 'CHECK' TO IT_EXCLUDE.
APPEND 'ADD'   TO IT_EXCLUDE.
CREATE OBJECT O_CONTROL_EVENTS_DISPLAY.
CALL SCREEN 101.
ENDCASE.
ENDMODULE.                 " USER_COMMAND_0100  INPUT
*&      Module  STATUS_0102  OUTPUT
      text
MODULE STATUS_0102 OUTPUT.
CALL METHOD CL_TABLE_CONTROL=>M3 EXPORTING SAVE_OK = SAVE_OK CHANGING C_TABC = TABC.
CALL METHOD O_CONTROL_EVENTS->I_DATA~CHECK_OK EXPORTING SAVE_OK = SAVE_OK.
CALL METHOD O_CONTROL_EVENTS->I_DATA~SCREEN_DISPLAY EXPORTING MASTER_PATTERN = ZACT02_BOXKOD-MASTER_PATTERN
                                 PATTERNSLNO    = ZACT02_BOXKOD-PATTERNSLNO
                                 SAVE_OK = SAVE_OK.
CALL METHOD CL_TABLE_CONTROL=>M4 EXPORTING MASTER_PATTERN = ZACT02_BOXKOD-MASTER_PATTERN
                                           PATTERNSLNO    = ZACT02_BOXKOD-PATTERNSLNO
                                           SAVE_OK        = SAVE_OK
                                           CHANGING C_TABC = TABC.
DESCRIBE TABLE IT_DISPLAY.
IF TABC-LINES <= 1.
IF SY-TFILL = 0.
TABC-LINES = 1.
ENDIF.
ENDIF.
IF SAVE_OK NE 'CHECK'.
IF ZACT02_BOXKOD-TOOL_ACT <> 'X'.
CLEAR ZACT02_BOXKOD-PRD_ACT.
LOOP AT SCREEN.
IF SCREEN-NAME = 'ZACT02_BOXKOD-PRD_ACT'.
SCREEN-INPUT = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ELSE.
LOOP AT SCREEN.
IF SCREEN-NAME = 'ZACT02_BOXKOD-PRD_ACT'.
SCREEN-INPUT = 1.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
ENDIF.
CALL METHOD O_CONTROL_EVENTS->I_DATA~TOTRUNWT EXPORTING IT_C_DISPLAY = IT_DISPLAY
                                       IMPORTING W_SUM_RUNWT = W_SUM_RUNWT.
CALL METHOD O_CONTROL_EVENTS->I_DATA~TOTCOMP_WT  EXPORTING IT_C_DISPLAY = IT_DISPLAY
                                       IMPORTING W_SUM_COMPWT = W_SUM_COMPWT.
CLEAR W_TOT_WT.
W_TOT_WT = W_SUM_RUNWT + W_SUM_COMPWT.
CALL METHOD O_CONTROL_EVENTS->I_DATA~BOX_YLD EXPORTING W_SUM_COMPWT = W_SUM_COMPWT
                                           W_TOT_WT = W_TOT_WT
                                             IMPORTING W_YIELD = W_YIELD.
IF W_MODE <> 'CREATE'.
LOOP AT SCREEN.
IF SCREEN-NAME = 'ZACT02_BOXKOD-SHOTS'.
SCREEN-INPUT = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
IF W_MODE = 'DISPLAY'.
LOOP AT SCREEN.
IF SCREEN-NAME = 'ADD' OR SCREEN-NAME = 'ICON_DELETE'.
SCREEN-INPUT = '0'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
ENDMODULE.                 " STATUS_0102  OUTPUT
*&      Module  STATUS_0101  OUTPUT
      text
MODULE STATUS_0101 OUTPUT.
  SET PF-STATUS 'STANDARD' EXCLUDING 'SAVE'.
  IF W_MODE = 'CREATE'.
  SET TITLEBAR  'STANDARD'.
  ELSEIF W_MODE = 'DISPLAY'.
  SET TITLEBAR  'STD_DIS'.
  ELSE.
  SET TITLEBAR 'STD_EDIT'.
  ENDIF.
  IF SAVE_OK = 'CHECK'.
  DESCRIBE TABLE IT_DISPLAY.
  IF SY-TFILL > 0.
  SET PF-STATUS 'STANDARD'.
  ENDIF.
  ENDIF.
  IF W_MODE = 'DISPLAY'.
  SET PF-STATUS 'STANDARD' EXCLUDING IT_EXCLUDE.
  ENDIF.
IF ZACT02_BOXKOD-MASTER_PATTERN IS NOT INITIAL AND
   ZACT02_BOXKOD-PATTERNSLNO    IS NOT INITIAL.
LOOP AT SCREEN.
IF SCREEN-GROUP1 = 'TOP'.
SCREEN-INPUT = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
IF W_MODE = 'DISPLAY'.
IF ZACT02_BOXKOD-VERSNO IS INITIAL.
LOOP AT SCREEN.
IF SCREEN-NAME = 'ZACT02_BOXKOD-VERSNO'.
SCREEN-INPUT = 1.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ELSE.
LOOP AT SCREEN.
IF SCREEN-NAME = 'ZACT02_BOXKOD-VERSNO'.
SCREEN-INPUT = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
ENDIF.
ENDMODULE.                 " STATUS_0101  OUTPUT
*&      Module  USER_COMMAND_0102  INPUT
      text
MODULE USER_COMMAND_0102 INPUT.
SAVE_OK = OK_CODE.
CLEAR OK_CODE.
CASE SAVE_OK.
WHEN 'ADD'.
DESCRIBE TABLE IT_DISPLAY.
IF SY-TFILL >= TABC-LINES.
IF TABC-LINES < 16.
TABC-LINES = SY-TFILL + 1.
ENDIF.
ENDIF.
WHEN 'DEL'.
LOOP AT IT_DISPLAY INTO WA_DISPLAY WHERE MARK = 'X'.
DELETE IT_DISPLAY INDEX SY-TABIX.
ENDLOOP.
DESCRIBE TABLE IT_DISPLAY.
IF SY-TFILL >= 1.
TABC-LINES = SY-TFILL.
ELSE.
TABC-LINES = 1.
ENDIF.
WHEN 'CHECK'.
CALL METHOD O_CONTROL_EVENTS->I_DATA~DUP_CHECK EXPORTING IT_C_DISPLAY = IT_DISPLAY.
WHEN 'SAVE'.
W_TIMLO = SY-TIMLO.
IF W_MODE = 'CREATE'.
PERFORM CREATE_SAVE.
ENDIF.
IF W_MODE = 'CHANGE'.
PERFORM EDIT_SAVE.
ENDIF.
ENDCASE.
IF W_MODE = 'DISPLAY'.
SAVE_OK = 'CHECK'.
ENDIF.
ENDMODULE.                 " USER_COMMAND_0102  INPUT
*&      Module  MOD_TABLE  INPUT
      text
MODULE MOD_TABLE INPUT.
CALL METHOD CL_TABLE_CONTROL=>M2 EXPORTING ZACS018_STR_C = ZACS018_STR CHANGING IT_C_DISPLAY = IT_DISPLAY.
ENDMODULE.                 " MOD_TABLE  INPUT
*&      Module  ASSIGN  OUTPUT
      text
MODULE ASSIGN OUTPUT.
CALL METHOD CL_TABLE_CONTROL=>M1 EXPORTING WA_C_DISPLAY = WA_DISPLAY IMPORTING ZACS018_STR_C = ZACS018_STR.
ENDMODULE.                 " ASSIGN  OUTPUT
*&      Module  CHK_PARTCODE  INPUT
      text
MODULE CHK_PARTCODE INPUT.
CALL METHOD O_CONTROL_EVENTS->I_DATA~PARTNO_VAL EXPORTING PARTCODE = ZACS018_STR-PARTCODE.
ENDMODULE.                 " CHK_PARTCODE  INPUT
*&      Module  CHK_CAVITY  INPUT
      text
MODULE CHK_CAVITY INPUT.
CALL METHOD O_CONTROL_EVENTS->I_DATA~CAVITY_VAL EXPORTING CAVITY = ZACS018_STR-CAVITY.
ENDMODULE.                 " CHK_CAVITY  INPUT
*&      Module  CHK_MAINB  INPUT
      text
MODULE CHK_MAINB INPUT.
CALL METHOD O_CONTROL_EVENTS->I_DATA~MAINBI_VAL EXPORTING MAINB = ZACS018_STR-MAINB.
ENDMODULE.                 " CHK_MAINB  INPUT
*&      Module  GET_COMP_WT  INPUT
      text
MODULE GET_COMP_WT INPUT.
IF W_MODE <> 'DISPLAY'.
CALL METHOD O_CONTROL_EVENTS->I_DATA~GET_COMP_WT EXPORTING PARTCODE = ZACS018_STR-PARTCODE
                                          IMPORTING GROSSWT  = ZACS018_STR-GROSSWT.
ENDIF.
ENDMODULE.                 " GET_COMP_WT  INPUT
*&      Module  CHK_NETWT  INPUT
      text
MODULE CHK_NETWT INPUT.
CALL METHOD O_CONTROL_EVENTS->I_DATA~NETWT_VAL EXPORTING NETWT = ZACS018_STR-NETWT
                                                GROSSWT = ZACS018_STR-GROSSWT.
ENDMODULE.                 " CHK_NETWT  INPUT
*&      Module  CHK_MPAT  INPUT
      text
MODULE CHK_MPAT INPUT.
CALL METHOD O_CONTROL_EVENTS->I_DATA~MASPAT_VAL EXPORTING MASTER_PATTERN = ZACT02_BOXKOD-MASTER_PATTERN.
ENDMODULE.                 " CHK_MPAT  INPUT
*&      Module  CHK_SLNO  INPUT
      text
MODULE CHK_SLNO INPUT.
IF W_MODE = 'CREATE'.
CALL METHOD O_CONTROL_EVENTS->I_DATA~PATSLNO_VAL EXPORTING PATTERNSLNO = ZACT02_BOXKOD-PATTERNSLNO
                              MASTER_PATTERN = ZACT02_BOXKOD-MASTER_PATTERN .
ELSEIF W_MODE = 'CHANGE' .
CALL METHOD O_CONTROL_EVENTS_EDIT->PATSLNO_VAL_CHG EXPORTING PATTERNSLNO = ZACT02_BOXKOD-PATTERNSLNO
                              MASTER_PATTERN = ZACT02_BOXKOD-MASTER_PATTERN .
CALL METHOD O_CONTROL_EVENTS_EDIT->GET_DATA EXPORTING MASTER_PATTERN = ZACT02_BOXKOD-MASTER_PATTERN
                              PATTERNSLNO = ZACT02_BOXKOD-PATTERNSLNO
                              IMPORTING VERSNO  = ZACT02_BOXKOD-VERSNO
                              CHANGING ZACT02_BOXKOD = ZACT02_BOXKOD
                                       IT_C_DISPLAY  =  IT_DISPLAY
                                       IT_DEL_DISPLAY = IT_DEL_DISPLAY
                                       TABC          = TABC.
ELSE.
CALL METHOD O_CONTROL_EVENTS_DISPLAY->PATSLNO_VAL_CHG EXPORTING PATTERNSLNO = ZACT02_BOXKOD-PATTERNSLNO
                              MASTER_PATTERN = ZACT02_BOXKOD-MASTER_PATTERN .
ENDIF.
ENDMODULE.                 " CHK_SLNO  INPUT
*&      Module  MAX_VER  INPUT
      text
MODULE MAX_VER INPUT.
IF W_MODE = 'CREATE'.
CALL METHOD O_CONTROL_EVENTS->I_DATA~MAX_REF IMPORTING VERSNO = ZACT02_BOXKOD-VERSNO.
ENDIF.
IF W_MODE = 'DISPLAY'.
IF ZACT02_BOXKOD-VERSNO IS INITIAL.
MESSAGE TEXT-023 TYPE 'E'.
ENDIF.
IF ZACT02_BOXKOD-MASTER_PATTERN IS NOT INITIAL AND
    ZACT02_BOXKOD-PATTERNSLNO IS NOT INITIAL AND
    ZACT02_BOXKOD-VERSNO IS NOT INITIAL.
CALL METHOD O_CONTROL_EVENTS_DISPLAY->GET_DISPLAY_DATA EXPORTING MASTER_PATTERN = ZACT02_BOXKOD-MASTER_PATTERN
                              PATTERNSLNO = ZACT02_BOXKOD-PATTERNSLNO
                              VERSNO  = ZACT02_BOXKOD-VERSNO
                              CHANGING ZACT02_BOXKOD = ZACT02_BOXKOD
                                       IT_C_DISPLAY  =  IT_DISPLAY
                                       TABC          = TABC.
ENDIF.
ENDIF.
ENDMODULE.                 " MAX_VER  INPUT
*&      Module  CHK_NOBOXES  INPUT
      text
MODULE CHK_NOBOXES INPUT.
CALL METHOD O_CONTROL_EVENTS->I_DATA~NOOFBOX_VAL EXPORTING BMSCH = ZACT02_BOXKOD-BMSCH.
ENDMODULE.                 " CHK_NOBOXES  INPUT
*&      Module  CHK_TOTTIME  INPUT
      text
MODULE CHK_TOTTIME INPUT.
CALL METHOD O_CONTROL_EVENTS->I_DATA~TOTTIME_VAL EXPORTING VGW01 = ZACT02_BOXKOD-VGW01.
ENDMODULE.                 " CHK_TOTTIME  INPUT
*&      Module  STATUS_0100  OUTPUT
      text
MODULE STATUS_0100 OUTPUT.
  SET PF-STATUS 'INITIAL'.
  SET TITLEBAR 'STANDARD_MAIN'.
ENDMODULE.                 " STATUS_0100  OUTPUT
*&      Module  EXIT_PROGRAM  INPUT
      text
MODULE EXIT_PROGRAM INPUT.
LEAVE TO TRANSACTION 'ZAC16'.
ENDMODULE.                 " EXIT_PROGRAM  INPUT

Similar Messages

  • Links/Docs for Module Pool Programing using abap objects

    Hi all,
    Can anyone send me links/docs related to Module Pool programing using Abap Objects.
    Thanks n Regards
    Maruthi Rao. A

    hi maruthi rao,
    check the below link
    http://abapcode.blogspot.com/2007/06/object-oriented-alv-sample-program-to.html

  • Reusing Standard Classes for Module pool Programming using Abap Objects

    Hi.,
        I debugged the ME21n transaction and found a number of classes such as
             CL_BASIC_MODEL_VIEW_MM
             CL_GENERIC_MODEL_VIEW_MM
             CL_GENERIC_VALUE_MODEL_MM
             CL_MODEL_CONTAINER_MM
             CL_MODEL_CONTROL_VIEW_MM
             CL_MODEL_VIEW_MM
             CL_TABLE_MODEL_MM
             CL_TABLE_MODEL_TREE_VIEW_MM
             CL_VALUE_MODEL_MM
             CL_VALUE_MODEL_VIEW_MM
             CL_BASIC_MODEL_VIEW_MM
            CL_COMPOSITE_SCREEN_VIEW_M
            CL_CUSTOM_CONTROL_VIEW_MM
            CL_EXPAND_BUTTON_VIEW_MM
            CL_EXPAND_VIEW_MM
            CL_FOREIGN_APPLICATION_VIE
            CL_GENERIC_MODEL_VIEW_MM
            CL_GRID_VIEW_MM
            CL_MODEL_CONTROL_VIEW_MM
           CL_MODEL_VIEW_MM
           CL_SCREEN_VIEW_MM
          CL_SETUPVIEW_BUILDER_MM
            CL_SIMPLE_TREE_VIEW_MM
             CL_TABLE_MODEL_TREE_VIEW_M
             CL_TABLE_VIEW_CONTAINER_MM
             CL_TABLE_VIEW_MM
             CL_TABSTRIP_VIEW_MM
             CL_TC_BUTTON_VIEW_MM
             CL_TC_ITEM_VIEW_MM
             CL_TOGGLE_VIEW_MM
             CL_VALUE_MODEL_VIEW_MM
             CL_DEFAULT_CONTROLLER_MM
             CL_CONTROLLER_MM
             CL_ATP_CONTROLLER_MM
             CL_DRAG_DROP_CONTROLLER_MM  ..
                   How we can reuse these classes to build a custom module pool program which supports MVC architecture as used in enjoy SAP transactions .I am very much confused from where to start .
    Guide me on this.I want to create a simple module pool program with Subscreens, Table Controls and Tabstrips ..
    Regards.,
    S.Sivakumar

    Have you got any solution on this.
    because i want to use CL_GRID_VIEW_MM->handle_on_data_changed for one of my development related to ME51N.

  • Creating module pool programming in abap objects

    Hello...
    I just wanted to know how u create a give modulepool programming in classes and objects.Could anyone tell me the procedure how to do so.And i knew that module pool programming has become obsolete and now everyone are using object oriented concept in module pool programming.soo i want why r they using soo and what is the drawback in using the module pool programming instead of oops concepts.Could anyone give me the clear explanation..

    Hello Chadipriya,
    You can create module pool program for both ABAP and ABAP OO(Object Oriented).
    The thing is in OO u have to declare classes,objects and methods.
    <b>Procedure oriented approach</b>
    1. Emphasis on tasks
    2. Large programs are divided into smaller programs known as functions
    3. Most of the functions share global data
    4. Data move openly around the system from function to function
    <b>Object oriented approach</b>
    Emphasis on things that does those tasks
    Programs are divided into objects
    3.    Data structures are designed such that they characterized the objects
    4.    Functions that operate on the data of an object are tied together in the data structure
    5.    Data can be hidden and cannot be accessed by external functions
    6.    New data and functions can be easily added whenever necessary
    Go to SE80 ---> Select Program ---> Give ur program name and type this code below :-
    REPORT  YSUBDEL LINE-SIZE 120.
    CLASS parentclass DEFINITION .
    PUBLIC SECTION.
      DATA : commondata(30) type c value 'Accessible to all'.
      METHODS : SHOWVAL.
    PROTECTED SECTION.
      DATA : protectdata(40) type c value 'Protected data'.
    private section.
    data : privatedata(30) type c value 'Private data'.
    ENDCLASS.
    CLASS parentclass IMPLEMENTATION.
    METHOD : SHOWVAL.
      write:/5 'All data from parentclass shown:-'.
      write:/ sy-uline.
      WRITE:/5 COMMONDATA,
            /5 PROTECTDATA,
            /5 PRIVATEDATA.
    endmethod.
    endclass.
    CLASS childclass DEFINITION INHERITING FROM parentclass.
    PUBLIC SECTION .
    METHODS : subval.
    ENDCLASS.
    CLASS childclass IMPLEMENTATION.
    method : subval.
      skip 1.
      write:/5 'Data of parent shown from child-'.
      write:/5 sy-uline.
      WRITE:/5 COMMONDATA,
            /5 PROTECTDATA.
      Commondata = 'Public data changed in subclass'.
      Protectdata = 'Protected data changed in subclass'.
      write:/5 sy-uline.
      WRITE:/5 COMMONDATA,
            /5 PROTECTDATA.
    endmethod.
    endclass.
    You r using OOPs concepts in module pool program and not  module pool programming instead of oops concepts.
    <b>Reward points if helpful</b>
    Thanks,
    Sachin

  • Module pool programming with Abap Objects

    Hi masters,
    Somebody tell me that you can directly call a local class in a module pool.
        Is that possible?
        Can anybody refer me to any kind of information?
    Thanks a lot.

    Well, thanks for the answer, but not was the one i was waiting for... it wasn't helpful.
    But, i've continued searching for answers... and i've found that:
    OO Transactions Locate the document in its SAP Library structure
    In transaction maintenance (SE93), you can specify a transaction code as an OO transaction.
    You either link the transaction code to the Transaction Service of the Structure link ABAP Object Services for persistent objects or to a public method of a global or local class of a program. When calling up a transaction that is linked to an instance method, the system automatically generates an instance of the class in its own internal session.
    An example of a link between a transaction code and an instance method of a local class of an unspecified ABAP program:
    Example
    *& Modulpool DEMO_OO_TRANSACTION *
    program DEMO_OO_TRANSACTION.
    class DEMO_CLASS definition.
    public section.
    methods INSTANCE_METHOD.
    endclass.
    class DEMO_CLASS implementation.
    method INSTANCE_METHOD.
    message 'Instance method in local class' type 'I'.
    endmethod.
    endclass.
    The DEMO_OO_TRANSACTION program is a module pool of type M that does not contain any screens or dialog modules. Instead, the program contains the definition of a local class DEMO_CLASS.
    The DEMO_OO_METHOD transaction code is linked to this program as follows:
    The start object of the transaction is Method of a class (OO transaction).
    OO transaction model is not selected.
    The Class Name is DEMO_CLASS.
    The Method is INSTANCE_METHOD.
    Local in program is selected and DEMO_OO_TRANSACTION specified.
    When the transaction is called up, the program is loaded, an instance of the class is created, and the method is executed.
    Leaving content frame
    That's what i wanted.
    I hope it would be helpful for anyone else.

  • Module Pool Program(SAP-ABAP)

    Hi,
      I am trying to put CHAIN..ENDCHAIN logic in PAI module
      to validate screen.
      How sd i use CHAIN..ENDCHAIN ?
      Pls guide me with suitable example.
      I m waiting for ur reply........
    Thanx in Adv.
    Prabhas

    HI,
    See the thread:
    Re: Chain - Endchain  - Selection-Screen
    i copied the below data from SAPHELP for your sake,
    To ensure that one or more PAI modules are only called when several screen fields meet a particular condition, you must combine the calls in the flow logic to form a processing chain. You define processing chains as follows:
    CHAIN.
    ENDCHAIN.
    All flow logic statements between CHAIN and ENDCHAIN belong to a processing chain. The fields in the various FIELD statements are combined, and can be used in shared conditions.
    CHAIN.
    FIELD: <f1>, <f 2>,...
    MODULE <mod1> ON CHAIN-INPUT|CHAIN-REQUEST.
    FIELD: <g1>, <g 2>,...
    MODULE <mod2> ON CHAIN-INPUT|CHAIN-REQUEST.
    ENDCHAIN.
    The additions ON CHAIN-INPUT and ON CHAIN-REQUEST work like the additions ON INPUT and ON REQUEST that you use for individual fields. The exception is that the module is called whenever at least one of the fields listed in a preceding FIELD statement within the chain meets the condition. So <mod1> is called when one of the fields <fi> meets the condition. <mod2> is called when one of the fields <f i> or <g i> meets the condition.
    Within a processing chain, you can combine individual FIELD statements with a MODULE statement to set a condition for a single field within the chain:
    CHAIN.
    FIELD: <f1>, <f 2>,...
    FIELD <f> MODULE <mod1> ON INPUT|REQUEST|*-INPUT
    |CHAIN-INPUT|CHAIN-REQUEST.
    MODULE <mod2> ON CHAIN-INPUT|CHAIN-REQUEST.
    ENDCHAIN.
    The module <mod1> is called when screen field <f> meets the specified condition for individual fields. <mod2> is called when one of the fields <fi> or <f> meets the condition. If you use the addition ON CHAIN-INPUT or ON CHAIN-REQUEST with FIELD <f>, the condition also applies to the entire chain and module <mod1> and <mod2> are both called.
    <i>
    Check this out
    http://help.sap.com/saphelp_nw04/helpdata/en/9f/dbabbd35c111d1829f0000e829fbfe/content.htm
    http://help.sap.com/saphelp_47x200/helpdata/en/d1/801ca2454211d189710000e8322d00/frameset.htm</i>
    Regards
    anver
    Message was edited by: Anversha s

  • How to add ALV button using OO in module pool program using ALV grid

    Hello Gurus!!!
                  Want some tips related how to add button using ALV Grid(OO).
    I want to display the button for search, sort ....
                 Please suggest the step -by-step procedure for implementation of these button.
                 I am designing the code for transaction FB03. Header data has been displayed but want to display the line items.
                 Kindly suggest your answers.
    Thanks,
    Sachin

    Hi,
    CLASS SELSCR_APPLICATION DEFINITION DEFERRED.
    CLASS SELSCR_APPLICATION DEFINITION.
      PUBLIC SECTION.
       METHODS:
            HANDLE_TOOLBAR
            FOR EVENT TOOLBAR OF CL_GUI_ALV_GRID
                IMPORTING E_OBJECT  E_INTERACTIVE,
            HANDLE_USER_COMMAND
            FOR EVENT USER_COMMAND OF CL_GUI_ALV_GRID
                IMPORTING E_UCOMM.
    ENDCLASS.        "SELSCR_APPLICATION DEFINITION
    CLASS SELSCR_APPLICATION IMPLEMENTATION.
      METHOD HANDLE_TOOLBAR.
        DATA: LS_TOOLBAR  TYPE STB_BUTTON.
    append SAVE icon
        CLEAR LS_TOOLBAR.
        MOVE 'SAVE' TO LS_TOOLBAR-FUNCTION.
        MOVE ICON_SYSTEM_SAVE TO LS_TOOLBAR-ICON.
        MOVE 'Save' TO LS_TOOLBAR-QUICKINFO.
        MOVE ' '  TO LS_TOOLBAR-DISABLED.
        APPEND LS_TOOLBAR TO E_OBJECT->MT_TOOLBAR.
        CLEAR LS_TOOLBAR.
      ENDMETHOD.                    "handle_toolbar
      METHOD HANDLE_USER_COMMAND.
        CASE E_UCOMM.
          WHEN 'SAVE'.
              PERFORM UPDATE_FIELDS.
        ENDCASE.
      ENDMETHOD.
    ENDCLASS.                 "SELSCR_APPLICATION IMPLEMENTATION
    these lines should be after calling method SET_TABLE_FOR_FIRST_DISPLAY
    SET HANDLER G_APPLICATION1->HANDLE_TOOLBAR FOR GRID1.
            CALL METHOD grid1->set_toolbar_interactive.
    rgds,
    bharat.

  • Debugging a Module Pool Program(Object Oriented ABAP)

    Hello Experts,
    Could you please advise me on an efficient debugging technoque of Module Pool Program which is based on Object Oriented ABAP?

    Hi
    Debugging Module pool program using ABAP objects is same as debugging any other report/module pool program.
    Click on the Create shortcut icon on the toolbar.
    In the popup window choose "System command" and in the command enter "/h"
    A shortcut on the desktop would be created
    Drag and drop the shortcut to the modal window to set debugging on.
    Approach 2:
    Create a txt file on the desktop with the following lines:
    [FUNCTION]
    Command=/H
    Title=Debugger
    Type=SystemCommandDrag and drop this file to the modal window to set debugging on.
    How do I switch between the Classic and New Debugger
    From within the ABAP workbench, select the Utilities->Settings Menu
    Select the ABAP Editor Tab
    Select the Debugging tab within the ABAP Editor Tab
    Select the Classic Debugger or New Debugger radio button
    Refer to this thread
    http://help.sap.com/saphelp_47x200/helpdata/en/c6/617ca9e68c11d2b2ab080009b43351/content.htm
    Debugging
    Check these documents.
    http://www.cba.nau.edu/haney-j/CIS497/Assignments/Debugging.doc
    http://help.sap.com/saphelp_nw04/helpdata/en/5a/4ed93f130f9215e10000000a155106/frameset.htm
    http://help.sap.com/saphelp_47x200/helpdata/en/c6/617ca9e68c11d2b2ab080009b43351/content.htm
    http://www.cba.nau.edu/haney-j/CIS497/Assignments/Debugging.doc
    http://help.sap.com/saphelp_erp2005/helpdata/en/b3/d322540c3beb4ba53795784eebb680/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/84/1f624f4505144199e3d570cf7a9225/frameset.htm
    http://help.sap.com/saphelp_bw30b/helpdata/en/c6/617ca9e68c11d2b2ab080009b43351/content.htm
    http://help.sap.com/saphelp_erp2005/helpdata/en/b3/d322540c3beb4ba53795784eebb680/frameset.htm
    ABAP Debugging
    http://www.saplinks.net/index.php?option=com_content&task=view&id=24&Itemid=34
    Look at the SAP help link below
    http://help.sap.com/saphelp_nw2004s/helpdata/en/c6/617ca9e68c11d2b2ab080009b43351/content.htm
    Reward points if useful
    Regards
    Anji

  • Table maintenance by using module pool program

    Hi
    Please give me step by step procedure to generate table maintenance by using module pool program

    While creating table maintenance, you can go thro' the module pool program used for that.In that,in PBO part,just try making particular field active = 1 inside loop at screen.
    Girish Kumar Lo...  
    Posts: 1,518
    Questions: 2
    Registered: 4/19/07
    Forum points: 1,982 
       Re: Regarding Table maintanence generator  
    Posted: Jun 26, 2007 9:02 AM    in response to: Younus Khan       Reply      E-mail this post 
    here is the code for that
    REPORT ZTAB_MAINT
           NO STANDARD PAGE HEADING
           MESSAGE-ID ZZ.
                      T Y P E  D E C L A R A T I O N S
    *--Types declaration for selection to be passed as parameter into
    *--VIEW_MAINTENANCE_CALL FM
    TYPES: BEGIN OF TP_RANGETAB.
            INCLUDE STRUCTURE VIMSELLIST.
    TYPES: END OF TP_RANGETAB.
                   D A T A  D E C L A R A T I O N S
    DATA: V_MATNR TYPE MATNR,              " Material Number
          V_WERKS TYPE WERKS_D,              " Plant
          V_KONOB TYPE KONOB,              " Product allocation object
          V_ZCPLT(40) TYPE C.              " Message
           I N T E R N A L  T A B L E  D E C L A R A T I O N S
    Internal table to subroutine code
    *Internal table used as selection for VIEW_MAINTENANCE_CALL FM
    DATA: IT_RANGETAB TYPE STANDARD TABLE OF TP_RANGETAB WITH HEADER LINE.
    *--Internal table used for getting the tablefields
    DATA: BEGIN OF IT_HEADER OCCURS 1.
            INCLUDE STRUCTURE VIMDESC.
    DATA: END   OF IT_HEADER.
    *--Name Tabel
    DATA: BEGIN OF IT_NAMTAB OCCURS 50.
            INCLUDE STRUCTURE VIMNAMTAB.
    DATA: END   OF IT_NAMTAB.
    *--Used for handling 'BT' option
    DATA: BEGIN OF IT_MATNR OCCURS 0,
            MATNR TYPE MATNR,
          END OF IT_MATNR.
    *--Used for handling 'BT' option
    DATA: BEGIN OF IT_WERKS OCCURS 0,
            WERKS TYPE WERKS,
          END OF IT_WERKS.
    *--Used for handling 'BT' option
    DATA: BEGIN OF IT_KONOB OCCURS 0,
            KONOB TYPE KONOB,
          END OF IT_KONOB.
    *--Used for handling 'BT' option
    DATA: BEGIN OF IT_ZCPLT OCCURS 0,
            ZCPLT(40) TYPE C,
          END OF IT_ZCPLT.
                       I N P U T  S C R E E N
    SELECTION-SCREEN BEGIN OF BLOCK SELSCR WITH FRAME TITLE TEXT-001.
    RANGES: R_MATNR FOR V_MATNR.
    RANGES: R_WERKS FOR V_WERKS.
    RANGES: R_KONOB FOR V_KONOB.
    RANGES: R_ZCPLT FOR V_ZCPLT.
    Select Options
    SELECT-OPTIONS: S_MATNR FOR V_MATNR NO-EXTENSION,     " Material
                    S_WERKS FOR V_WERKS NO-EXTENSION,     " Plant
                    S_KONOB FOR V_KONOB NO-EXTENSION,
                                            " Product allocation object
                    S_ZCPLT FOR V_ZCPLT NO-EXTENSION.     " Plant
    SELECTION-SCREEN END OF BLOCK SELSCR.
                 A T  S E L E C T I O N  S C R E E N
    AT SELECTION-SCREEN.
    Validate user inputs
      PERFORM FRM_VALIDATIONS.
                S T A R T  O F  S E L E C T I O N
    START-OF-SELECTION.
    Fetch Data from Data Base
      PERFORM FRM_GET_DATA.
                         S U B  R O U T I N E S
    *&      Form  frm_get_data
          Call the function module VIEW_MAINTENNACE_CALL to get data
          based on selection criteria
    FORM FRM_GET_DATA .
      CALL FUNCTION 'VIEW_GET_DDIC_INFO'
        EXPORTING
          VIEWNAME = 'ZTAB'
        TABLES
          X_HEADER = IT_HEADER
          X_NAMTAB = IT_NAMTAB
          SELLIST  = IT_RANGETAB
        EXCEPTIONS
          NO_TVDIR_ENTRY = 1
          TABLE_NOT_FOUND = 2.
      IF SY-SUBRC <> 0.
        MESSAGE E002 WITH 'Error in ZTAB table'(005).
      ENDIF.
      CLEAR: IT_RANGETAB,
             IT_RANGETAB[].
      LOOP AT IT_NAMTAB.
        CASE IT_NAMTAB-VIEWFIELD.
          WHEN 'MATNR'.
            CLEAR IT_RANGETAB.
            IT_RANGETAB-VIEWFIELD = 'MATNR'.
            IT_RANGETAB-TABIX     = SY-TABIX.
            IT_RANGETAB-DDIC      = IT_NAMTAB-READONLY.
            LOOP AT S_MATNR.
              CASE S_MATNR-OPTION.
                WHEN 'EQ'.
                  IT_RANGETAB-AND_OR    = 'AND'.
                  IT_RANGETAB-OPERATOR  = 'EQ'.
                  IT_RANGETAB-VALUE     = S_MATNR-LOW.
                  APPEND IT_RANGETAB.
                WHEN 'BT'.
                  IT_RANGETAB-AND_OR    = 'AND'.
                  IT_RANGETAB-OPERATOR = 'GE'.
                  IT_RANGETAB-VALUE     = S_MATNR-LOW.
                  APPEND IT_RANGETAB.
                  IT_RANGETAB-AND_OR    = 'AND'.
                  IT_RANGETAB-OPERATOR = 'LE'.
                  IT_RANGETAB-VALUE     = S_MATNR-HIGH.
                  APPEND IT_RANGETAB.
                WHEN 'NB'.
                  CLEAR: R_MATNR,
                         R_MATNR[].
                  R_MATNR-SIGN = 'I'.
                  R_MATNR-OPTION = 'BT'.
                  R_MATNR-LOW = S_MATNR-LOW.
                  R_MATNR-HIGH = S_MATNR-HIGH.
                  APPEND R_MATNR.
                  SELECT MATNR
                         INTO TABLE IT_MATNR
                         FROM ZTAB
                         WHERE MATNR IN R_MATNR.
                  DELETE ADJACENT DUPLICATES FROM IT_MATNR COMPARING MATNR
                  LOOP AT IT_MATNR.
                    IT_RANGETAB-AND_OR    = 'AND'.
                    IT_RANGETAB-OPERATOR = 'NE'.
                    IT_RANGETAB-VALUE    = IT_MATNR-MATNR.
                    APPEND IT_RANGETAB.
                  ENDLOOP.
                WHEN 'NE'.
                  IT_RANGETAB-AND_OR    = 'AND'.
                  IT_RANGETAB-OPERATOR  = 'NE'.
                  IT_RANGETAB-VALUE     = S_MATNR-LOW.
                  APPEND IT_RANGETAB.
                WHEN OTHERS.
                  IT_RANGETAB-AND_OR    = 'AND'.
                  IT_RANGETAB-OPERATOR = S_MATNR-OPTION.
                  IT_RANGETAB-VALUE    = S_MATNR-LOW.
                  APPEND IT_RANGETAB.
              ENDCASE.
            ENDLOOP.
          WHEN 'WERKS'.
            CLEAR IT_RANGETAB.
            IT_RANGETAB-VIEWFIELD = 'WERKS'.
            IT_RANGETAB-TABIX     = SY-TABIX.
            IT_RANGETAB-DDIC      = IT_NAMTAB-READONLY.
            LOOP AT S_WERKS.
              CASE S_WERKS-OPTION.
                WHEN 'EQ'.
                  IT_RANGETAB-AND_OR    = 'AND'.
                  IT_RANGETAB-OPERATOR  = 'EQ'.
                  IT_RANGETAB-VALUE     = S_WERKS-LOW.
                  APPEND IT_RANGETAB.
                WHEN 'BT'.
                  IT_RANGETAB-AND_OR    = 'AND'.
                  IT_RANGETAB-OPERATOR = 'GE'.
                  IT_RANGETAB-VALUE     = S_WERKS-LOW.
                  APPEND IT_RANGETAB.
                  IT_RANGETAB-AND_OR    = 'AND'.
                  IT_RANGETAB-OPERATOR = 'LE'.
                  IT_RANGETAB-VALUE     = S_WERKS-HIGH.
                  APPEND IT_RANGETAB.
                WHEN 'NB'.
                  CLEAR: R_WERKS,
                         R_WERKS[].
                  R_WERKS-SIGN = 'I'.
                  R_WERKS-OPTION = 'BT'.
                  R_WERKS-LOW = S_WERKS-LOW.
                  R_WERKS-HIGH = S_WERKS-HIGH.
                  APPEND R_WERKS.
                  SELECT WERKS
                         INTO TABLE IT_WERKS
                         FROM MARC
                         WHERE WERKS IN R_WERKS.
                  DELETE ADJACENT DUPLICATES FROM IT_WERKS COMPARING WERKS
                  LOOP AT IT_WERKS.
                    IT_RANGETAB-AND_OR    = 'AND'.
                    IT_RANGETAB-OPERATOR = 'NE'.
                    IT_RANGETAB-VALUE    = IT_WERKS-WERKS.
                    APPEND IT_RANGETAB.
                  ENDLOOP.
                WHEN 'NE'.
                  IT_RANGETAB-AND_OR    = 'AND'.
                  IT_RANGETAB-OPERATOR  = 'NE'.
                  IT_RANGETAB-VALUE     = S_WERKS-LOW.
                  APPEND IT_RANGETAB.
                WHEN OTHERS.
                  IT_RANGETAB-AND_OR    = 'AND'.
                  IT_RANGETAB-OPERATOR = S_WERKS-OPTION.
                  IT_RANGETAB-VALUE    = S_WERKS-LOW.
                  APPEND IT_RANGETAB.
              ENDCASE.
            ENDLOOP.
          WHEN 'KONOB'.
            CLEAR IT_RANGETAB.
            IT_RANGETAB-VIEWFIELD = 'KONOB'.
            IT_RANGETAB-TABIX     = SY-TABIX.
            IT_RANGETAB-DDIC      = IT_NAMTAB-READONLY.
            LOOP AT S_KONOB.
              CASE S_KONOB-OPTION.
                WHEN 'EQ'.
                  IT_RANGETAB-AND_OR    = 'AND'.
                  IT_RANGETAB-OPERATOR  = 'EQ'.
                  IT_RANGETAB-VALUE     = S_KONOB-LOW.
                  APPEND IT_RANGETAB.
                WHEN 'BT'.
                  IT_RANGETAB-AND_OR    = 'AND'.
                  IT_RANGETAB-OPERATOR = 'GE'.
                  IT_RANGETAB-VALUE     = S_KONOB-LOW.
                  APPEND IT_RANGETAB.
                  IT_RANGETAB-AND_OR    = 'AND'.
                  IT_RANGETAB-OPERATOR = 'LE'.
                  IT_RANGETAB-VALUE     = S_KONOB-HIGH.
                  APPEND IT_RANGETAB.
                WHEN 'NB'.
                  CLEAR: R_KONOB,
                         R_KONOB[].
                  R_KONOB-SIGN = 'I'.
                  R_KONOB-OPTION = 'BT'.
                  R_KONOB-LOW = S_KONOB-LOW.
                  R_KONOB-HIGH = S_KONOB-HIGH.
                  APPEND R_KONOB.
                  SELECT KONOB
                         INTO TABLE IT_KONOB
                         FROM T190
                         WHERE KONOB IN R_KONOB.
                  DELETE ADJACENT DUPLICATES FROM IT_KONOB COMPARING KONOB
                  LOOP AT IT_KONOB.
                    IT_RANGETAB-AND_OR    = 'AND'.
                    IT_RANGETAB-OPERATOR = 'NE'.
                    IT_RANGETAB-VALUE    = IT_KONOB-KONOB.
                    APPEND IT_RANGETAB.
                  ENDLOOP.
                WHEN 'NE'.
                  IT_RANGETAB-AND_OR    = 'AND'.
                  IT_RANGETAB-OPERATOR  = 'NE'.
                  IT_RANGETAB-VALUE     = S_KONOB-LOW.
                  APPEND IT_RANGETAB.
                WHEN OTHERS.
                  IT_RANGETAB-AND_OR    = 'AND'.
                  IT_RANGETAB-OPERATOR = S_KONOB-OPTION.
                  IT_RANGETAB-VALUE    = S_KONOB-LOW.
                  APPEND IT_RANGETAB.
              ENDCASE.
            ENDLOOP.
          WHEN 'ZCPLT'.
            CLEAR IT_RANGETAB.
            IT_RANGETAB-VIEWFIELD = 'ZCPLT'.
            IT_RANGETAB-TABIX     = SY-TABIX.
            IT_RANGETAB-DDIC      = IT_NAMTAB-READONLY.
            LOOP AT S_ZCPLT.
              CASE S_ZCPLT-OPTION.
                WHEN 'EQ'.
                  IT_RANGETAB-AND_OR    = 'AND'.
                  IT_RANGETAB-OPERATOR  = 'EQ'.
                  IT_RANGETAB-VALUE     = S_ZCPLT-LOW.
                  APPEND IT_RANGETAB.
                WHEN 'BT'.
                  IT_RANGETAB-AND_OR    = 'AND'.
                  IT_RANGETAB-OPERATOR = 'GE'.
                  IT_RANGETAB-VALUE     = S_ZCPLT-LOW.
                  APPEND IT_RANGETAB.
                  IT_RANGETAB-AND_OR    = 'AND'.
                  IT_RANGETAB-OPERATOR = 'LE'.
                  IT_RANGETAB-VALUE     = S_ZCPLT-HIGH.
                  APPEND IT_RANGETAB.
                WHEN 'NB'.
                  CLEAR: R_ZCPLT,
                         R_ZCPLT[].
                  R_ZCPLT-SIGN = 'I'.
                  R_ZCPLT-OPTION = 'BT'.
                  R_ZCPLT-LOW = S_ZCPLT-LOW.
                  R_ZCPLT-HIGH = S_ZCPLT-HIGH.
                  APPEND R_ZCPLT.
                  SELECT ZCPLT
                         INTO TABLE IT_ZCPLT
                         FROM ZTAB
                         WHERE ZCPLT IN R_ZCPLT.
                  DELETE ADJACENT DUPLICATES FROM IT_ZCPLT COMPARING ZCPLT
                  LOOP AT IT_ZCPLT.
                    IT_RANGETAB-AND_OR    = 'AND'.
                    IT_RANGETAB-OPERATOR = 'NE'.
                    IT_RANGETAB-VALUE    = IT_ZCPLT-ZCPLT.
                    APPEND IT_RANGETAB.
                  ENDLOOP.
                WHEN 'NE'.
                  IT_RANGETAB-AND_OR    = 'AND'.
                  IT_RANGETAB-OPERATOR  = 'NE'.
                  IT_RANGETAB-VALUE     = S_ZCPLT-LOW.
                  APPEND IT_RANGETAB.
                WHEN OTHERS.
                  IT_RANGETAB-AND_OR    = 'AND'.
                  IT_RANGETAB-OPERATOR = S_ZCPLT-OPTION.
                  IT_RANGETAB-VALUE    = S_ZCPLT-LOW.
                  APPEND IT_RANGETAB.
              ENDCASE.
            ENDLOOP.
        ENDCASE.
      ENDLOOP.
      IF S_ZCPLT[] IS INITIAL.
        CALL FUNCTION 'VIEW_MAINTENANCE_CALL'
          EXPORTING
            ACTION      = 'U'
            VIEW_NAME   = 'ZTAB'
          TABLES
            DBA_SELLIST = IT_RANGETAB
          EXCEPTIONS
            CLIENT_REFERENCE                     = 1
            FOREIGN_LOCK                         = 2
            INVALID_ACTION                       = 3
            NO_CLIENTINDEPENDENT_AUTH            = 4
            NO_DATABASE_FUNCTION                 = 5
            NO_EDITOR_FUNCTION                   = 6
            NO_SHOW_AUTH                         = 7
            NO_TVDIR_ENTRY                       = 8
            NO_UPD_AUTH                          = 9
            ONLY_SHOW_ALLOWED                    = 10
            SYSTEM_FAILURE                       = 11
            UNKNOWN_FIELD_IN_DBA_SELLIST         = 12
            VIEW_NOT_FOUND                       = 13
            MAINTENANCE_PROHIBITED               = 14
            OTHERS                               = 15.
        IF SY-SUBRC <> 0.
          MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
      ELSE.
        CALL FUNCTION 'VIEW_MAINTENANCE_CALL'
          EXPORTING
            ACTION      = 'U'
            VIEW_NAME   = 'ZTAB_ZTEST'
          TABLES
            DBA_SELLIST = IT_RANGETAB
          EXCEPTIONS
            CLIENT_REFERENCE                     = 1
            FOREIGN_LOCK                         = 2
            INVALID_ACTION                       = 3
            NO_CLIENTINDEPENDENT_AUTH            = 4
            NO_DATABASE_FUNCTION                 = 5
            NO_EDITOR_FUNCTION                   = 6
            NO_SHOW_AUTH                         = 7
            NO_TVDIR_ENTRY                       = 8
            NO_UPD_AUTH                          = 9
            ONLY_SHOW_ALLOWED                    = 10
            SYSTEM_FAILURE                       = 11
            UNKNOWN_FIELD_IN_DBA_SELLIST         = 12
            VIEW_NOT_FOUND                       = 13
            MAINTENANCE_PROHIBITED               = 14
            OTHERS                               = 15.
        IF SY-SUBRC <> 0.
          MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
      ENDIF.
    ENDFORM.                    " frm_get_data
    *&      Form  frm_validations
          Validating field values
    FORM FRM_VALIDATIONS .
    Material number should not be validated (10/17/2005)
      CLEAR V_MATNR.
      SELECT SINGLE MATNR
                    INTO V_MATNR
                    FROM MARA
                    WHERE MATNR IN S_MATNR.
      IF SY-SUBRC <> 0.
        MESSAGE E002 WITH 'Material not found'.
      ENDIF.
      CLEAR V_WERKS.
      SELECT SINGLE WERKS
                    INTO V_WERKS
                    FROM ZTAB
                    WHERE WERKS IN S_WERKS.
      IF SY-SUBRC <> 0.
        MESSAGE E002 WITH 'Plant (WERKS) not found'(002).
      ENDIF.
      CLEAR V_KONOB.
      SELECT SINGLE KONOB
                    INTO V_KONOB
                    FROM ZTAB
                    WHERE KONOB IN S_KONOB.
      IF SY-SUBRC <> 0.
        MESSAGE E002 WITH ' Product allocation object not found'(003).
      ENDIF.
      CLEAR V_WERKS.
      SELECT SINGLE WERKS
                    INTO V_WERKS
                    FROM ZTAB
                    WHERE WERKS IN S_ZCPLT.
      IF SY-SUBRC <> 0.
        MESSAGE E002 WITH 'Plant (ZCPLT) not found'(004).
      ENDIF.
    ENDFORM.                    " frm_validations
    reward points if it is usefull ...
    Regarding Table maintanence generator

  • How to write module pool program

    hai,
    what is the module -pool program ?
    what are the procedures to write the module-pool program.
    plz give the simple program for module-pool programs?
    regards
    surender

    Hi
    This component though is not attached to the screen painter, plays important role in transaction. Normally, for reports, on line executable programs are written but for transaction, Module Pool Programs are written. The module pool program contains only modules to handle various events associated with screen and data declaration statements.
    System divides the module pool program into several include program. These are global field, PBO modules, and PAI modules. It is entirely user’s decision whether to use these modules or write directly into main program.
    Creation of Module Pool Program
    You can create module pool program either through
    Object browser
    System automatically creates the module pool program and for these program which are created through object browser, system creates the include modules.
    Or
    ABAP/4 editor
    It is similar to normal program creation. Type of program should be given ‘M’ and is not created by system.
    Communication between Dynpro and Module Program
    For each screen, the system executes the flow logic, which contains corresponding events. The control is passed to Module Pool Program. Module Pool Program handles the code for these events and again passes back control to the flow logic and finally to screen. Unlike on line program, in this case, the control remains with flow logic. The switching of control between flow logic and module pool program and back is common process when user executes transaction.
    Creation of a Complete Transaction
    Steps involved to create a complete transaction
    •     Create module pool program.
    •     From screen painter create screens.
    •     Write flow logic for each screen.
    •     Write code for all the events in module pool program.
    •     Check for any error in screen and flow logic.
    •     Generate each and every component of screen i.e. flow logic and screen.
    •     Single screen can be tested using Screen Painter.
    •     Create transaction code through object browser.
    •     Generate the transaction code.
    •     User can execute the transaction by entering the transaction code in the command field.
    Handling Function Code
    The function code or OKCODE is the last field of Field list. Function code can be handled as follows:
    During the Designing of the screen, a function code is assigned to pushbutton.
    •     In field list, developer needs to specify OKCODE as last field.
    •     In module program it is a global field and can be evaluated in the PAI event.
    •     A function code is treated in the same way, regardless it comes from pushbutton, menu item or any other GUI element.
    When the user clicks on the Display button, you want to display details of sflight, with corresponding carrid and connid (which is entered by the user).
    Module pool program to handle this particular screen is as follows:
    Program YVTEST7.
    TABLES: SFLIGHT.
    DATA: OKCODE (4).
    MODULE INPUT1 INPUT,
    CASE OKCODE.
       WHEN ‘DISP’.
         SELECT * FROM SFLIGHT
                WHERE CARRID =  SFLIGHT – CARRID AND
                               CONNID = SFLIGHT – CONNID.
         ENDSELECT.
         LEAVE TO SCREEN 200.
       WHEN ‘EXIT’.  LEAVE TO SCREEN 0.
      ENDCASE.
    ENDMODULE.               “INPUT1 INPUT
    MODULE USER_COMMAND_0200 INPUT.
    CASE OKCODE.
    WHEN ‘BACK’. LEAVE TO SCREEN 100.
    ENDCASE.
    ENDMODULE.                    “USER_COMMAND_0200 INPUT
    When the user clicks on display, control is transferred to screen no. 200 on which you display sflight details & on the same screen, when user clicks on BACK button, he comes back to main screen.
    Flow logic for screen 100 is as follows:
    PROCESS AFTER INPUT.
    MODULE INPUT.
    Flow logic for screen 200
    PROCESS AFTER INPUT.
    USER_COMMAND_0200.
    MODULES: Modules are handled in module pool program.
    You need to write flow logic for screen 200 and design screen 200.
    In case of transaction transfer of data from program to screen is automatic i.e. you need not transfer the data from program to screen explicitly. The fields, which you define in the screen receives the data from program and displays the same.
    The Field Checks
    As already mentioned Transaction is the only method, which SAP recommends to update the database tables. Data entered in the database table should be valid and correct. Data entered is validated at each and every point. ABAP/4 offers various methods to validate data and those are as follows:
    •     Automatic field checks
    •     Checks performed in the flow logic
    •     Checks performed in the ABAP/4 module pool program
    Automatic Field Checks
    These checks are based on the field information stored in the dictionary. These checks are performed by the system automatically when the user enters the data for the screen field. System performs these checks before PAI event is triggered. Types of field checks performed by system are as follows:
    •     Required input
    While designing the screen, for particular screen field if you click the Req. Entry checkbox, the field becomes mandatory. When the transaction is executed if user leaves this particular field blank, the system displays error message. User cannot proceed until the user enters some data.
    •     Proper Data Format
    Each field has its own data format whether it is table field or screen field. Whenever data is entered, system checks for the proper format of the data. For example date. Each user has its own format for date, which is defined in the user master record. If the date defined in the user master record is in the format DD/MM/YYYY, if the user enters the date, say, in YY/DD/MM, the user displays the error message. System also checks for the value of month or days. For example if month entered is greater than twelve then the error message is displayed.
    •     Valid Value for the Field
    In data dictionary two tables are related by Primary key-Foreign key relationship.  Whenever the user enters the data, the system checks for the check table values.   Also in Domain, if you have fixed values, then the system checks for these values.
    Automatic field checks are repeated each time the user enters the data.
    About at Exit – Command
    Automatic field checks can be avoided by AT EXIT-COMMAND, which works exactly the same way as Cancel works on application tools bar. In the R/3 screen, if you want to quit the processing of that particular screen without entering the mandatory fields, user can click the Cancel button. Same functionality can be incorporated in the user-defined transaction by using AT EXIT-COMMAND. This module can be called before the system executes the automatic field checks and it goes without saying that before PAI event. Code for AT EXIT-COMMAND in flow logic and in module pool program can be written as follows:
    In Flow Logic
    Process After Input.
    Module exit AT EXIT-COMMAND.
             In module pool program.
    Module exit.
    Case okcode.
    When ‘Exit’.
    Leave to screen 0.
    To achieve this kind of functionality a pushbutton or menu item should be assigned a function type ‘E’. It tells the system to process this particular module before carrying out any field checks.
    Flow Logic Validations
    Consider the case where you want user to enter only ‘LH’ and ‘SQ’ for sflight-carrid. In this case, you are restricting value of a screen field. This cannot be achieved by automatic field check. Hence there is a need of additional validation. It can be done in flow logic by using following statement:
    Field -
    Values
    Syntax
    PAI.
    Field sflight-carrid values (‘LH’).
    For multiple values
    PAI.
    Field sflight-carrid values (‘LH’ ‘SQ’).
    Field sflight-price values (between 1000 and 2000).
    In this case when the user enters the value, PAI is triggered  and field is checked for  that particular value. If the value entered happens to be wrong, that field is enabled for user to enter. If you have multiple Field statements in your flow logic, it is sequential execution.
    Consider the following case:
    PAI.
    Module  assign.
    Field sflight-carrid values (‘LH’ ‘SQ’).
    In ABAP/4
    Module  assign.
    Data: carrid1 like sflight-carrid.
    Carrid1 = sflight-carrid.
    Endmodule.
    In this case, Sflight-carrid is used in the flow logic before the field statement. The system will give invalid value or some previous value as the field sflight-carrid is used in module before it is checked i.e., field statement is after the module in which sflight-carrid is being used. The field is not available to the system unless it executes the field statement. Field statement transfers the values to the program and is done only once. If you don’t have Field statement in your flow logic, transfer of values takes place in PAI event.
    Consider one more case where you have multiple field statement
    PAI.
    Field Sflight-carrid values (‘LH’).
    Field Sflight-connid values (‘0400’ ‘0500’).
    In this case if the user enters only carrid wrong, then this particular field is enabled and rest of the fields are disabled for user to input. Many times if the user enters wrong value for one field, then you might want to give option to user to enter all the fields, which is not possible by using Field statement only. This functionality can be achieved by CHAIN – ENDCHAIN.
    Syntax
    Chain.
    Field sflight-carrid value (‘LH’).
         Field sflight-connid values (between ‘200’ and ‘500’).
    Endchain.
    Field sflight-price values (‘100’ ‘1000’).
    In this case, if the user enters wrong value only for carrid, both the fields i.e. carrid and connid are enabled as they are grouped together in the Chain statement. The field price will be disabled for input. Usually, logically related fields are grouped together with Chain-Endchain statement.
    Module Pool Program Validations
    Checking fields ABAP/4 program includes
    •     Field statement in flow logic.
    •     Module statement in ABAP/4 module pool Program.
    Syntax
    PAI.
    Field sflight-carrid module <name>.
    This module can be handled in the main program i.e. module pool program.
    In ABAP/4 program
    Module Check.
    Select single * from sflight where carrid = sflight-carrid.
    If sy-subrc ne 0.
         Message e001.
    Endif.
    In this case, field sflight-carrid is checked in the table for its existence.
    Dynamically Calling the Screens
    About Displaying Next Screen
    Transaction is a sequence of screens, which are displayed one after the other. The next screen displayed depends upon the attributes of first screen. In attributes you need to give Next Screen number i.e. if next screen displayed should be 200 screen, then this number should be given in next Screen attributes. These are static attributes of the screen. By default, if nothing is specified in the program, the system branches out to the screen number, which is specified in the attribute screen.
    In this case, if user selects MARA pushbutton, then fields from Mara table are displayed. When the user clicks on the MARD, then the fields from MARD table are displayed. Depending upon users selection, the screen is branched out and this has to be done during runtime. This functionality can be achieved by dynamically calling the screen in module pool program.
    The screen can branch out to new screen depending upon user selection. Following command in module pool program can do this:
    •     SET SCREEM
    •     CALL SCREEN
    •     LEAVE TO SCREEN <NUMBER>
    All these commands override the specifications given in the attributes. This overriding is temporary. The values stored in the attribute are not changed.
    Set Screen
    Syntax
    Set screen <number>.
    In module pool program
    Case okcode.
         When  ‘DISP’.
              Set screen 200.
         When ‘LIST’.
              Set screen 300.
    Endcase.
    In this case, the entire processing of current screen takes place and then the system branches out to next screen. If you want to branch out to the next screen without processing the current screen, LEAVE SCREEN should be used along with the SET SCREEN.
    For Example:
    Case okcode..
         When  ‘DISP’.
              Set screen 200.
              Leave Screen.
         When ‘LIST’.
              Set screen 300.
              Leave Screen.
    Endcase.
    When SET SCREEN is used, control cannot be transferred to the main screen or previous screen, unless you write code for the same.
    Call Screen
    Usually used for pop up screens. Many times, there is a need for user to enter additional information or secondary information on another screen or pop up screen. Once the user enters the data, he should be able to go back to main screen or to the screen where he started. This is not possible by using SET SCREEN. CALL SCREEN achieves this functionality.
    Syntax
    Call Screen 200.
    Will simply call a screen number 200 from a main screen. Once the screen is displayed the user can enter all the data and return to the main screen by clicking BACK button.
    To call screen as pop up screen the syntax is
    Call screen starting at <col.no.> <line no>
                         Ending at <col no> <line no>.
    In this case window will be popped as window and user can close it by using BACK button.
    Leave to screen
    To SET a new screen without processing current screen, you need to use the following two statements together:
    SET SCREEN 200.
    LEAVE SCREEN.
    Or a Single statement
    LEAVE TO SCREEN 200.

  • Reg  module pool programming

    Hi,
    iam developing object on modulepool.
    can u pls send examples objects on modulepools.
    thank

    hi ,
    Here you go ....
    Creation of table controls in mpools
    Here you go with the  complete steps  for creating module pool programs  using table control:
    open se51, choose the icon like a table for table control . drag it and then place it in your screen . click on F6 and you will get a screen where youi need to provide the table name / field name that ( fields ) you are going to use in the screen and table control. after giving the ztable name click on get it from dictionary . you will get the list of available fields in a table. next choose the fields you wish to place in the table control , and if you want to place all fields in your table control then select every fields . after this you will get a structure which you should drag place inside the table control area .
    double click on the table control , set the proper attributes, tickmark the horizontal and vertical scroll bars to appear in your TC in the screen . save , check and activate ..
    following are the sample code you should follow to display datas in your table control ..
    write the following code in the flow logic of the screen ............
    process before output.
    module tc_01_init.
    loop at g_tc_01_itab
    into g_tc_01_wa
    with control tc_01
    cursor tc_01-current_line.
    module tc_01_move.
    module tc_01_get_lines.
    endloop.
    module status_0001.
    process after input.
    loop at g_tc_01_itab.
    chain.
    field sflight-carrid.
    field sflight-connid.
    field sflight-fldate.
    module tc_01_modify on chain-request.
    endchain.
    endloop.
    module tc_01_user_command.
    Write the following code in your Zmodulepool program !!
    program z_tst_mpool_tc_01.
    data: begin of l_tab_sflight occurs 10,
    carrid like sflight-carrid,
    connid like sflight-connid,
    fldate like sflight-fldate,
    end of l_tab_sflight.
    tables: sflight.
    types: begin of t_tc_01,
    carrid like sflight-carrid,
    connid like sflight-connid,
    fldate like sflight-fldate,
    end of t_tc_01.
    data: g_tc_01_itab type t_tc_01 occurs 0,
    g_tc_01_wa type t_tc_01. "work area
    data: g_tc_01_copied. "copy flag
    controls: tc_01 type tableview using screen 0001.
    data: g_tc_01_lines like sy-loopc.
    data: ok_code like sy-ucomm.
    include z_tst_mpool_tc_01_pbo .
    include z_tst_mpool_tc_01_pai .
    include z_tst_mpool_tc_01_incl01 .
    include z_tst_mpool_tc_01_status_0001.
    include Z_TST_MPOOL_TC_01_PBO .
    inside include
    module tc_01_init output.
    if g_tc_01_copied is initial.
    select * from sflight
    into corresponding fields
    of table g_tc_01_itab.
    g_tc_01_copied = 'X'.
    refresh control 'TC_01' from screen '0001'.
    endif.
    endmodule.
    module tc_01_move output.
    move-corresponding g_tc_01_wa to sflight.
    endmodule.
    module tc_01_get_lines output.
    g_tc_01_lines = sy-loopc.
    endmodule.
    Revert if further assistance needed ...
    Regards,
    Ranjita

  • Checkbox issue in module pool program

    Hi all,
    I have a small issue in a module pool program using checkboxes. The requirement is that my basic list should contain the data with checkboxes and as per the selection by the user, the selected records should appear in the next screen (secondary list). But after selection, all the records barring the last record is appearing in my secondary list. Below are the screenshots of my program:
    These are the global variables I declared:
    The layout for the  basic list is as shown. The function code is cbox for checkbox.
    The flow logic :
    The code for user-command:
    Now on executing the program,
    As you can see, sales orders 4970,4972,4974 and 4975 are selected. So after clicking NEXT, in the secondary list , the data for these selected sales orders from VBAP table should come up. But instead, the records from 4970, 4972 and 4974 are displayed except the last sales order which is 4975.
    This is happening for all the records. The last selected sales order is not getting selected. Why is it so?
    Thanks.
    Manish

    Hi Ali,
    I have modified the code but there are still a couple of things which are confusing me. In the below screenshot you can see the modified version of the code:
    Now to see what is going wrong, I tried to debug the code. I placed the breakpoint on 'NEXT' as shown. Then I selected the following sales orders and pressed NEXT.
    In the debugger, IT_VBAK1 correctly holds the 2 selected values:
    IT_VBAP displays the values correctly as well.
    Now, this is where the issue is. On clicking the BACK button and selecting another sales order (4974):
    IT_VBAK1 holds the additional sales order 4974 along with the previous ones as well:
    IT_VBAP also displays the values accordingly as per the debugger:
    But in the table control, the sales order 4974 is not displayed. Only the initial sales orders are displayed.
    1) There is nothing wrong with the code as the debugger shows the records are held and displayed correctly by the internal tables. So what could be the reason for the data not to be displayed correctly in the table control? I also tried refreshing IT_VBAP after the BACK button, but still it isnt working. 
    2) Also, another thing I've seen that is after clicking the BACK button, when I select the sales orders, only data from 2 sales orders are displayed in the secondary list.
    For example, if I select any number of sales orders and press NEXT, then all the data are displayed correctly in the secondary list. Once I click the BACK button and deselect all of them and then I checkbox 3 sales orders (more than 2), then only the records for 2 sales orders are displayed, not the 3rd one.   Why is this happening?
    Regards
    Manish.

  • Reg : Variant saving for Module Pool Programming

    Hey Friends,
       Plz help me in how to create variant for Module Pool Programming as in normal reports.Thanx in advance.

    Hi,
    You can create variants for Module pool program using the transaction SHD0. You can create Screen variants for your screens using this Tcode.
    Go to SHD0 -> Give the Transaction code(ZTRAN) for which you want to create a variant -> name of some variant (ZVAR) -> create -> takes you to your transaction -> Give the values that you want to be displayed as variants -> Click on Save -> Opens a pop up to confirm the screen entries -> Check the check boxes of those fields that you have entered the data with (the column with check boxes that says W.Content) -> Exit and Save -> Save the variant -> You can see a screen variant created (ZVAR_0100)
    Now Goto -> Create variant transaction -> Give your transaction variant name (ZVAR) -> Select Transaction with variant -> Takes you to SE93 transaction -> Give the transaction variant name  -> save. Run with the created transaction.
    Edited by: Nitwick on Jul 27, 2009 4:49 PM

  • Screen Programming(Module Pool ) using Abap Objects

    Hi gurus.,
    I need to create a module pool program with tabstrips and tablecontrols using Abap objects...plz guide me how i can achieve this... i am very much confused.. i dont know how and where to start .. plz send me documents and sample codes related to this topic..Also hoe i can implement f4 help in screen fields..
    Regards.,
    S.Sivakumar

    Hi Sivakumar,
    Go through the following links:
    [url]http://www.savefile.com/download/156691?PHPSESSID=c49d6bed6630d830f3270f7eab51e547 [url]
    [url]http://www.sapdb.info/category/sap-ebooks[url]
    [url]http://sap.niraj.tripod.com/id25.html[url]
    [url]http://abaplovers.blogspot.com/2008/03/sap-abap-tutorial-module-pool_17.html[url]
    Thank you,
    Prasad G.V.K
    Edited by: Craig Cmehil on Jul 1, 2008 9:48 PM

  • Module pool using ABAP Objects

    Hi All ,
         I have a requirement for creating a transaction/module pool prog using OO ABAP  .
        Can you please send some sample documents to guide completely about the creation and execution of the transaction .
    Rewards are assured !!
    Regards,
    Ranjita

    Hi
    see this code for ALV report in which we used the Modules which is similar to Module pool
    OOPs ABAP uses Classes and Interfaces which uses Methods and events.
    If you have Java skills it is advantage for you.
    There are Local classes as well as Global Classes.
    Local classes we can work in SE38 straight away.
    But mostly it is better to use the Global classes.
    Global Classes or Interfaces are to be created in SE24.
    SAP already given some predefined classes and Interfaces.
    This OOPS concepts very useful for writing BADI's also.
    So first create a class in SE 24.
    Define attributes, Methods for that class.
    Define parameters for that Method.
    You can define event handlers also to handle the messages.
    After creation in each method write the code.
    Methods are similar to ABAP PERFORM -FORM statements.
    After the creation of CLass and methods come to SE38 and create the program.
    In the program create a object type ref to that class and with the help of that Object call the methods of that Class and display the data.
    Example:
    REPORT sapmz_hf_alv_grid .
    Type pool for icons - used in the toolbar
    TYPE-POOLS: icon.
    TABLES: zsflight.
    To allow the declaration of o_event_receiver before the
    lcl_event_receiver class is defined, decale it as deferred in the
    start of the program
    CLASS lcl_event_receiver DEFINITION DEFERRED.
    G L O B A L I N T E R N A L T A B L E S
    *DATA: gi_sflight TYPE STANDARD TABLE OF sflight.
    To include a traffic light and/or color a line the structure of the
    table must include fields for the traffic light and/or the color
    TYPES: BEGIN OF st_sflight.
    INCLUDE STRUCTURE zsflight.
    Field for traffic light
    TYPES: traffic_light TYPE c.
    Field for line color
    types: line_color(4) type c.
    TYPES: END OF st_sflight.
    TYPES: tt_sflight TYPE STANDARD TABLE OF st_sflight.
    DATA: gi_sflight TYPE tt_sflight.
    G L O B A L D A T A
    DATA: ok_code LIKE sy-ucomm,
    Work area for internal table
    g_wa_sflight TYPE st_sflight,
    ALV control: Layout structure
    gs_layout TYPE lvc_s_layo.
    Declare reference variables to the ALV grid and the container
    DATA:
    go_grid TYPE REF TO cl_gui_alv_grid,
    go_custom_container TYPE REF TO cl_gui_custom_container,
    o_event_receiver TYPE REF TO lcl_event_receiver.
    DATA:
    Work area for screen 200
    g_screen200 LIKE zsflight.
    Data for storing information about selected rows in the grid
    DATA:
    Internal table
    gi_index_rows TYPE lvc_t_row,
    Information about 1 row
    g_selected_row LIKE lvc_s_row.
    C L A S S E S
    CLASS lcl_event_receiver DEFINITION.
    PUBLIC SECTION.
    METHODS:
    handle_toolbar FOR EVENT toolbar OF cl_gui_alv_grid
    IMPORTING
    e_object e_interactive,
    handle_user_command FOR EVENT user_command OF cl_gui_alv_grid
    IMPORTING e_ucomm.
    ENDCLASS.
    CLASS lcl_event_receiver IMPLEMENTATION
    CLASS lcl_event_receiver IMPLEMENTATION.
    METHOD handle_toolbar.
    Event handler method for event toolbar.
    CONSTANTS:
    Constants for button type
    c_button_normal TYPE i VALUE 0,
    c_menu_and_default_button TYPE i VALUE 1,
    c_menu TYPE i VALUE 2,
    c_separator TYPE i VALUE 3,
    c_radio_button TYPE i VALUE 4,
    c_checkbox TYPE i VALUE 5,
    c_menu_entry TYPE i VALUE 6.
    DATA:
    ls_toolbar TYPE stb_button.
    Append seperator to the normal toolbar
    CLEAR ls_toolbar.
    MOVE c_separator TO ls_toolbar-butn_type..
    APPEND ls_toolbar TO e_object->mt_toolbar.
    Append a new button that to the toolbar. Use E_OBJECT of
    event toolbar. E_OBJECT is of type CL_ALV_EVENT_TOOLBAR_SET.
    This class has one attribute MT_TOOLBAR which is of table type
    TTB_BUTTON. The structure is STB_BUTTON
    CLEAR ls_toolbar.
    MOVE 'CHANGE' TO ls_toolbar-function.
    MOVE icon_change TO ls_toolbar-icon.
    MOVE 'Change flight' TO ls_toolbar-quickinfo.
    MOVE 'Change' TO ls_toolbar-text.
    MOVE ' ' TO ls_toolbar-disabled.
    APPEND ls_toolbar TO e_object->mt_toolbar.
    ENDMETHOD.
    METHOD handle_user_command.
    Handle own functions defined in the toolbar
    CASE e_ucomm.
    WHEN 'CHANGE'.
    PERFORM change_flight.
    LEAVE TO SCREEN 0.
    ENDCASE.
    ENDMETHOD.
    ENDCLASS.
    S T A R T - O F - S E L E C T I O N.
    START-OF-SELECTION.
    SET SCREEN '100'.
    *& Module USER_COMMAND_0100 INPUT
    MODULE user_command_0100 INPUT.
    CASE ok_code.
    WHEN 'EXIT'.
    LEAVE TO SCREEN 0.
    ENDCASE.
    ENDMODULE. " USER_COMMAND_0100 INPUT
    *& Module STATUS_0100 OUTPUT
    MODULE status_0100 OUTPUT.
    DATA:
    For parameter IS_VARIANT that is sued to set up options for storing
    the grid layout as a variant in method set_table_for_first_display
    l_layout TYPE disvariant,
    Utillity field
    l_lines TYPE i.
    After returning from screen 200 the line that was selected before
    going to screen 200, should be selected again. The table gi_index_rows
    was the output table from the GET_SELECTED_ROWS method in form
    CHANGE_FLIGHT
    DESCRIBE TABLE gi_index_rows LINES l_lines.
    IF l_lines > 0.
    CALL METHOD go_grid->set_selected_rows
    EXPORTING
    it_index_rows = gi_index_rows.
    CALL METHOD cl_gui_cfw=>flush.
    REFRESH gi_index_rows.
    ENDIF.
    Read data and create objects
    IF go_custom_container IS INITIAL.
    Read data from datbase table
    PERFORM get_data.
    Create objects for container and ALV grid
    CREATE OBJECT go_custom_container
    EXPORTING container_name = 'ALV_CONTAINER'.
    CREATE OBJECT go_grid
    EXPORTING
    i_parent = go_custom_container.
    Create object for event_receiver class
    and set handlers
    CREATE OBJECT o_event_receiver.
    SET HANDLER o_event_receiver->handle_user_command FOR go_grid.
    SET HANDLER o_event_receiver->handle_toolbar FOR go_grid.
    Layout (Variant) for ALV grid
    l_layout-report = sy-repid. "Layout fo report
    Setup the grid layout using a variable of structure lvc_s_layo
    Set grid title
    gs_layout-grid_title = 'Flights'.
    Selection mode - Single row without buttons
    (This is the default mode
    gs_layout-sel_mode = 'B'.
    Name of the exception field (Traffic light field) and the color
    field + set the exception and color field of the table
    gs_layout-excp_fname = 'TRAFFIC_LIGHT'.
    gs_layout-info_fname = 'LINE_COLOR'.
    LOOP AT gi_sflight INTO g_wa_sflight.
    IF g_wa_sflight-paymentsum < 100000.
    Value of traffic light field
    g_wa_sflight-traffic_light = '1'.
    Value of color field:
    C = Color, 6=Color 1=Intesified on, 0: Inverse display off
    g_wa_sflight-line_color = 'C610'.
    ELSEIF g_wa_sflight-paymentsum => 100000 AND
    g_wa_sflight-paymentsum < 1000000.
    g_wa_sflight-traffic_light = '2'.
    ELSE.
    g_wa_sflight-traffic_light = '3'.
    ENDIF.
    MODIFY gi_sflight FROM g_wa_sflight.
    ENDLOOP.
    Grid setup for first display
    CALL METHOD go_grid->set_table_for_first_display
    EXPORTING i_structure_name = 'SFLIGHT'
    is_variant = l_layout
    i_save = 'A'
    is_layout = gs_layout
    CHANGING it_outtab = gi_sflight.
    *-- End of grid setup -
    Raise event toolbar to show the modified toolbar
    CALL METHOD go_grid->set_toolbar_interactive.
    Set focus to the grid. This is not necessary in this
    example as there is only one control on the screen
    CALL METHOD cl_gui_control=>set_focus EXPORTING control = go_grid.
    ENDIF.
    ENDMODULE. " STATUS_0100 OUTPUT
    *& Module USER_COMMAND_0200 INPUT
    MODULE user_command_0200 INPUT.
    CASE ok_code.
    WHEN 'EXIT200'.
    LEAVE TO SCREEN 100.
    WHEN'SAVE'.
    PERFORM save_changes.
    ENDCASE.
    ENDMODULE. " USER_COMMAND_0200 INPUT
    *& Form get_data
    FORM get_data.
    Read data from table SFLIGHT
    SELECT *
    FROM zsflight
    INTO TABLE gi_sflight.
    ENDFORM. " load_data_into_grid
    *& Form change_flight
    Reads the contents of the selected row in the grid, ans transfers
    the data to screen 200, where it can be changed and saved.
    FORM change_flight.
    DATA:l_lines TYPE i.
    REFRESH gi_index_rows.
    CLEAR g_selected_row.
    Read index of selected rows
    CALL METHOD go_grid->get_selected_rows
    IMPORTING
    et_index_rows = gi_index_rows.
    Check if any row are selected at all. If not
    table gi_index_rows will be empty
    DESCRIBE TABLE gi_index_rows LINES l_lines.
    IF l_lines = 0.
    CALL FUNCTION 'POPUP_TO_DISPLAY_TEXT'
    EXPORTING
    textline1 = 'You must choose a line'.
    EXIT.
    ENDIF.
    Read indexes of selected rows. In this example only one
    row can be selected as we are using gs_layout-sel_mode = 'B',
    so it is only ncessary to read the first entry in
    table gi_index_rows
    LOOP AT gi_index_rows INTO g_selected_row.
    IF sy-tabix = 1.
    READ TABLE gi_sflight INDEX g_selected_row-index INTO g_wa_sflight.
    ENDIF.
    ENDLOOP.
    Transfer data from the selected row to screenm 200 and show
    screen 200
    CLEAR g_screen200.
    MOVE-CORRESPONDING g_wa_sflight TO g_screen200.
    LEAVE TO SCREEN '200'.
    ENDFORM. " change_flight
    *& Form save_changes
    Changes made in screen 200 are written to the datbase table
    zsflight, and to the grid table gi_sflight, and the grid is
    updated with method refresh_table_display to display the changes
    FORM save_changes.
    DATA: l_traffic_light TYPE c.
    Update traffic light field
    Update database table
    MODIFY zsflight FROM g_screen200.
    Update grid table , traffic light field and color field.
    Note that it is necessary to use structure g_wa_sflight
    for the update, as the screen structure does not have a
    traffic light field
    MOVE-CORRESPONDING g_screen200 TO g_wa_sflight.
    IF g_wa_sflight-paymentsum < 100000.
    g_wa_sflight-traffic_light = '1'.
    C = Color, 6=Color 1=Intesified on, 0: Inverse display off
    g_wa_sflight-line_color = 'C610'.
    ELSEIF g_wa_sflight-paymentsum => 100000 AND
    g_wa_sflight-paymentsum < 1000000.
    g_wa_sflight-traffic_light = '2'.
    clear g_wa_sflight-line_color.
    ELSE.
    g_wa_sflight-traffic_light = '3'.
    clear g_wa_sflight-line_color.
    ENDIF.
    MODIFY gi_sflight INDEX g_selected_row-index FROM g_wa_sflight.
    Refresh grid
    CALL METHOD go_grid->refresh_table_display.
    CALL METHOD cl_gui_cfw=>flush.
    LEAVE TO SCREEN '100'.
    ENDFORM. " save_changes
    chk this blog
    /people/vijaybabu.dudla/blog/2006/07/21/topofpage-in-alv-using-clguialvgrid
    Reward points if useful
    Regards
    Anji

Maybe you are looking for

  • How do you turn off home sharing for ical?

    My daughter is using her iCal on her iPod and it is syncing to my iCal. How do you turn this off?

  • I want to "open URL"  link in my function on thumb.

    function callThumbs() {                                         root.createEmptyMovieClip("wall",root.getNextHighestDepth());                                           wall._x = root.galleryx=0;                                           wall._y = roo

  • Is there a list of Out of the Box Adobe Interactive forms for HCM (HR)?

    Hi, Is there a list of Out of the Box Adobe Interactive forms for HCM (HR)? Can you please help me? Venkatesh

  • What privileges do I need to install the latest version of adobe

    I have been trying to download the correct version of adobe to allow me to watch video content from the bbc website. Each time it fails because I do not have sufficient privileges. What do I need to do to gain these "privilges"?

  • DOMParser.parse question

    Hi all, I have parsed an XML document resulting in a DOM. Then I am going through and returning a nodeList by: dSLDocument.getElementsByTagName("PurchaseOrder");This returns the tag that I am after but what I need to do is then create a new DOM from