Skip to Content
author's profile photo Former Member
Former Member

table maintenance by using module pool program

Hi

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Dec 02, 2007 at 06:54 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 02, 2007 at 02:56 PM

    Once you've created your table, go back into SE11, and choose "TABLE MAINTENANCE GENERATOR" from the menu. No need to develop own code.

    matt

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.