Table control program

hai I have problem in table control in 'se80' 
create table control in screen painter and the program is follow,,,,,,
__1.include__
TABLES SPFLI.
CONTROLS MYTABLE TYPE TABLEVIEW USING SCREEN 110.
DATA: ITAB LIKE SPFLI OCCURS 0 WITH HEADER LINE.
2.flow logic
PROCESS BEFORE OUTPUT.
LOOP AT ITAB WITH COTROL MYTABLE CURSOR MYTABLE-CURRENT_LINE.
***LOOP WITH CONTROL mytable."-current_line.
MODULE status_0110.
ENDLOOP.
here it ll show  the error 'itab is not data base table'
PROCESS AFTER INPUT.
MODULE user_command_0110.
LOOP AT ITAB.
***LOOP WITH CONTROL mytable."-current_line.
ENDLOOP.
3. pbo event.
*&      Module  status_0110  OUTPUT
      text
module status_0110 output.
SPFLI-CARRID = ITAB-CARRID.
SPFLI-CONNID = ITAB-CONNID.
SPFLI-CITYFROM = ITAB-CITYFROM.
SPFLI-CITYTO = ITAB-CITYTO.
SPFLI-FLTIME = ITAB-FLTIME.
endmodule.                 " status_0110  OUTPUT
4.pai event
*&      Module  user_command_0110  INPUT
      text
module user_command_0110 input.
CASE SY-UCOMM.
WHEN 'DISPLAY'.
SELECT * FROM SPFLI INTO TABLE ITAB .
*MYTABLE-LINES = SY-DBCNT.
WHEN 'EXIT'.
LEAVE PROGRAM.
ENDCASE.
endmodule.                 " user_command_0110  INPUT.
when creating transaction it ll show error'  GUI capability of transaction Z1234 classified '.. 
any modify my program and send to me ..........
and send me the example program and description,,,,,,,,,,
thankyou

TABLES SPFLI.
CONTROLS MYTABLE TYPE TABLEVIEW USING SCREEN 110.
DATA: ITAB LIKE SPFLI OCCURS 0 WITH HEADER LINE.
2.flow logic
PROCESS BEFORE OUTPUT.
LOOP AT ITAB WITH COTROL MYTABLE CURSOR MYTABLE-CURRENT_LINE.
ENDLOOP.
MODULE status_0110.
here it ll show the error 'itab is not data base table'
PROCESS AFTER INPUT.
MODULE user_command_0110.
LOOP AT ITAB.
ENDLOOP.
3. pbo event.
*& Module status_0110 OUTPUT
text
module status_0110 output.
endmodule. " status_0110 OUTPUT
4.pai event
*& Module user_command_0110 INPUT
text
module user_command_0110 input.
CASE SY-UCOMM.
WHEN 'DISPLAY'.
SELECT * FROM SPFLI INTO TABLE ITAB .
*MYTABLE-LINES = SY-DBCNT.
WHEN 'EXIT'.
LEAVE PROGRAM.
ENDCASE.
endmodule. " user_command_0110 INPUT
and in painter the table control  column name should be ur internal table field name
like
itab-abc
itab-ffsf
regards
anil chaudhary

Similar Messages

  • Table control program for updating database table

    Does anybody have a sample code for a table control program which can insert/delete/update a database table?
    I mean like on the output on table control, if the user insert/delete/update the records, the corresponding records will be updated in database table also.
    Appreciate your input.
    Thanks.

    hi nuren,
    TABLES: kna1,knbk.
    DATA: v_kunnr LIKE kna1-kunnr.
    DATA: v_check TYPE c.
    DATA: BEGIN OF it_knbk OCCURS 0,
          banks LIKE knbk-banks,
          bankl LIKE knbk-bankl,
          bankn LIKE knbk-bankn,
          bkont LIKE knbk-bkont,
          koinh LIKE knbk-koinh,
          chk TYPE c,
          END OF it_knbk.
    DATA: v_ucomm TYPE sy-ucomm,
          v_dynnr TYPE sy-dynnr.
    DATA: l_index TYPE sy-index.
    data: count type i.
    CONTROLS: tc1 TYPE TABLEVIEW USING SCREEN 0200.
    *&      Module  STATUS_0100  OUTPUT
          text
    MODULE status_0100 OUTPUT.
      SET PF-STATUS 'ABC'.
    SET TITLEBAR 'xxx'.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
          text
    MODULE user_command_0100 INPUT.
      v_ucomm = sy-ucomm.
      CASE v_ucomm.
        WHEN 'DISP' OR 'CHNG'.
          IF v_kunnr <> space.
            SELECT banks
                   bankl
                   bankn
                   bkont
                   koinh
                   FROM knbk
                   INTO TABLE it_knbk
                   WHERE kunnr = v_kunnr.
            LEAVE TO SCREEN '0200'.
          ENDIF.
        WHEN 'BACK'.
          LEAVE TO SCREEN 0.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    *&      Module  MOD_KUNNR  INPUT
          text
    MODULE mod_kunnr INPUT.
      IF NOT v_kunnr IS INITIAL.
        SELECT SINGLE
               kunnr
               FROM kna1
               INTO v_kunnr
               WHERE kunnr = v_kunnr.
        IF sy-subrc <> 0.
          MESSAGE e000(zz) WITH 'INCORRECT CUSTOMER NUMBER'.
        ENDIF.
      ENDIF.
      IF v_kunnr IS INITIAL.
        MESSAGE e000(zz) WITH 'PLEASE ENTER A VALUE'.
      ENDIF.
    ENDMODULE.                 " MOD_KUNNR  INPUT
    *&      Module  STATUS_0200  OUTPUT
          text
    MODULE status_0200 OUTPUT.
      SET PF-STATUS 'ABC1'.
    SET TITLEBAR 'xxx'.
    ENDMODULE.                 " STATUS_0200  OUTPUT
    *&      Module  SCREENMOD  OUTPUT
          text
    MODULE screenmod OUTPUT.
      IF v_ucomm = 'DISP'.
        LOOP AT SCREEN.
          screen-input = 0.
          MODIFY SCREEN.
        ENDLOOP.
      ELSE."if v_UCOMM = 'CHNG'.
        LOOP AT SCREEN.
            IF screen-group1 = 'G1'.
              screen-input = 0.
            ELSE.
              screen-input = 1.
            ENDIF.
         MODIFY SCREEN.
        ENDLOOP.
    endif.
    if sy-ucomm = 'INSE'.
    loop at screen.
    IF ( tc1-current_line <> tc1-lines ).
      screen-input = 0.
    else.
    screen-input = 1.
    modify screen.
    endif.
    endloop.
    endif.
    ENDMODULE.                 " SCREENMOD  OUTPUT
    *&      Module  EXIT2  INPUT
          text
    MODULE exit2 INPUT.
      LEAVE TO SCREEN 0.
    ENDMODULE.                 " EXIT2  INPUT
    *&      Module  modify  INPUT
          text
    MODULE modify INPUT.
          IF v_check =  'X'.
            it_knbk-chk =  'X'.
            MODIFY it_knbk index tc1-current_line.
          ELSE.
            CLEAR it_knbk-chk .
         ENDIF.
    ENDMODULE.                 " modify  INPUT
    *&      Module  USER_COMMAND_0200  INPUT
          text
    MODULE user_command_0200 INPUT.
    v_ucomm = sy-ucomm.
      CASE v_ucomm.
        WHEN 'DELE'.
            DELETE it_knbk where chk eq 'X'.
            DESCRIBE TABLE it_knbk LINES tc1-lines.
        WHEN 'INSE'.
          CLEAR it_knbk.
          APPEND it_knbk.
          DESCRIBE TABLE it_knbk LINES tc1-lines.
        WHEN 'LIST'.
          LEAVE TO LIST-PROCESSING AND RETURN TO SCREEN '0200'.
          WRITE 'Report'.
        WHEN 'BACK'.
          LEAVE TO SCREEN '0100'.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0200  INPUT
    *&      Module  validate  INPUT
          text
    module validate input.
    IF IT_KNBK IS INITIAL.
    MESSAGE E000(ZZ) WITH 'A BLANK LINE CANNOT BE SAVED'.
    ENDIF.
    endmodule.                 " validate  INPUT

  • Settlement Receiver Value not Saved in Table Control Program

    Hi,
    I have Table control program regarding to Equipment Log, where in output it show the Equipment details with Account assignment category, General settlement receiver, Shift Hours, Work Hours, Idle Hrs, Maint. Hrs., Production Hours etc...
    In report, we have a formula i.e.
    Shift Hrs. = Work Hours + Idle Hrs + Maint. Hrs. + Production Hours.
    and all those fields are linked to each other.
    If we want that Work Hours should be 0, then msg showing - Working Hrs. should be entered. , means without enter Working Hrs. value we cann't save it.
    Now we removed the link of Working Hrs to others, means if we insert value 0 of Working Hrs., no msg showing. BUT Problem is this after remove this link, General settlement receiver value should not be saved.
    We want Work Hrs. as 0 value and General settlement receiver value must not be BLANK. It should be Saved.
    Plz guide..

    hi
    write a if statement after the Shift Hrs. = Work Hours + Idle Hrs + Maint. Hrs. + Production Hours.
    if work hours = 0, message i000 with 'Working Hrs. should be entered'.
    else ,write:/ shift hrs.end if. try to create a button for save when you click data will be saved or create a subrountine perform shift hrs than use if loop and select form end form inside keep Shift Hrs. = Work Hours + Idle Hrs + Maint. Hrs. + Production Hours.
    thanking you

  • Table control programming

    Hi experts,
    Please give me information about table control programming.
    explain it with example.
    Thanks & Regards,
    Rajesh Kumar

    Hi Rajesh,
    Lets say the table has more than 20 fields and at first shot there are say 15 screen fields and to enter the 16th field you have to press page down so in this case you have to have a control on table..
    The below example would help you to analyse..
    check the example...
    *"Selection screen elements............................................
    parameters:
      p_file like rlgrap-filename.
    *" Data declarations...................................................
    * Work variables                                                      *
    data w_file type string.
    data wa(80) type c.
    data : w_fname(20),
        w_tabix(2) type n,
        w_table(20),
        w_index,
        w_fkey(20),
        w_ftype(20),
        w_flen(20),
        w_fdesc(20).
    *" Internal table declarations.........................................
    * Internal table to hold                                               *
    data:
      begin of itab_fields occurs 0,
        count,
        fname(20),
        fkey,
        ftype(10),
        flen(10),
        fdesc(30),
      end of itab_fields.
    data:
      begin of itab_header occurs 0,
        dbcheck,
        tname(20),
        tdesc(40),
        devclass,
        maintain,
      end of itab_header.
    data t_data like standard table of wa .
    data:
      t_bdcdata like
       standard table of bdcdata with header line.
    data w_count type i.
    *       AT SELECTION-SCREEN ON VALUE-REQUEST EVENT                    *
    at selection-screen on value-request for p_file.
      call function 'F4_FILENAME'
    * EXPORTING
    *   PROGRAM_NAME        = SYST-CPROG
    *   DYNPRO_NUMBER       = SYST-DYNNR
    *   FIELD_NAME          = ' '
       importing
         file_name           = p_file
      w_file = p_file.
    *                       START-OF-SELECTION EVENT                      *
    start-of-selection.
      call function 'GUI_UPLOAD'
        exporting
          filename                      = w_file
         filetype                      = 'ASC'
    *   HAS_FIELD_SEPARATOR           = 'X'
    *   HEADER_LENGTH                 = 0
    *   READ_BY_LINE                  = 'X'
    *   DAT_MODE                      = ' '
    *   CODEPAGE                      = ' '
    *   IGNORE_CERR                   = ABAP_TRUE
    *   REPLACEMENT                   = '#'
    * IMPORTING
    *   FILELENGTH                    =
    *   HEADER                        =
        tables
          data_tab                      = t_data
       exceptions
         file_open_error               = 1
         file_read_error               = 2
         no_batch                      = 3
         gui_refuse_filetransfer       = 4
         invalid_type                  = 5
         no_authority                  = 6
         unknown_error                 = 7
         bad_data_format               = 8
         header_not_allowed            = 9
         separator_not_allowed         = 10
         header_too_long               = 11
         unknown_dp_error              = 12
         access_denied                 = 13
         dp_out_of_memory              = 14
         disk_full                     = 15
         dp_timeout                    = 16
         others                        = 17
      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 t_data into wa.
        if wa+0(1) eq 'H'.
          shift wa by 2 places left.
          split wa at ',' into itab_header-dbcheck
          itab_header-tname
          itab_header-tdesc
          itab_header-devclass
          itab_header-maintain.
          append itab_header.
          clear itab_header.
          add 1 to w_count.
        else.
          shift wa by 2 places left.
          split wa at ',' into itab_fields-fname
          itab_fields-fkey
          itab_fields-ftype
          itab_fields-flen
          itab_fields-fdesc.
          write w_count to itab_fields-count.
          append itab_fields.
          clear itab_fields.
        endif.
      endloop.
      call function 'BDC_OPEN_GROUP'
       exporting
         client                    = sy-mandt
    *   DEST                      = FILLER8
         group                     = 'PADMA'
    *   HOLDDATE                  = FILLER8
    *   KEEP                      = FILLER1
         user                      = sy-uname
    *   RECORD                    = FILLER1
    *   PROG                      = SY-CPROG
    * IMPORTING
    *   QID                       =
       exceptions
         client_invalid            = 1
         destination_invalid       = 2
         group_invalid             = 3
         group_is_locked           = 4
         holddate_invalid          = 5
         internal_error            = 6
         queue_error               = 7
         running                   = 8
         system_lock_error         = 9
         user_invalid              = 10
         others                    = 11
      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 itab_header.
        w_table = itab_header-tname.
        w_index = sy-tabix.
        refresh t_bdcdata.
        perform populate_se11.
        call function 'BDC_INSERT'
         exporting
           tcode                  = 'SE11'
    *    POST_LOCAL             = NOVBLOCAL
    *    PRINTING               = NOPRINT
    *    SIMUBATCH              = ' '
    *    CTUPARAMS              = ' '
          tables
            dynprotab              = t_bdcdata
         exceptions
           internal_error         = 1
           not_open               = 2
           queue_error            = 3
           tcode_invalid          = 4
           printing_invalid       = 5
           posting_invalid        = 6
           others                 = 7
        if sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        endif.
        refresh t_bdcdata.
        perform populate_se13.
        call function 'BDC_INSERT'
         exporting
           tcode                  = 'SE13'
    *    POST_LOCAL             = NOVBLOCAL
    *    PRINTING               = NOPRINT
    *    SIMUBATCH              = ' '
    *    CTUPARAMS              = ' '
          tables
            dynprotab              = t_bdcdata
         exceptions
           internal_error         = 1
           not_open               = 2
           queue_error            = 3
           tcode_invalid          = 4
           printing_invalid       = 5
           posting_invalid        = 6
           others                 = 7
        if sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        endif.
        refresh t_bdcdata.
        perform activate.
        call function 'BDC_INSERT'
         exporting
           tcode                  = 'SE11'
    *    POST_LOCAL             = NOVBLOCAL
    *    PRINTING               = NOPRINT
    *    SIMUBATCH              = ' '
    *    CTUPARAMS              = ' '
          tables
            dynprotab              = t_bdcdata
         exceptions
           internal_error         = 1
           not_open               = 2
           queue_error            = 3
           tcode_invalid          = 4
           printing_invalid       = 5
           posting_invalid        = 6
           others                 = 7
        if sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        endif.
      endloop.
      call function 'BDC_CLOSE_GROUP'
        exceptions
          not_open    = 1
          queue_error = 2
          others      = 3.
      if sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      endif.
    *&      Form  POPULATE_SE11
    *    This subroutine is used to populate SE11 transaction data         *
    *     No interface parameters                                          *
    form populate_se11 .
      perform bdc_dynpro      using 'SAPMSRD0' '0102'.
      perform bdc_field       using 'BDC_CURSOR'
                                    'RSRD1-TBMA_VAL'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '=ADD'.
      perform bdc_field       using 'RSRD1-TBMA'
                                    itab_header-dbcheck.
      perform bdc_field       using 'RSRD1-TBMA_VAL'
                                    itab_header-tname.
      perform bdc_dynpro      using 'SAPLSD41' '2200'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '=CHANGE_MAINTFLAG'.
      perform bdc_field       using 'DD02D-DDTEXT'
                                    itab_header-tdesc.
      perform bdc_field       using 'BDC_CURSOR'
                                    'DD02D-MAINFLAG'.
      perform bdc_field       using 'DD02D-CONTFLAG'
                                    itab_header-devclass.
      perform bdc_field       using 'DD02D-MAINFLAG'
                                    itab_header-maintain.
      perform bdc_dynpro      using 'SAPLSD41' '2200'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '=DEF'.
      perform bdc_field       using 'DD02D-CONTFLAG'
                                    'A'.
      perform bdc_field       using 'DD02D-MAINFLAG'
                                    'X'.
      perform bdc_dynpro      using 'SAPLSD41' '2200'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '=FTYP'.
      w_tabix = 0.
      loop at itab_fields where count eq w_index.
        add 1 to w_tabix.
        if w_tabix gt 13.
          perform bdc_dynpro      using 'SAPLSD41' '2200'.
          perform bdc_field       using 'BDC_CURSOR'
                                       w_fname.
          perform bdc_field       using 'BDC_OKCODE'
                                        '=P+'.
          w_tabix = 2.
        endif.
        concatenate 'DD03P-FIELDNAME(' w_tabix ')' into w_fname.
        concatenate 'DD03P-KEYFLAG(' w_tabix ')' into w_fkey.
        concatenate 'DD03D-DATATYPE(' w_tabix ')' into w_ftype.
        concatenate 'DD03P-LENG(' w_tabix ')' into w_flen.
        concatenate 'DD03P-DDTEXT(' w_tabix ')' into w_fdesc.
        perform bdc_dynpro      using 'SAPLSD41' '2200'.
        perform bdc_field       using 'BDC_OKCODE'
                                      '/00'.
        perform bdc_field       using w_fname
                                      itab_fields-fname.
        perform bdc_field       using w_fkey
                                      itab_fields-fkey.
        perform bdc_field       using w_ftype
                                      itab_fields-ftype.
        perform bdc_field       using w_flen
                                        itab_fields-flen.
        perform bdc_field       using w_fdesc
                                      itab_fields-fdesc.
      endloop.
      perform bdc_dynpro      using 'SAPLSD41' '2200'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '=WB_SAVE'.
      perform bdc_dynpro      using 'SAPLSTRD' '0100'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '=ADD'.
      perform bdc_field       using 'KO007-L_DEVCLASS'
                                    'Z1139'.
      perform bdc_field       using 'KO007-L_AUTHOR'
                                    'SAPDEV02'.
      perform bdc_dynpro      using 'SAPLSTRD' '0300'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '=LOCK'.
      perform bdc_field       using 'KO008-TRKORR'
                                    'TR1K900085'.
      perform bdc_dynpro      using 'SAPLSD41' '2200'.
      perform bdc_field       using 'BDC_CURSOR'
                                    'DD03P-DDTEXT(03)'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '=BACK'.
      perform bdc_dynpro      using 'SAPMSRD0' '0102'.
      perform bdc_field       using 'BDC_CURSOR'
                                    'RSRD1-TBMA_VAL'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '=BACK'.
    endform.                    " POPULATE_SE11
    *&      Form  POPULATE_SE13
    *    This subroutine is used to populate SE13 data                     *
    *     No interface parameters                                          *
    form populate_se13 .
      perform bdc_dynpro      using 'SAPMSEDS' '0010'.
      perform bdc_field       using 'DD09V-TABNAME'
                                    w_table.
      perform bdc_field       using 'BDC_OKCODE'
                                    'PFLG'.
      perform bdc_dynpro      using 'SAPMSEDS' '0050'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '=SICH'.
      perform bdc_field       using 'DD09V-TABART'
                                    'APPL0'.
      perform bdc_field       using 'DD09V-TABKAT'
                                    '0'.
      perform bdc_field       using 'ALLOWSTATE-NOT_ALLOWED'
                                    'X'.
      perform bdc_dynpro      using 'SAPMSEDS' '0050'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '=BACK'.
      perform bdc_field       using 'DD09V-TABART'
                                    'APPL0'.
      perform bdc_field       using 'DD09V-TABKAT'
                                    '0'.
      perform bdc_field       using 'ALLOWSTATE-NOT_ALLOWED'
                                    'X'.
      perform bdc_field       using 'BDC_OKCODE'
                                   '=WB_BACK'.
      perform bdc_dynpro      using 'SAPMSEDS' '0050'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '=BACK'.
      perform bdc_dynpro      using 'SAPMSEDS' '0010'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '=BACK'.
    endform.                    " POPULATE_SE13
    *&      Form  ACTIVATE
    *     This subroutine is used to activate the table from SE11          *
    *     No interface parameters.                                         *
    form activate .
      perform bdc_dynpro      using 'SAPMSRD0' '0102'.
      perform bdc_field       using 'RSRD1-TBMA'
                                    'X'.
      perform bdc_field       using 'RSRD1-TBMA_VAL'
                                    w_table.
      perform bdc_field       using 'BDC_OKCODE'
                                    'ACT'.
      perform bdc_dynpro      using 'SAPLSEWORKINGAREA' '0205'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '=WEIT'.
      perform bdc_dynpro      using 'SAPMSRD0' '0102'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '=BACK'.
    endform.                    " ACTIVATE
    *&      Form  bdc_dynpro
    *    This subroutine is used to populate the screen information        *
    *      -->prgname   Program name
    *      -->screenno  Screen number
    form bdc_dynpro  using    value(prgname)
                              value(screenno).
      clear t_bdcdata.
      t_bdcdata-program = prgname.
      t_bdcdata-dynpro = screenno.
      t_bdcdata-dynbegin = 'X'.
      append t_bdcdata.
    endform.                    " bdc_dynpro
    *&      Form  bdc_field
    *     This subroutine is used to populate the field values             *
    *      -->fnam   Field name                                            *
    *      -->fval   Field value                                           *
    form bdc_field  using    value(fnam)
                             value(fval).
      clear t_bdcdata.
      t_bdcdata-fnam = fnam.
      t_bdcdata-fval = fval.
      append t_bdcdata.
    endform.                    " bdc_field
    ******flat file ******
    **H,X,Z1139_REC_30,Recorded Table,A,X*
    **I,mandt,X,clnt,3,Client*
    **I,ENO,X,char,6,Employee Number*
    **I,ENAME, ,Char,20,Employee Name*
    **I,deptno, ,char,10,Department Number*
    **I,salary, ,int4, ,Salary*
    **I,deptno,X,char,10,Department Number*
    **I,dname, ,char,20,Department Name*
    **I,Locate, ,char,20,Location*
    **I,deptno,X,char,10,Department Number*
    **I,dname, ,char,20,Department Name*
    **I,Locate, ,char,20,Location*
    **I,deptno,X,char,10,Department Number*
    **I,dname, ,char,20,Department Name*
    **I,Locate, ,char,20,Location*
    **I,deptno,X,char,10,Department Number*
    **I,dname, ,char,20,Department Name*
    **I,Locate, ,char,20,Location*
    **I,deptno,X,char,10,Department Number*
    **I,dname, ,char,20,Department Name*
    **I,Locate, ,char,20,Location*
    **H,X,Z1139_REC_31,Recorded Table,A,X*
    **I,mandt,X,clnt,3,Client*
    **I,deptno,X,char,10,Department Number*
    **I,dname, ,char,20,Department Name*
    **I,Locate, ,char,20,Location*
    hope the above example would help you and solve your issue.
    Regards
    Narin Nandivada

  • How can we handle table control parameter in lsmw

    hi guru,
    please tell me  how can we handle table control parameter in lsmw.
    thanks & regards
    subhasis.

    Hi,
    we  create table control program (module pool) this program use in LSMW,
    we mention the transaction code ,write ur  table control program name.
    This is use full for u
    Reguards,
    lakshmi

  • Scroll Vertically should not possible in Table Control

    Hi,
    In Screen Painter (SE51), we created a Table control program. It's working fine but we want that User cann't able to scroll Vertically.
    In Table Control Properties, there is a option for Fix Column. From here, we can fix the columns but we want to Fix the Rows.
    Please guide...

    Hi,
    In the PBO of the subscreen. Assign some value to the tablecontrol-lines field as below;
    Describe table itab_for_tablecontrol lines tablecontrol-lines.
    OR
    Tablecontrol_lines = 10.
    Regards,
    Karthik D

  • How to Maintain Values in the Table control?

    Hi,
    I'm Saikumar.
    I've done a table control program.
    When I click SAVE or ENTER Button, the values are getting saved into the database(This is working alright)......but when I click those buttons, The values entered in the table control are getting cleared.
    What should I do in order to have those values in the table control itself when I click SAVE/ENTER? (I need to create multiple records at a time)
    What I've done is:
    IF sy-ucomm = 'SAVE' OR sy-ucomm = 'ENTR'.
    INSERT into <database table> values wa_matgl.
    MODIFY it_matgl from wa_matgl INDEX tc1-current_line. "tc1 is the table control name.
    Refresh it_matgl.
    endif.
    I tried many ways but the vales are getting cleared in the table control? (I need to create multiple records at a time).
    Please suggest a way to overcome it.
    Thanks in advance,
    saikumar

    Hi ...
    Just to add...
    were there any values in the internal table it_matgl  initially in the PBO screen to be shown to the users ?
    <u>if the answer is no...then......</u>
    i came across the same coding in DEMO_DYNPRO_TABCONT_LOOP_AT.....
    here also in PAI..when we press enter..the values are not retained...
    MODIFY it_matgl from wa_matgl INDEX tc1-current_line. "tc1 is the table control name.
    <b>because i believe the modify statement is not working.coz the it_matgl is empty..pls check if sy-subrc = 0....after the modify statement....if it is not...then we need to insert the data into the it_matgl using an append statement</b>
    for this it_matgl needs to be with header line...
    Pls explore the following....
    data : it_matgl type table of XXXX with header line.
    in the section
    IF sy-ucomm = 'SAVE' OR sy-ucomm = 'ENTR'.
    INSERT into <database table> values wa_matgl.
    MODIFY it_matgl from wa_matgl INDEX tc1-current_line. "tc1 is the table control name.
    <i>if sy-subrc <> 0.
    move corresponding wa_matgl to it_matgl.
    append it_matgl.
    clear it_matgl.
    endif.
    endif.</i>
    Pls check and revert
    Regards
    Byju

  • Table control...? its urgent

    Hi friends,
    Can anyone gve me example table control program..
    My requirement is I have to display blank table control.....but when user enetrs value.. and submits it should be added to the inetrnal table in my program please help......
    Also if he wants to see the records in table control..which he enetered earlier the table should be displayed as populated..
    Please help its urgent....points will be rewarded....

    Seet he following ex:
    Created table control using wizard.
    *& Module pool       ZTEST_TBLCTRL
    PROGRAM  ZTEST_TBLCTRL.
    ***&SPWIZARD: DATA DECLARATION FOR TABLECONTROL 'TC1'
    *&SPWIZARD: DEFINITION OF DDIC-TABLE
    TABLES:   ZFG_SRNO, ZFIH0004.
    *&SPWIZARD: TYPE FOR THE DATA OF TABLECONTROL 'TC1'
    *TYPES: BEGIN OF T_TC1,
            ZSRNO LIKE ZFG_SRNO-ZSRNO,
            SCRNAME LIKE ZFIH0004-SCRNAME,
          END OF T_TC1.
    *TYPES: BEGIN OF T_TC1.
    STRUCTURE ZFG_SRNO.
          END OF T_TC1.
    *&SPWIZARD: INTERNAL TABLE FOR TABLECONTROL 'TC1'
    *DATA:     G_TC1_ITAB   TYPE T_TC1 OCCURS 0 WITH HEADER LINE,
             G_TC1_WA     TYPE T_TC1. "work area
    DATA:     G_TC1_ITAB   LIKE ZFG_SRNO OCCURS 0 WITH HEADER LINE,
              G_TC1_WA     LIKE G_TC1_ITAB. "work area
    DATA:     G_TC1_COPIED.           "copy flag
    *&SPWIZARD: DECLARATION OF TABLECONTROL 'TC1' ITSELF
    CONTROLS: TC1 TYPE TABLEVIEW USING SCREEN 0100.
    *&SPWIZARD: LINES OF TABLECONTROL 'TC1'
    DATA:     G_TC1_LINES  LIKE SY-LOOPC.
    DATA:     OK_CODE LIKE SY-UCOMM,
              S_CODE LIKE SY-UCOMM,
              MARK.
    DATA: T1(10).
    *&SPWIZARD: OUTPUT MODULE FOR TC 'TC1'. DO NOT CHANGE THIS LINE!
    *&SPWIZARD: COPY DDIC-TABLE TO ITAB
    MODULE TC1_INIT OUTPUT.
    IF G_TC1_COPIED IS INITIAL.
    *&SPWIZARD: COPY DDIC-TABLE 'ZFG_SRNO'
    *&SPWIZARD: INTO INTERNAL TABLE 'g_TC1_itab'
       SELECT * FROM ZFG_SRNO
          INTO CORRESPONDING FIELDS
          OF TABLE G_TC1_ITAB.
       G_TC1_COPIED = 'X'.
       REFRESH CONTROL 'TC1' FROM SCREEN '0100'.
    IF T1 <> SPACE.
    G_TC1_ITAB-ZSRNO = T1.
    CLEAR T1.
    APPEND G_TC1_ITAB.
        REFRESH CONTROL 'TC1' FROM SCREEN '0100'.
    ENDIF.
    *TC1-TOP_LINE = 1.
    ENDIF.
    ENDMODULE.
    *&SPWIZARD: OUTPUT MODULE FOR TC 'TC1'. DO NOT CHANGE THIS LINE!
    *&SPWIZARD: MOVE ITAB TO DYNPRO
    MODULE TC1_MOVE OUTPUT.
      MOVE-CORRESPONDING G_TC1_WA TO ZFG_SRNO.
           if sy-subrc ne 0.
    *append G_TC1_WA to G_TC1_ITAB.
    *endif.
    READ TABLE G_TC1_ITAB INDEX TC1-CURRENT_LINE.
    IF SY-SUBRC = 0.
        G_TC1_WA-ZSRNO = G_TC1_ITAB-ZSRNO.
    ENDIF.
    MOVE-CORRESPONDING G_TC1_ITAB TO ZFG_SRNO.
    REFRESH CONTROL 'TC1' FROM SCREEN '8001'.
      tc1-lines = G_TC1_LINES + 100.
    ENDMODULE.
    *&SPWIZARD: OUTPUT MODULE FOR TC 'TC1'. DO NOT CHANGE THIS LINE!
    *&SPWIZARD: GET LINES OF TABLECONTROL
    MODULE TC1_GET_LINES OUTPUT.
      G_TC1_LINES = SY-LOOPC.
    ENDMODULE.
    *&SPWIZARD: INPUT MODULE FOR TC 'TC1'. DO NOT CHANGE THIS LINE!
    *&SPWIZARD: MODIFY TABLE
    MODULE TC1_MODIFY INPUT.
    *break-point.
    MOVE-CORRESPONDING ZFG_SRNO TO  G_TC1_ITAB.
    MODIFY G_TC1_ITAB INDEX TC1-CURRENT_LINE.
    G_TC1_COPIED = 'X'.
    REFRESH CONTROL 'TC1' FROM SCREEN '8001'.
      MOVE-CORRESPONDING ZFG_SRNO TO G_TC1_WA.
      MODIFY G_TC1_ITAB
        FROM G_TC1_WA
        INDEX TC1-CURRENT_LINE.
          G_TC1_COPIED = 'X'.
          if sy-subrc ne 0.
    append G_TC1_WA to G_TC1_ITAB.
    endif.
    *modify G_TC1_ITAB INDEX TC1-CURRENT_LINE.
    ENDMODULE.
    *&SPWIZARD: INPUT MODULE FOR TC 'TC1'. DO NOT CHANGE THIS LINE!
    *&SPWIZARD: PROCESS USER COMMAND
    MODULE TC1_USER_COMMAND INPUT.
      OK_CODE = SY-UCOMM.
      PERFORM USER_OK_TC USING    'TC1'
                                  'G_TC1_ITAB'
                                  'FLAG'
                         CHANGING OK_CODE.
      SY-UCOMM = OK_CODE.
    ENDMODULE.
      INCLUDE TABLECONTROL_FORMS                                         *
    *&      Form  USER_OK_TC                                               *
    FORM USER_OK_TC USING    P_TC_NAME TYPE DYNFNAM
                              P_TABLE_NAME
                              P_MARK_NAME
                     CHANGING P_OK      LIKE SY-UCOMM.
    &SPWIZARD: BEGIN OF LOCAL DATA----
       DATA: L_OK              TYPE SY-UCOMM,
             L_OFFSET          TYPE I.
    &SPWIZARD: END OF LOCAL DATA----
    *&SPWIZARD: Table control specific operations                          *
    *&SPWIZARD: evaluate TC name and operations                            *
       SEARCH P_OK FOR P_TC_NAME.
       IF SY-SUBRC <> 0.
         EXIT.
       ENDIF.
       L_OFFSET = STRLEN( P_TC_NAME ) + 1.
       L_OK = P_OK+L_OFFSET.
    *&SPWIZARD: execute general and TC specific operations                 *
       CASE L_OK.
         WHEN 'INSR'.                      "insert row
           PERFORM FCODE_INSERT_ROW USING    P_TC_NAME
                                             P_TABLE_NAME.
           CLEAR P_OK.
         WHEN 'DELE'.                      "delete row
           PERFORM FCODE_DELETE_ROW USING    P_TC_NAME
                                             P_TABLE_NAME
                                             P_MARK_NAME.
           CLEAR P_OK.
         WHEN 'P--' OR                     "top of list
              'P-'  OR                     "previous page
              'P+'  OR                     "next page
              'P++'.                       "bottom of list
           PERFORM COMPUTE_SCROLLING_IN_TC USING P_TC_NAME
                                                 L_OK.
           CLEAR P_OK.
        WHEN 'L--'.                       "total left
          PERFORM FCODE_TOTAL_LEFT USING P_TC_NAME.
        WHEN 'L-'.                        "column left
          PERFORM FCODE_COLUMN_LEFT USING P_TC_NAME.
        WHEN 'R+'.                        "column right
          PERFORM FCODE_COLUMN_RIGHT USING P_TC_NAME.
        WHEN 'R++'.                       "total right
          PERFORM FCODE_TOTAL_RIGHT USING P_TC_NAME.
         WHEN 'MARK'.                      "mark all filled lines
           PERFORM FCODE_TC_MARK_LINES USING P_TC_NAME
                                             P_TABLE_NAME
                                             P_MARK_NAME   .
           CLEAR P_OK.
         WHEN 'DMRK'.                      "demark all filled lines
           PERFORM FCODE_TC_DEMARK_LINES USING P_TC_NAME
                                               P_TABLE_NAME
                                               P_MARK_NAME .
           CLEAR P_OK.
        WHEN 'SASCEND'   OR
             'SDESCEND'.                  "sort column
          PERFORM FCODE_SORT_TC USING P_TC_NAME
                                      l_ok.
       ENDCASE.
    ENDFORM.                              " USER_OK_TC
    *&      Form  FCODE_INSERT_ROW                                         *
    FORM fcode_insert_row
                   USING    P_TC_NAME           TYPE DYNFNAM
                            P_TABLE_NAME             .
    &SPWIZARD: BEGIN OF LOCAL DATA----
       DATA L_LINES_NAME       LIKE FELD-NAME.
       DATA L_SELLINE          LIKE SY-STEPL.
       DATA L_LASTLINE         TYPE I.
       DATA L_LINE             TYPE I.
       DATA L_TABLE_NAME       LIKE FELD-NAME.
       FIELD-SYMBOLS <TC>                 TYPE CXTAB_CONTROL.
       FIELD-SYMBOLS <TABLE>              TYPE STANDARD TABLE.
       FIELD-SYMBOLS <LINES>              TYPE I.
    &SPWIZARD: END OF LOCAL DATA----
       ASSIGN (P_TC_NAME) TO <TC>.
    *&SPWIZARD: get the table, which belongs to the tc                     *
       CONCATENATE P_TABLE_NAME '[]' INTO L_TABLE_NAME. "table body
       ASSIGN (L_TABLE_NAME) TO <TABLE>.                "not headerline
    *&SPWIZARD: get looplines of TableControl                              *
       CONCATENATE 'G_' P_TC_NAME '_LINES' INTO L_LINES_NAME.
       ASSIGN (L_LINES_NAME) TO <LINES>.
    *&SPWIZARD: get current line                                           *
       GET CURSOR LINE L_SELLINE.
       IF SY-SUBRC <> 0.                   " append line to table
         L_SELLINE = <TC>-LINES + 1.
    *&SPWIZARD: set top line                                               *
         IF L_SELLINE > <LINES>.
           <TC>-TOP_LINE = L_SELLINE - <LINES> + 1 .
         ELSE.
           <TC>-TOP_LINE = 1.
         ENDIF.
       ELSE.                               " insert line into table
         L_SELLINE = <TC>-TOP_LINE + L_SELLINE - 1.
         L_LASTLINE = <TC>-TOP_LINE + <LINES> - 1.
       ENDIF.
    *&SPWIZARD: set new cursor line                                        *
       L_LINE = L_SELLINE - <TC>-TOP_LINE + 1.
    *&SPWIZARD: insert initial line                                        *
       INSERT INITIAL LINE INTO <TABLE> INDEX L_SELLINE.
       <TC>-LINES = <TC>-LINES + 1.
    *&SPWIZARD: set cursor                                                 *
       SET CURSOR LINE L_LINE.
    ENDFORM.                              " FCODE_INSERT_ROW
    *&      Form  FCODE_DELETE_ROW                                         *
    FORM fcode_delete_row
                   USING    P_TC_NAME           TYPE DYNFNAM
                            P_TABLE_NAME
                            P_MARK_NAME   .
    &SPWIZARD: BEGIN OF LOCAL DATA----
       DATA L_TABLE_NAME       LIKE FELD-NAME.
       FIELD-SYMBOLS <TC>         TYPE cxtab_control.
       FIELD-SYMBOLS <TABLE>      TYPE STANDARD TABLE.
       FIELD-SYMBOLS <WA>.
       FIELD-SYMBOLS <MARK_FIELD>.
    &SPWIZARD: END OF LOCAL DATA----
       ASSIGN (P_TC_NAME) TO <TC>.
    *&SPWIZARD: get the table, which belongs to the tc                     *
       CONCATENATE P_TABLE_NAME '[]' INTO L_TABLE_NAME. "table body
       ASSIGN (L_TABLE_NAME) TO <TABLE>.                "not headerline
    *&SPWIZARD: delete marked lines                                        *
       DESCRIBE TABLE <TABLE> LINES <TC>-LINES.
       LOOP AT <TABLE> ASSIGNING <WA>.
    *&SPWIZARD: access to the component 'FLAG' of the table header         *
         ASSIGN COMPONENT P_MARK_NAME OF STRUCTURE <WA> TO <MARK_FIELD>.
         IF <MARK_FIELD> = 'X'.
           DELETE <TABLE> INDEX SYST-TABIX.
           IF SY-SUBRC = 0.
             <TC>-LINES = <TC>-LINES - 1.
           ENDIF.
         ENDIF.
       ENDLOOP.
    ENDFORM.                              " FCODE_DELETE_ROW
    *&      Form  COMPUTE_SCROLLING_IN_TC
          text
         -->P_TC_NAME  name of tablecontrol
         -->P_OK       ok code
    FORM COMPUTE_SCROLLING_IN_TC USING    P_TC_NAME
                                           P_OK.
    &SPWIZARD: BEGIN OF LOCAL DATA----
       DATA L_TC_NEW_TOP_LINE     TYPE I.
       DATA L_TC_NAME             LIKE FELD-NAME.
       DATA L_TC_LINES_NAME       LIKE FELD-NAME.
       DATA L_TC_FIELD_NAME       LIKE FELD-NAME.
       FIELD-SYMBOLS <TC>         TYPE cxtab_control.
       FIELD-SYMBOLS <LINES>      TYPE I.
    &SPWIZARD: END OF LOCAL DATA----
       ASSIGN (P_TC_NAME) TO <TC>.
    *&SPWIZARD: get looplines of TableControl                              *
       CONCATENATE 'G_' P_TC_NAME '_LINES' INTO L_TC_LINES_NAME.
       ASSIGN (L_TC_LINES_NAME) TO <LINES>.
    *&SPWIZARD: is no line filled?                                         *
       IF <TC>-LINES = 0.
    *&SPWIZARD: yes, ...                                                   *
         L_TC_NEW_TOP_LINE = 1.
       ELSE.
    *&SPWIZARD: no, ...                                                    *
         CALL FUNCTION 'SCROLLING_IN_TABLE'
              EXPORTING
                   ENTRY_ACT             = <TC>-TOP_LINE
                   ENTRY_FROM            = 1
                   ENTRY_TO              = <TC>-LINES
                   LAST_PAGE_FULL        = 'X'
                   LOOPS                 = <LINES>
                   OK_CODE               = P_OK
                   OVERLAPPING           = 'X'
              IMPORTING
                   ENTRY_NEW             = L_TC_NEW_TOP_LINE
              EXCEPTIONS
                 NO_ENTRY_OR_PAGE_ACT  = 01
                 NO_ENTRY_TO           = 02
                 NO_OK_CODE_OR_PAGE_GO = 03
                   OTHERS                = 0.
       ENDIF.
    *&SPWIZARD: get actual tc and column                                   *
       GET CURSOR FIELD L_TC_FIELD_NAME
                  AREA  L_TC_NAME.
       IF SYST-SUBRC = 0.
         IF L_TC_NAME = P_TC_NAME.
    *&SPWIZARD: et actual column                                           *
           SET CURSOR FIELD L_TC_FIELD_NAME LINE 1.
         ENDIF.
       ENDIF.
    *&SPWIZARD: set the new top line                                       *
       <TC>-TOP_LINE = L_TC_NEW_TOP_LINE.
    ENDFORM.                              " COMPUTE_SCROLLING_IN_TC
    *&      Form  FCODE_TC_MARK_LINES
          marks all TableControl lines
         -->P_TC_NAME  name of tablecontrol
    FORM FCODE_TC_MARK_LINES USING P_TC_NAME
                                   P_TABLE_NAME
                                   P_MARK_NAME.
    &SPWIZARD: EGIN OF LOCAL DATA----
      DATA L_TABLE_NAME       LIKE FELD-NAME.
      FIELD-SYMBOLS <TC>         TYPE cxtab_control.
      FIELD-SYMBOLS <TABLE>      TYPE STANDARD TABLE.
      FIELD-SYMBOLS <WA>.
      FIELD-SYMBOLS <MARK_FIELD>.
    &SPWIZARD: END OF LOCAL DATA----
      ASSIGN (P_TC_NAME) TO <TC>.
    *&SPWIZARD: get the table, which belongs to the tc                     *
       CONCATENATE P_TABLE_NAME '[]' INTO L_TABLE_NAME. "table body
       ASSIGN (L_TABLE_NAME) TO <TABLE>.                "not headerline
    *&SPWIZARD: mark all filled lines                                      *
      LOOP AT <TABLE> ASSIGNING <WA>.
    *&SPWIZARD: access to the component 'FLAG' of the table header         *
         ASSIGN COMPONENT P_MARK_NAME OF STRUCTURE <WA> TO <MARK_FIELD>.
         <MARK_FIELD> = 'X'.
      ENDLOOP.
    ENDFORM.                                          "fcode_tc_mark_lines
    *&      Form  FCODE_TC_DEMARK_LINES
          demarks all TableControl lines
         -->P_TC_NAME  name of tablecontrol
    FORM FCODE_TC_DEMARK_LINES USING P_TC_NAME
                                     P_TABLE_NAME
                                     P_MARK_NAME .
    &SPWIZARD: BEGIN OF LOCAL DATA----
      DATA L_TABLE_NAME       LIKE FELD-NAME.
      FIELD-SYMBOLS <TC>         TYPE cxtab_control.
      FIELD-SYMBOLS <TABLE>      TYPE STANDARD TABLE.
      FIELD-SYMBOLS <WA>.
      FIELD-SYMBOLS <MARK_FIELD>.
    &SPWIZARD: END OF LOCAL DATA----
      ASSIGN (P_TC_NAME) TO <TC>.
    *&SPWIZARD: get the table, which belongs to the tc                     *
       CONCATENATE P_TABLE_NAME '[]' INTO L_TABLE_NAME. "table body
       ASSIGN (L_TABLE_NAME) TO <TABLE>.                "not headerline
    *&SPWIZARD: demark all filled lines                                    *
      LOOP AT <TABLE> ASSIGNING <WA>.
    *&SPWIZARD: access to the component 'FLAG' of the table header         *
         ASSIGN COMPONENT P_MARK_NAME OF STRUCTURE <WA> TO <MARK_FIELD>.
         <MARK_FIELD> = SPACE.
      ENDLOOP.
    ENDFORM.                                          "fcode_tc_mark_lines
    *&      Module  D20XX_INIT  OUTPUT
          text
    MODULE D20XX_INIT OUTPUT.
    *if screen-name = 'ZSRNO'.
           SCREEN-INPUT = 0.
           SCREEN-COLOR = 0.
           MODIFY SCREEN.
         endif.
    ENDMODULE.                 " D20XX_INIT  OUTPUT
    *&      Module  STATUS_0100  OUTPUT
          text
    MODULE STATUS_0100 OUTPUT.
    SET PF-STATUS 'xxxxxxxx'.
    SET TITLEBAR 'xxx'.
    *CLEAR R1_REF.
    DO 30 TIMES.
       APPEND G_TC1_ITAB.
    ENDDO.
      DESCRIBE TABLE G_TC1_ITAB LINES TC1-LINES.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Module  TAB1_INIT  OUTPUT
          text
    MODULE TAB1_INIT OUTPUT.
    ENDMODULE.                 " TAB1_INIT  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
          text
    MODULE USER_COMMAND_0100 INPUT.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    *&      Module  MESSAGE  INPUT
          text
    MODULE MESSAGE INPUT.
    OK_CODE = SY-UCOMM.
    S_CODE = OK_CODE.
    CLEAR OK_CODE.
    if S_CODE = 'DELE'.
    loop at G_TC1_ITAB.
    if G_TC1_ITAB-scrname = 'X'.
    delete g_tc1_itab.
    endif.
    endloop.
    ELSEIF S_CODE = 'SAVE'.
    G_TC1_WA-ZSRNO = T1.
    MOVE-CORRESPONDING  G_TC1_WA TO ZFG_SRNO.
      REFRESH CONTROL 'TC1' FROM SCREEN '0100'.
    ENDIF.
    ENDMODULE.                 " MESSAGE  INPUT
    *&      Module  DELETE_RECORD  INPUT
          text
    MODULE DELETE_RECORD INPUT.
      IF MARK = 'X' AND S_CODE = 'DELE'.
        DELETE TABLE G_TC1_ITAB FROM ZFG_SRNO.
        DESCRIBE TABLE G_TC1_ITAB LINES TC1-LINES.
      ENDIF.
    ENDMODULE.                 " DELETE_RECORD  INPUT
    *********************Screen modules*********************
    PROCESS BEFORE OUTPUT.
    *&SPWIZARD: PBO FLOW LOGIC FOR TABLECONTROL 'TC1'
      MODULE TC1_INIT.
    *&SPWIZARD: MODULE TC1_CHANGE_TC_ATTR.
    *&SPWIZARD: MODULE TC1_CHANGE_COL_ATTR.
      LOOP AT   G_TC1_ITAB
           INTO G_TC1_WA
           WITH CONTROL TC1
           CURSOR TC1-CURRENT_LINE.
    *&SPWIZARD:   MODULE TC1_CHANGE_FIELD_ATTR
        MODULE TC1_MOVE.
       MODULE TAB1_INIT.
       MODULE TC1_GET_LINES.
      ENDLOOP.
    MODULE D20XX_INIT.
    MODULE STATUS_0100.
    PROCESS AFTER INPUT.
    *&SPWIZARD: PAI FLOW LOGIC FOR TABLECONTROL 'TC1'
    *BREAK POINT.
      LOOP AT G_TC1_ITAB.
        CHAIN.
          FIELD ZFG_SRNO-ZSRNO.
          MODULE TC1_MODIFY ON CHAIN-REQUEST.
         MODULE TC1_MODIFY.
        ENDCHAIN.
          MODULE MESSAGE .
        MODULE DELETE_RECORD.
      ENDLOOP.
      MODULE TC1_USER_COMMAND.
    *&SPWIZARD: MODULE TC1_CHANGE_TC_ATTR.
    *&SPWIZARD: MODULE TC1_CHANGE_COL_ATTR.
    MODULE USER_COMMAND_0100.

  • Table control layout

    Hi All can someone tell me how to design the complete layout of a table control.
    please tell me step-by-step process.
    reward points for all useful ans

    hi,
    •Step 1 (Create new structure for table control)
    Type is name of structure (ZTC_EKKO) and press create
    •Step 2 (Create Program)
    Goto transaction SE80(Object Navigator) -> Repository Browser -> Program.
    Enter your program name, please ensure that is begins with SAPMZ…… as this is a module pool (dialog program).
    Press enter to create, and press yes!
    Ensure that you create a top include, and press Enter.
    Accept the name created for the top include.
    Press Enter.    
    Press Save
    •Step 3 (Create TOP include)
    Double click on the top include and enter following ABAP code:
    Tables: ZTC_EKKO.
    controls: tc100 type tableview using screen 100.
    data: ok_code type sy-ucomm.
    data: it_ekko type standard
                 table of ZTC_EKKO initial size 0,
               wa_ekko type ZTC_EKKO.
    data: ok_code type sy-ucomm.
         Press Save and Activate
    •Step 4 (Create screen)
    Right click the program to create a screen 100 for the dialog. Enter Short description, set screen type to Normal and enter 0 or blank into Next screen. Then move to Element List tab and enter the OK code as OK_CODE (i.e. the same as what you declared in the top include with data: ok_code type sy-ucomm).
    •Step 5 (Create table control)
    Press the Layout button to bring up the screen painter editor.
    Press table control button and drag it on to the screen, enter the name of table control created in TOP include (TC100). Now press the yellow button for attributes and set the table control as below options
    •Step 6 (Populate table control )
    Press the orange button (Fields). On the next screen enter ZTC_EKKO and press the ‘Get from Dict’ button. Select the fields you want (all) and press enter. Now drag them onto your Table Control.
    Below is the result, there will been syntax errors if we check now! So Save and go back into the flow logic tab.
    •Step 7 (Create flow control )
    Within the flow logic of screen 100 and create two modules, one to select the data from the database and the other to move the selected fields into the table control. Also insert the two loop statements to populate and retrieve the lines of the table control.
    PROCESS BEFORE OUTPUT.
    MODULE STATUS_0100.
      module data_retrieval.
      loop at it_ekko into wa_ekko with control TC100.
        module populate_screen.
      endloop.
    PROCESS AFTER INPUT.
      loop at it_ekko.
      endloop.
    MODULE USER_COMMAND_0100.
    Double click the module data_retrieval to create and click yes to get past the popup. Ensure that a new include is created to hold all the PBO modules (default). Press enter.
    Select 10 rows of data from the EKKO table and load into the internal table it_ekko. Go back to the flow logic to load this data into the Table Control.
    ***INCLUDE MZ_TCONTROL_DATA_RETRIEVALO01 .
    *&      Module  data_retrieval  OUTPUT
          text
    MODULE data_retrieval OUTPUT.
    select data from ekko table
      SELECT ebeln bukrs bstyp bsart
             bsakz loekz statu aedat
       UP TO 10 ROWS
        FROM ekko
        INTO CORRESPONDING FIELDS OF TABLE it_ekko.
    ENDMODULE.                 " data_retrieval  OUTPUT
    Double click the module populate_screen to create. Now move the values in this loop from the wa_ekko into the Table Control with the move-corresponding statement.
    MODULE populate_screen OUTPUT.
        DATA: ld_line TYPE i.
      Set which line of table is a top of displayed table control
        IF sy-stepl = 1.
          tc100-lines =
            tc100-top_line + sy-loopc - 1.
        ENDIF.
      move fields from work area to scrren fields
        MOVE-CORRESPONDING wa_ekko TO ztc_ekko.
      ENDMODULE.                 " populate_screen  OUTPUT
    •Step 8 (Create transaction )
    Now create a transaction to test the table control program. Right click the Program and select create-> transaction.
    •Step 9 (Execute transaction )
    Execute transaction ZTC
    but table contro wizrd automatically generates the code. try it
    reward if its useful.

  • How to delete the row in table control with respect to one field in module pool programming?

    Hi,
    Can I know the way to delete the row in table control with respect to one field in module pool programming
    Regards
    Darshan MS

    HI,
    I want to delete the row after the display of table control. I have created push button as delete row. If I click on this push button, the selected row should get deleted.
    I have written this code,
    module USER_COMMAND_9000 input.
    DATA OK_CODE TYPE SY-UCOMM.
    OK_CODE = SY-UCOMM.
    CASE OK_CODE.
         WHEN 'DELETE'.
            LOOP AT lt_source INTO ls_source WHERE mark = 'X'.
                APPEND LS_SOURCE TO LT_RESTORE.
                DELETE TABLE LT_SOURCE FROM LS_SOURCE.
                SOURCE-LINES = SOURCE-LINES - 1.
            ENDLOOP.
    But I'm unable to delete the selected rows, It is getting deleted the last rows eventhough I select the other row.
    So I thought of doing with respect to the field.

  • Table control Dialog program

    I am Using table control wizard.once user click on button data will be populated in Table control from datatabase table
    once after getting data the lines which doesnot have data are disabled but
    user should be allowed to  enter and Update and delete data once after clicking
    ENTER Key  that data should be updated in the data base table.
    i am sending my program.
    SCREEN DESIGN .
    PROCESS BEFORE OUTPUT.
    *&SPWIZARD: PBO FLOW LOGIC FOR TABLECONTROL 'TAB1'
      MODULE TAB1_CHANGE_TC_ATTR.
    *&SPWIZARD: MODULE TAB1_CHANGE_COL_ATTR.
      LOOP AT   IT_TAB3
           INTO WA_TAB3
           WITH CONTROL TAB1
           CURSOR TAB1-CURRENT_LINE.
        MODULE TAB1_GET_LINES.
    *&SPWIZARD:   MODULE TAB1_CHANGE_FIELD_ATTR
      ENDLOOP.
    * MODULE STATUS_1002.
    PROCESS AFTER INPUT.
    *&SPWIZARD: PAI FLOW LOGIC FOR TABLECONTROL 'TAB1'
      LOOP AT IT_TAB3.
        CHAIN.
          FIELD WA_TAB3-VBELN.
          FIELD WA_TAB3-POSNR.
          MODULE TAB1_MODIFY ON CHAIN-REQUEST.
        endchain.
        FIELD WA_TAB3-SP1
          MODULE TAB1_MARK ON REQUEST.
      ENDLOOP.
    *  MODULE TAB1_BUTTON.
      MODULE TAB1_BUTTONIP.
      MODULE TAB1_USER_COMMAND.
    *&SPWIZARD: MODULE TAB1_CHANGE_TC_ATTR.
    *&SPWIZARD: MODULE TAB1_CHANGE_COL_ATTR.
    * MODULE USER_COMMAND_1002.
    PROGRAM  Z_VI_TABL2.
    TYPES: BEGIN OF TY_TAB3,
           SP1(2) TYPE C,
           VBELN TYPE VBELN_VL,
           POSNR TYPE POSNR_VL,
           END OF TY_TAB3.
    TYPES: BEGIN OF TY_FILL,
           OBJKY TYPE OBJKY,
           END OF TY_FILL.
    DATA : IT_TAB3 TYPE STANDARD TABLE OF TY_TAB3,
           WA_TAB3 TYPE TY_TAB3,
           IT_FILL TYPE STANDARD TABLE OF TY_FILL,
           WA_FILL TYPE TY_FILL,
           G_VBELN TYPE VBELN_VL,
           G_POSNR TYPE POSNR_VL.
    *&SPWIZARD: DECLARATION OF TABLECONTROL 'TAB1' ITSELF
    CONTROLS: TAB1 TYPE TABLEVIEW USING SCREEN 1002.
    *&SPWIZARD: LINES OF TABLECONTROL 'TAB1'
    DATA:     G_TAB1_LINES  LIKE SY-LOOPC.
    DATA:     OK_CODE LIKE SY-UCOMM.
    *&SPWIZARD: OUTPUT MODULE FOR TC 'TAB1'. DO NOT CHANGE THIS LINE!
    *&SPWIZARD: UPDATE LINES FOR EQUIVALENT SCROLLBAR
    MODULE TAB1_CHANGE_TC_ATTR OUTPUT.
      DESCRIBE TABLE IT_TAB3 LINES TAB1-lines.
    ENDMODULE.                    "TAB1_CHANGE_TC_ATTR OUTPUT
    *&SPWIZARD: OUTPUT MODULE FOR TC 'TAB1'. DO NOT CHANGE THIS LINE!
    *&SPWIZARD: GET LINES OF TABLECONTROL
    MODULE TAB1_GET_LINES OUTPUT.
      G_TAB1_LINES = SY-LOOPC.
    ENDMODULE.                    "TAB1_GET_LINES OUTPUT
    *&SPWIZARD: INPUT MODULE FOR TC 'TAB1'. DO NOT CHANGE THIS LINE!
    *&SPWIZARD: MODIFY TABLE
    MODULE TAB1_MODIFY INPUT.
    *  MODIFY IT_TAB3
    *    FROM WA_TAB3
    *    INDEX TAB1-CURRENT_LINE.
      WA_TAB3-POSNR = 10.
      APPEND WA_TAB3 TO IT_TAB3.
    ENDMODULE.                    "TAB1_MODIFY INPUT
    *&SPWIZARD: INPUT MODUL FOR TC 'TAB1'. DO NOT CHANGE THIS LINE!
    *&SPWIZARD: MARK TABLE
    MODULE TAB1_MARK INPUT.
      DATA: g_TAB1_wa2 like line of IT_TAB3.
      if TAB1-line_sel_mode = 1
      and WA_TAB3-SP1 = 'X'.
        loop at IT_TAB3 into g_TAB1_wa2
          where SP1 = 'X'.
          g_TAB1_wa2-SP1 = ''.
          modify IT_TAB3
            from g_TAB1_wa2
            transporting SP1.
        endloop.
      endif.
      MODIFY IT_TAB3
        FROM WA_TAB3
        INDEX TAB1-CURRENT_LINE.
    *    TRANSPORTING SP1.
    ENDMODULE.                    "TAB1_MARK INPUT
    *&SPWIZARD: INPUT MODULE FOR TC 'TAB1'. DO NOT CHANGE THIS LINE!
    *&SPWIZARD: PROCESS USER COMMAND
    MODULE TAB1_USER_COMMAND INPUT.
      OK_CODE = SY-UCOMM.
      PERFORM USER_OK_TC USING    'TAB1'
                                  'IT_TAB3'
                                  'SP1'
                         CHANGING OK_CODE.
      SY-UCOMM = OK_CODE.
    ENDMODULE.                    "TAB1_USER_COMMAND INPUT
    *   INCLUDE TABLECONTROL_FORMS                                         *
    *&      Form  USER_OK_TC                                               *
    FORM USER_OK_TC USING    P_TC_NAME TYPE DYNFNAM
                             P_TABLE_NAME
                             P_MARK_NAME
                    CHANGING P_OK      LIKE SY-UCOMM.
    *&SPWIZARD: BEGIN OF LOCAL DATA----------------------------------------*
      DATA: L_OK              TYPE SY-UCOMM,
            L_OFFSET          TYPE I.
    *&SPWIZARD: END OF LOCAL DATA------------------------------------------*
    *&SPWIZARD: Table control specific operations                          *
    *&SPWIZARD: evaluate TC name and operations                            *
      SEARCH P_OK FOR P_TC_NAME.
      IF SY-SUBRC <> 0.
        EXIT.
      ENDIF.
      L_OFFSET = STRLEN( P_TC_NAME ) + 1.
      L_OK = P_OK+L_OFFSET.
    *&SPWIZARD: execute general and TC specific operations                 *
      CASE L_OK.
        WHEN 'INSR'.                      "insert row
          PERFORM FCODE_INSERT_ROW USING    P_TC_NAME
                                            P_TABLE_NAME.
          CLEAR P_OK.
        WHEN 'DELE'.                      "delete row
          PERFORM FCODE_DELETE_ROW USING    P_TC_NAME
                                            P_TABLE_NAME
                                            P_MARK_NAME.
          CLEAR P_OK.
        WHEN 'P--' OR                     "top of list
             'P-'  OR                     "previous page
             'P+'  OR                     "next page
             'P++'.                       "bottom of list
          PERFORM COMPUTE_SCROLLING_IN_TC USING P_TC_NAME
                                                L_OK.
          CLEAR P_OK.
    *     WHEN 'L--'.                       "total left
    *       PERFORM FCODE_TOTAL_LEFT USING P_TC_NAME.
    *     WHEN 'L-'.                        "column left
    *       PERFORM FCODE_COLUMN_LEFT USING P_TC_NAME.
    *     WHEN 'R+'.                        "column right
    *       PERFORM FCODE_COLUMN_RIGHT USING P_TC_NAME.
    *     WHEN 'R++'.                       "total right
    *       PERFORM FCODE_TOTAL_RIGHT USING P_TC_NAME.
        WHEN 'MARK'.                      "mark all filled lines
          PERFORM FCODE_TC_MARK_LINES USING P_TC_NAME
                                            P_TABLE_NAME
                                            P_MARK_NAME   .
          CLEAR P_OK.
        WHEN 'DMRK'.                      "demark all filled lines
          PERFORM FCODE_TC_DEMARK_LINES USING P_TC_NAME
                                              P_TABLE_NAME
                                              P_MARK_NAME .
          CLEAR P_OK.
    *     WHEN 'SASCEND'   OR
    *          'SDESCEND'.                  "sort column
    *       PERFORM FCODE_SORT_TC USING P_TC_NAME
    *                                   l_ok.
      ENDCASE.
    ENDFORM.                              " USER_OK_TC
    *&      Form  FCODE_INSERT_ROW                                         *
    FORM fcode_insert_row
                  USING    P_TC_NAME           TYPE DYNFNAM
                           P_TABLE_NAME             .
    *&SPWIZARD: BEGIN OF LOCAL DATA----------------------------------------*
      DATA L_LINES_NAME       LIKE FELD-NAME.
      DATA L_SELLINE          LIKE SY-STEPL.
      DATA L_LASTLINE         TYPE I.
      DATA L_LINE             TYPE I.
      DATA L_TABLE_NAME       LIKE FELD-NAME.
      FIELD-SYMBOLS <TC>                 TYPE CXTAB_CONTROL.
      FIELD-SYMBOLS <TABLE>              TYPE STANDARD TABLE.
      FIELD-SYMBOLS <LINES>              TYPE I.
    *&SPWIZARD: END OF LOCAL DATA------------------------------------------*
      ASSIGN (P_TC_NAME) TO <TC>.
    *&SPWIZARD: get the table, which belongs to the tc                     *
      CONCATENATE P_TABLE_NAME '[]' INTO L_TABLE_NAME. "table body
      ASSIGN (L_TABLE_NAME) TO <TABLE>.                "not headerline
    *&SPWIZARD: get looplines of TableControl                              *
      CONCATENATE 'G_' P_TC_NAME '_LINES' INTO L_LINES_NAME.
      ASSIGN (L_LINES_NAME) TO <LINES>.
    *&SPWIZARD: get current line                                           *
      GET CURSOR LINE L_SELLINE.
      IF SY-SUBRC <> 0.                   " append line to table
        L_SELLINE = <TC>-LINES + 1.
    *&SPWIZARD: set top line                                               *
        IF L_SELLINE > <LINES>.
          <TC>-TOP_LINE = L_SELLINE - <LINES> + 1 .
        ELSE.
          <TC>-TOP_LINE = 1.
        ENDIF.
      ELSE.                               " insert line into table
        L_SELLINE = <TC>-TOP_LINE + L_SELLINE - 1.
        L_LASTLINE = <TC>-TOP_LINE + <LINES> - 1.
      ENDIF.
    *&SPWIZARD: set new cursor line                                        *
      L_LINE = L_SELLINE - <TC>-TOP_LINE + 1.
    *&SPWIZARD: insert initial line                                        *
      INSERT INITIAL LINE INTO <TABLE> INDEX L_SELLINE.
      <TC>-LINES = <TC>-LINES + 1.
    *&SPWIZARD: set cursor                                                 *
      SET CURSOR LINE L_LINE.
    ENDFORM.                              " FCODE_INSERT_ROW
    *&      Form  FCODE_DELETE_ROW                                         *
    FORM fcode_delete_row
                  USING    P_TC_NAME           TYPE DYNFNAM
                           P_TABLE_NAME
                           P_MARK_NAME   .
    *&SPWIZARD: BEGIN OF LOCAL DATA----------------------------------------*
      DATA L_TABLE_NAME       LIKE FELD-NAME.
      FIELD-SYMBOLS <TC>         TYPE cxtab_control.
      FIELD-SYMBOLS <TABLE>      TYPE STANDARD TABLE.
      FIELD-SYMBOLS <WA>.
      FIELD-SYMBOLS <MARK_FIELD>.
    *&SPWIZARD: END OF LOCAL DATA------------------------------------------*
      ASSIGN (P_TC_NAME) TO <TC>.
    *&SPWIZARD: get the table, which belongs to the tc                     *
      CONCATENATE P_TABLE_NAME '[]' INTO L_TABLE_NAME. "table body
      ASSIGN (L_TABLE_NAME) TO <TABLE>.                "not headerline
    *&SPWIZARD: delete marked lines                                        *
      DESCRIBE TABLE <TABLE> LINES <TC>-LINES.
      LOOP AT <TABLE> ASSIGNING <WA>.
    *&SPWIZARD: access to the component 'FLAG' of the table header         *
        ASSIGN COMPONENT P_MARK_NAME OF STRUCTURE <WA> TO <MARK_FIELD>.
        IF <MARK_FIELD> = 'X'.
          DELETE <TABLE> INDEX SYST-TABIX.
          IF SY-SUBRC = 0.
            <TC>-LINES = <TC>-LINES - 1.
          ENDIF.
        ENDIF.
      ENDLOOP.
    ENDFORM.                              " FCODE_DELETE_ROW
    *&      Form  COMPUTE_SCROLLING_IN_TC
    *       text
    *      -->P_TC_NAME  name of tablecontrol
    *      -->P_OK       ok code
    FORM COMPUTE_SCROLLING_IN_TC USING    P_TC_NAME
                                          P_OK.
    *&SPWIZARD: BEGIN OF LOCAL DATA----------------------------------------*
      DATA L_TC_NEW_TOP_LINE     TYPE I.
      DATA L_TC_NAME             LIKE FELD-NAME.
      DATA L_TC_LINES_NAME       LIKE FELD-NAME.
      DATA L_TC_FIELD_NAME       LIKE FELD-NAME.
      FIELD-SYMBOLS <TC>         TYPE cxtab_control.
      FIELD-SYMBOLS <LINES>      TYPE I.
    *&SPWIZARD: END OF LOCAL DATA------------------------------------------*
      ASSIGN (P_TC_NAME) TO <TC>.
    *&SPWIZARD: get looplines of TableControl                              *
      CONCATENATE 'G_' P_TC_NAME '_LINES' INTO L_TC_LINES_NAME.
      ASSIGN (L_TC_LINES_NAME) TO <LINES>.
    *&SPWIZARD: is no line filled?                                         *
      IF <TC>-LINES = 0.
    *&SPWIZARD: yes, ...                                                   *
        L_TC_NEW_TOP_LINE = 1.
      ELSE.
    *&SPWIZARD: no, ...                                                    *
        CALL FUNCTION 'SCROLLING_IN_TABLE'
             EXPORTING
                  ENTRY_ACT             = <TC>-TOP_LINE
                  ENTRY_FROM            = 1
                  ENTRY_TO              = <TC>-LINES
                  LAST_PAGE_FULL        = 'X'
                  LOOPS                 = <LINES>
                  OK_CODE               = P_OK
                  OVERLAPPING           = 'X'
             IMPORTING
                  ENTRY_NEW             = L_TC_NEW_TOP_LINE
             EXCEPTIONS
    *              NO_ENTRY_OR_PAGE_ACT  = 01
    *              NO_ENTRY_TO           = 02
    *              NO_OK_CODE_OR_PAGE_GO = 03
                  OTHERS                = 0.
      ENDIF.
    *&SPWIZARD: get actual tc and column                                   *
      GET CURSOR FIELD L_TC_FIELD_NAME
                 AREA  L_TC_NAME.
      IF SYST-SUBRC = 0.
        IF L_TC_NAME = P_TC_NAME.
    *&SPWIZARD: et actual column                                           *
          SET CURSOR FIELD L_TC_FIELD_NAME LINE 1.
        ENDIF.
      ENDIF.
    *&SPWIZARD: set the new top line                                       *
      <TC>-TOP_LINE = L_TC_NEW_TOP_LINE.
    ENDFORM.                              " COMPUTE_SCROLLING_IN_TC
    *&      Form  FCODE_TC_MARK_LINES
    *       marks all TableControl lines
    *      -->P_TC_NAME  name of tablecontrol
    FORM FCODE_TC_MARK_LINES USING P_TC_NAME
                                   P_TABLE_NAME
                                   P_MARK_NAME.
    *&SPWIZARD: EGIN OF LOCAL DATA-----------------------------------------*
      DATA L_TABLE_NAME       LIKE FELD-NAME.
      FIELD-SYMBOLS <TC>         TYPE cxtab_control.
      FIELD-SYMBOLS <TABLE>      TYPE STANDARD TABLE.
      FIELD-SYMBOLS <WA>.
      FIELD-SYMBOLS <MARK_FIELD>.
    *&SPWIZARD: END OF LOCAL DATA------------------------------------------*
      ASSIGN (P_TC_NAME) TO <TC>.
    *&SPWIZARD: get the table, which belongs to the tc                     *
      CONCATENATE P_TABLE_NAME '[]' INTO L_TABLE_NAME. "table body
      ASSIGN (L_TABLE_NAME) TO <TABLE>.                "not headerline
    *&SPWIZARD: mark all filled lines                                      *
      LOOP AT <TABLE> ASSIGNING <WA>.
    *&SPWIZARD: access to the component 'FLAG' of the table header         *
        ASSIGN COMPONENT P_MARK_NAME OF STRUCTURE <WA> TO <MARK_FIELD>.
        <MARK_FIELD> = 'X'.
      ENDLOOP.
    ENDFORM.                                          "fcode_tc_mark_lines
    *&      Form  FCODE_TC_DEMARK_LINES
    *       demarks all TableControl lines
    *      -->P_TC_NAME  name of tablecontrol
    FORM FCODE_TC_DEMARK_LINES USING P_TC_NAME
                                     P_TABLE_NAME
                                     P_MARK_NAME .
    *&SPWIZARD: BEGIN OF LOCAL DATA----------------------------------------*
      DATA L_TABLE_NAME       LIKE FELD-NAME.
      FIELD-SYMBOLS <TC>         TYPE cxtab_control.
      FIELD-SYMBOLS <TABLE>      TYPE STANDARD TABLE.
      FIELD-SYMBOLS <WA>.
      FIELD-SYMBOLS <MARK_FIELD>.
    *&SPWIZARD: END OF LOCAL DATA------------------------------------------*
      ASSIGN (P_TC_NAME) TO <TC>.
    *&SPWIZARD: get the table, which belongs to the tc                     *
      CONCATENATE P_TABLE_NAME '[]' INTO L_TABLE_NAME. "table body
      ASSIGN (L_TABLE_NAME) TO <TABLE>.                "not headerline
    *&SPWIZARD: demark all filled lines                                    *
      LOOP AT <TABLE> ASSIGNING <WA>.
    *&SPWIZARD: access to the component 'FLAG' of the table header         *
        ASSIGN COMPONENT P_MARK_NAME OF STRUCTURE <WA> TO <MARK_FIELD>.
        <MARK_FIELD> = SPACE.
      ENDLOOP.
    ENDFORM.                                          "fcode_tc_mark_lines
    *&      Module  TAB1_BUTTON  INPUT
    *       text
    MODULE TAB1_BUTTONIP.
      CASE SY-UCOMM.
        WHEN 'DELI'.
          REFRESH IT_TAB3.
          SELECT OBJKY
                 INTO TABLE IT_FILL
                 FROM DRAD
                 WHERE DOKNR = 'T-F122' AND
                       DOKOB = 'LIPS'.
          IF SY-SUBRC = 0.
            LOOP AT IT_FILL INTO WA_FILL.
              wa_tab3-vbeln = WA_FILL-OBJKY+0(10).
              wa_tab3-posnr = WA_FILL-OBJKY+10(4).
              APPEND wa_tab3 TO IT_TAB3.
            ENDLOOP.
            DELETE ADJACENT DUPLICATES FROM IT_TAB3.
         ENDIF.
      ENDCASE.

    hi Sonarali,
    this FM is of no use to you.
    in your PAI you have to loop at the table control table and put a method here you read the lines and save it.
    if you use wizard to create a table control it will automatically give the code to you...

  • Getting values from the table control to the program

    Hi Gurus,
    i created a program for sales order creation to transfer order creation and to insert multiple values i defined my own selection screen by inserting table control before that the code executed succesfully but after inserting the table control it is not creating any documents
    code before inserting table control:-
    REPORT  zcl120_sales_n_delivery.
                      SALES DOCUMENT CREATION
    PARAMETERS: p_auart TYPE auart OBLIGATORY.
    PARAMETERS: p_vkorg TYPE vkorg OBLIGATORY.
    PARAMETERS: p_vtweg TYPE vtweg OBLIGATORY.
    PARAMETERS: p_spart TYPE vtweg OBLIGATORY.
    PARAMETERS: p_sold TYPE kunnr OBLIGATORY.
    PARAMETERS: p_ship TYPE kunnr OBLIGATORY.
    *ITEM
    PARAMETERS: p_matnr TYPE matnr OBLIGATORY.
    PARAMETERS: p_menge TYPE kwmeng OBLIGATORY.
    PARAMETERS: p_plant TYPE werks_d OBLIGATORY.
    PARAMETERS: p_itcat TYPE pstyv OBLIGATORY.
    DATA DECLARATIONS.
    DATA: v_vbeln LIKE vbak-vbeln.
    DATA: header LIKE bapisdhead1.
    DATA: headerx LIKE bapisdhead1x.
    DATA: item LIKE bapisditem OCCURS 0 WITH HEADER LINE.
    DATA: itemx LIKE bapisditemx OCCURS 0 WITH HEADER LINE.
    DATA: partner LIKE bapipartnr OCCURS 0 WITH HEADER LINE.
    DATA: return LIKE bapiret2 OCCURS 0 WITH HEADER LINE.
    DATA: lt_schedules_inx TYPE STANDARD TABLE OF bapischdlx
    WITH HEADER LINE.
    DATA: lt_schedules_in TYPE STANDARD TABLE OF bapischdl
    WITH HEADER LINE.
    HEADER DATA
    header-doc_type = p_auart.
    headerx-doc_type = 'X'.
    header-sales_org = p_vkorg.
    headerx-sales_org = 'X'.
    header-distr_chan = p_vtweg.
    headerx-distr_chan = 'X'.
    header-division = p_spart.
    headerx-division = 'X'.
    headerx-updateflag = 'I'.
    partner-partn_role = 'AG'.
    partner-partn_numb = p_sold.
    APPEND partner.
    partner-partn_role = 'WE'.
    partner-partn_numb = p_ship.
    APPEND partner.
    item-material = p_matnr.
    item-plant = p_plant.
    item-target_qty = p_menge.
    item-target_qu = 'ST'.
    item-item_categ = p_itcat.
    APPEND item.
    itemx-updateflag = 'I'.
    itemx-material = 'X'.
    itemx-plant = 'X'.
    itemx-target_qty = 'X'.
    itemx-target_qu = 'X'.
    itemx-item_categ = 'X'.
    APPEND itemx.
    Fill schedule lines
    lt_schedules_in-itm_number = '000010'.
    lt_schedules_in-sched_line = '0001'.
    lt_schedules_in-req_qty = p_menge.
    APPEND lt_schedules_in.
    Fill schedule line flags
    lt_schedules_inx-itm_number = '000010'.
    lt_schedules_inx-sched_line = '0001'.
    lt_schedules_inx-updateflag = 'X'.
    lt_schedules_inx-req_qty = 'X'.
    APPEND lt_schedules_inx.
    Call the BAPI
    CALL FUNCTION 'BAPI_SALESDOCU_CREATEFROMDATA1'
      EXPORTING
        sales_header_in     = header
        sales_header_inx    = headerx
      IMPORTING
        salesdocument_ex    = v_vbeln
      TABLES
        return              = return
        sales_items_in      = item
        sales_items_inx     = itemx
        sales_schedules_in  = lt_schedules_in
        sales_schedules_inx = lt_schedules_inx
        sales_partners      = partner.
    LOOP AT return WHERE type = 'E' OR type = 'A'.
      EXIT.
    ENDLOOP.
    IF sy-subrc = 0.
      WRITE / return-message.
      WRITE: / 'Error in creating document'.
    ELSE.
      COMMIT WORK AND WAIT.
      WRITE: / 'Document ', v_vbeln, ' created'.
    ENDIF.
                      DELIVERY ORDER CREATION
    *PARAMETERS: p_vbeln LIKE vbak-vbeln.
    DATA: BEGIN OF t_vbap OCCURS 0,
            vbeln LIKE vbap-vbeln,
            posnr LIKE vbap-posnr,
            kwmeng LIKE vbap-kwmeng,
            matnr  LIKE vbap-matnr,
            werks  LIKE vbap-werks,
          END OF t_vbap.
    DATA: t_request TYPE STANDARD TABLE OF bapideliciousrequest
          WITH HEADER LINE.
    DATA: t_created TYPE STANDARD TABLE OF bapideliciouscreateditems
          WITH HEADER LINE.
    DATA: t_return TYPE STANDARD TABLE OF bapiret2 WITH HEADER LINE.
    SELECT vbeln posnr kwmeng matnr werks
           INTO TABLE t_vbap
           FROM vbap
           WHERE vbeln = v_vbeln
    LOOP AT t_vbap.
      t_request-document_numb = t_vbap-vbeln.
      t_request-document_item = t_vbap-posnr.
      t_request-quantity_sales_uom = t_vbap-kwmeng.
      t_request-id = 1.
      t_request-document_type = 'A'.
      t_request-delivery_date      = sy-datum.
      t_request-material = t_vbap-matnr.
      t_request-plant = t_vbap-werks.
      t_request-date = sy-datum.
      t_request-goods_issue_date = sy-datum.
      t_request-goods_issue_time = sy-uzeit.
      APPEND t_request.
    ENDLOOP.
    CALL FUNCTION 'BAPI_DELIVERYPROCESSING_EXEC'
      TABLES
        request      = t_request
        createditems = t_created
        return       = t_return.
    READ TABLE t_return WITH KEY type = 'E'.
    IF sy-subrc = 0.
      MESSAGE e208(00) WITH 'Delivery creation error'.
    ENDIF.
    COMMIT WORK.
    READ TABLE t_created INDEX 1.
    WRITE: /  'Delivery Number : ',
             t_created-document_numb.
                      CREATE TRANSFER ORDER
    DATA: w_tanum TYPE ltak-tanum.
    CALL FUNCTION 'L_TO_CREATE_DN'
      EXPORTING
        i_lgnum                          = '010'
        i_vbeln                          = t_created-document_numb
    IMPORTING
       e_tanum                          = w_tanum
    EXCEPTIONS
       foreign_lock                     = 1
       dn_completed                     = 2
       partial_delivery_forbidden       = 3
       xfeld_wrong                      = 4
       ldest_wrong                      = 5
       drukz_wrong                      = 6
       dn_wrong                         = 7
       squit_forbidden                  = 8
       no_to_created                    = 9
       teilk_wrong                      = 10
       update_without_commit            = 11
       no_authority                     = 12
       no_picking_allowed               = 13
       dn_hu_not_choosable              = 14
       input_error                      = 15
       OTHERS                           = 16
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    COMMIT WORK AND WAIT.
    WRITE: / 'Transfer order number',
           w_tanum.
    Code after inserting table control:-
    REPORT  zcl120_sales_n_delivery.
                      SALES DOCUMENT CREATION
    DATA: p_auart TYPE auart .
    DATA: p_vkorg TYPE vkorg .
    DATA: p_vtweg TYPE vtweg .
    DATA: p_spart TYPE vtweg .
    DATA: p_sold TYPE kunnr .
    DATA: p_ship TYPE kunnr .
    *ITEM
    data:
    begin of it_item occurs 0,
       p_matnr TYPE matnr,
       p_menge TYPE kwmeng,
       p_plant TYPE werks_d,
       p_itcat TYPE pstyv,
    end of it_item.
    DATA DECLARATIONS.
    DATA: v_vbeln LIKE vbak-vbeln.
    DATA: header LIKE bapisdhead1.
    DATA: headerx LIKE bapisdhead1x.
    DATA: item LIKE bapisditem OCCURS 0 WITH HEADER LINE.
    DATA: itemx LIKE bapisditemx OCCURS 0 WITH HEADER LINE.
    DATA: partner LIKE bapipartnr OCCURS 0 WITH HEADER LINE.
    DATA: return LIKE bapiret2 OCCURS 0 WITH HEADER LINE.
    DATA: lt_schedules_inx TYPE STANDARD TABLE OF bapischdlx
    WITH HEADER LINE.
    DATA: lt_schedules_in TYPE STANDARD TABLE OF bapischdl
    WITH HEADER LINE.
    DATA:
      W_COUNTER TYPE I,
      IT_NUM(6) TYPE C value '000010',
      IT_LINE(4) TYPE C value '0001'.
      CALL SCREEN 100.
    HEADER DATA
    header-doc_type = p_auart.
    headerx-doc_type = 'X'.
    header-sales_org = p_vkorg.
    headerx-sales_org = 'X'.
    header-distr_chan = p_vtweg.
    headerx-distr_chan = 'X'.
    header-division = p_spart.
    headerx-division = 'X'.
    headerx-updateflag = 'I'.
    partner-partn_role = 'AG'.
    partner-partn_numb = p_sold.
    APPEND partner.
    partner-partn_role = 'WE'.
    partner-partn_numb = p_ship.
    APPEND partner.
    loop at it_item.
    CLEAR ITEM.
    item-material = it_item-p_matnr.
    item-plant = it_item-p_plant.
    item-target_qty = it_item-p_menge.
    item-target_qu = 'ST'.
    item-item_categ = it_item-p_itcat.
    APPEND item.
    W_COUNTER = W_COUNTER + 1.
    endloop.
    DO W_COUNTER TIMES.
    itemx-updateflag = 'I'.
    itemx-material = 'X'.
    itemx-plant = 'X'.
    itemx-target_qty = 'X'.
    itemx-target_qu = 'X'.
    itemx-item_categ = 'X'.
    APPEND itemx.
    ENDDO.
    Fill schedule lines
    LOOP AT IT_ITEM.
    CLEAR lt_schedules_in.
    lt_schedules_in-itm_number = IT_NUM.
    lt_schedules_in-sched_line = IT_LINE.
    lt_schedules_in-req_qty = IT_ITEM-p_menge.
    APPEND lt_schedules_in.
    IT_NUM = IT_NUM + 10.
    IT_LINE = IT_LINE + 1.
    ENDLOOP.
    IT_NUM = '000010'.
    IT_LINE = '0001'.
    Fill schedule line flags
    LOOP AT IT_ITEM.
    CLEAR lt_schedules_inx.
    lt_schedules_inx-itm_number = IT_NUM.
    lt_schedules_inx-sched_line = IT_LINE.
    lt_schedules_inx-updateflag = 'X'.
    lt_schedules_inx-req_qty = 'X'.
    APPEND lt_schedules_inx.
    IT_NUM = IT_NUM + 10.
    IT_LINE = IT_LINE + 1.
    ENDLOOP.
    Call the BAPI
    CALL FUNCTION 'BAPI_SALESDOCU_CREATEFROMDATA1'
      EXPORTING
        sales_header_in     = header
        sales_header_inx    = headerx
      IMPORTING
        salesdocument_ex    = v_vbeln
      TABLES
        return              = return
        sales_items_in      = item
        sales_items_inx     = itemx
        sales_schedules_in  = lt_schedules_in
        sales_schedules_inx = lt_schedules_inx
        sales_partners      = partner.
    LOOP AT return WHERE type = 'E' OR type = 'A'.
      EXIT.
    ENDLOOP.
    IF sy-subrc = 0.
      WRITE / return-message.
      WRITE: / 'Error in creating document'.
    ELSE.
      COMMIT WORK AND WAIT.
      WRITE: / 'Document ', v_vbeln, ' created'.
    ENDIF.
                      DELIVERY ORDER CREATION
    *PARAMETERS: p_vbeln LIKE vbak-vbeln.
    DATA: BEGIN OF t_vbap OCCURS 0,
            vbeln LIKE vbap-vbeln,
            posnr LIKE vbap-posnr,
            kwmeng LIKE vbap-kwmeng,
            matnr  LIKE vbap-matnr,
            werks  LIKE vbap-werks,
          END OF t_vbap.
    DATA: t_request TYPE STANDARD TABLE OF bapideliciousrequest
          WITH HEADER LINE.
    DATA: t_created TYPE STANDARD TABLE OF bapideliciouscreateditems
          WITH HEADER LINE.
    DATA: t_return TYPE STANDARD TABLE OF bapiret2 WITH HEADER LINE.
    SELECT vbeln posnr kwmeng matnr werks
           INTO TABLE t_vbap
           FROM vbap
           WHERE vbeln = v_vbeln
    LOOP AT t_vbap.
      t_request-document_numb = t_vbap-vbeln.
      t_request-document_item = t_vbap-posnr.
      t_request-quantity_sales_uom = t_vbap-kwmeng.
      t_request-id = 1.
      t_request-document_type = 'A'.
      t_request-delivery_date      = sy-datum.
      t_request-material = t_vbap-matnr.
      t_request-plant = t_vbap-werks.
      t_request-date = sy-datum.
      t_request-goods_issue_date = sy-datum.
      t_request-goods_issue_time = sy-uzeit.
      APPEND t_request.
    ENDLOOP.
    CALL FUNCTION 'BAPI_DELIVERYPROCESSING_EXEC'
      TABLES
        request      = t_request
        createditems = t_created
        return       = t_return.
    READ TABLE t_return WITH KEY type = 'E'.
    IF sy-subrc = 0.
      MESSAGE e208(00) WITH 'Delivery creation error'.
    ENDIF.
    COMMIT WORK.
    READ TABLE t_created INDEX 1.
    WRITE: /  'Delivery Number : ',
             t_created-document_numb.
                      CREATE TRANSFER ORDER
    DATA: w_tanum TYPE ltak-tanum.
    CALL FUNCTION 'L_TO_CREATE_DN'
      EXPORTING
        i_lgnum                          = '010'
        i_vbeln                          = t_created-document_numb
    IMPORTING
       e_tanum                          = w_tanum
    EXCEPTIONS
       foreign_lock                     = 1
       dn_completed                     = 2
       partial_delivery_forbidden       = 3
       xfeld_wrong                      = 4
       ldest_wrong                      = 5
       drukz_wrong                      = 6
       dn_wrong                         = 7
       squit_forbidden                  = 8
       no_to_created                    = 9
       teilk_wrong                      = 10
       update_without_commit            = 11
       no_authority                     = 12
       no_picking_allowed               = 13
       dn_hu_not_choosable              = 14
       input_error                      = 15
       OTHERS                           = 16
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    COMMIT WORK AND WAIT.
    WRITE: / 'Transfer order number',
           w_tanum.
    *&SPWIZARD: DECLARATION OF TABLECONTROL 'TAB_CON1' ITSELF
    CONTROLS: TAB_CON1 TYPE TABLEVIEW USING SCREEN 0100.
    *&SPWIZARD: OUTPUT MODULE FOR TC 'TAB_CON1'. DO NOT CHANGE THIS LINE!
    *&SPWIZARD: UPDATE LINES FOR EQUIVALENT SCROLLBAR
    MODULE TAB_CON1_CHANGE_TC_ATTR OUTPUT.
      DESCRIBE TABLE IT_ITEM LINES TAB_CON1-lines.
    ENDMODULE.
    *&      Module  STATUS_0100  OUTPUT
          text
    module STATUS_0100 output.
       SET PF-STATUS 'MENU'.
    SET TITLEBAR 'xxx'.
    endmodule.                 " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
          text
    module USER_COMMAND_0100 input.
    IF SY-UCOMM EQ 'START'.
    LEAVE to screen 0 .
    ENDIF.
    endmodule.                 " USER_COMMAND_0100  INPUT
    *&      Module  APPEND_IT_ITEM  INPUT
          text
    module APPEND_IT_ITEM input.
    APPEND IT_ITEM.
    CLEAR IT_ITEM.
    endmodule.                 " APPEND_IT_ITEM  INPUT
    plz help me where the error is

    Hi,
    Do same as suggested by Ramesh. Add one user command button after clicking that do the looping and call new screen.
    Ashven.

  • 'how to code for table control wizard in module pool program

    Hi Gurus,
    Please provide me a sample code of table control wizard...
    Thanks in advance!!!!
    Regards,
    Kranthi

    Hi Kranti,
    check this code... it should be helpful
    *& Module pool       Z_TABLE_CONTROL_WIZARD_DEMO                       *
    PROGRAM  z_table_control_wizard_demo             .
    DATA: BEGIN OF lt_vbak OCCURS 0,
           flag  TYPE c,
           vbeln TYPE vbeln_va,
           netwr TYPE netwr,
           kunnr TYPE kunnr,
          END OF lt_vbak.
    DATA: sfkunnr TYPE kunnr.
    *&spwizard: declaration of tablecontrol 'TCONTROL' itself
    CONTROLS: tcontrol TYPE TABLEVIEW USING SCREEN 9000.
    *&spwizard: lines of tablecontrol 'TCONTROL'
    DATA:     g_tcontrol_lines  LIKE sy-loopc.
    DATA:     ok_code LIKE sy-ucomm.
    *&spwizard: output module for tc 'TCONTROL'. do not change this line!
    *&spwizard: update lines for equivalent scrollbar
    MODULE tcontrol_change_tc_attr OUTPUT.
      DESCRIBE TABLE lt_vbak LINES tcontrol-lines.
    ENDMODULE.                    "TCONTROL_change_tc_attr OUTPUT
    *&spwizard: output module for tc 'TCONTROL'. do not change this line!
    *&spwizard: get lines of tablecontrol
    MODULE tcontrol_get_lines OUTPUT.
      g_tcontrol_lines = sy-loopc.
    ENDMODULE.                    "TCONTROL_get_lines OUTPUT
    *&spwizard: input module for tc 'TCONTROL'. do not change this line!
    *&spwizard: modify table
    MODULE tcontrol_modify INPUT.
      MODIFY lt_vbak
        INDEX tcontrol-current_line.
    ENDMODULE.                    "TCONTROL_modify INPUT
    *&spwizard: input modul for tc 'TCONTROL'. do not change this line!
    *&spwizard: mark table
    MODULE tcontrol_mark INPUT.
      DATA: g_tcontrol_wa2 LIKE LINE OF lt_vbak.
      IF tcontrol-line_sel_mode = 1.
        LOOP AT lt_vbak INTO g_tcontrol_wa2
          WHERE flag = 'X'.
          g_tcontrol_wa2-flag = ''.
          MODIFY lt_vbak
            FROM g_tcontrol_wa2
            TRANSPORTING flag.
        ENDLOOP.
      ENDIF.
      MODIFY lt_vbak
        INDEX tcontrol-current_line
        TRANSPORTING flag.
    ENDMODULE.                    "TCONTROL_mark INPUT
    *&spwizard: input module for tc 'TCONTROL'. do not change this line!
    *&spwizard: process user command
    MODULE tcontrol_user_command INPUT.
      ok_code = sy-ucomm.
      PERFORM user_ok_tc USING    'TCONTROL'
                                  'LT_VBAK'
                                  'FLAG'
                         CHANGING ok_code.
      sy-ucomm = ok_code.
    ENDMODULE.                    "TCONTROL_user_command INPUT
    *   INCLUDE TABLECONTROL_FORMS                                         *
    *&      Form  USER_OK_TC                                               *
    FORM user_ok_tc USING    p_tc_name TYPE dynfnam
                             p_table_name
                             p_mark_name
                    CHANGING p_ok      LIKE sy-ucomm.
    *&SPWIZARD: BEGIN OF LOCAL DATA----------------------------------------*
      DATA: l_ok              TYPE sy-ucomm,
            l_offset          TYPE i.
    *&SPWIZARD: END OF LOCAL DATA------------------------------------------*
    *&SPWIZARD: Table control specific operations                          *
    *&SPWIZARD: evaluate TC name and operations                            *
      SEARCH p_ok FOR p_tc_name.
      IF sy-subrc <> 0.
        EXIT.
      ENDIF.
      l_offset = STRLEN( p_tc_name ) + 1.
      l_ok = p_ok+l_offset.
    *&SPWIZARD: execute general and TC specific operations                 *
      CASE l_ok.
        WHEN 'INSR'.                      "insert row
          PERFORM fcode_insert_row USING    p_tc_name
                                            p_table_name.
          CLEAR p_ok.
        WHEN 'DELE'.                      "delete row
          PERFORM fcode_delete_row USING    p_tc_name
                                            p_table_name
                                            p_mark_name.
          CLEAR p_ok.
        WHEN 'P--' OR                     "top of list
             'P-'  OR                     "previous page
             'P+'  OR                     "next page
             'P++'.                       "bottom of list
          PERFORM compute_scrolling_in_tc USING p_tc_name
                                                l_ok.
          CLEAR p_ok.
    *     WHEN 'L--'.                       "total left
    *       PERFORM FCODE_TOTAL_LEFT USING P_TC_NAME.
    *     WHEN 'L-'.                        "column left
    *       PERFORM FCODE_COLUMN_LEFT USING P_TC_NAME.
    *     WHEN 'R+'.                        "column right
    *       PERFORM FCODE_COLUMN_RIGHT USING P_TC_NAME.
    *     WHEN 'R++'.                       "total right
    *       PERFORM FCODE_TOTAL_RIGHT USING P_TC_NAME.
        WHEN 'MARK'.                      "mark all filled lines
          PERFORM fcode_tc_mark_lines USING p_tc_name
                                            p_table_name
                                            p_mark_name   .
          CLEAR p_ok.
        WHEN 'DMRK'.                      "demark all filled lines
          PERFORM fcode_tc_demark_lines USING p_tc_name
                                              p_table_name
                                              p_mark_name .
          CLEAR p_ok.
    *     WHEN 'SASCEND'   OR
    *          'SDESCEND'.                  "sort column
    *       PERFORM FCODE_SORT_TC USING P_TC_NAME
    *                                   l_ok.
      ENDCASE.
    ENDFORM.                              " USER_OK_TC
    *&      Form  FCODE_INSERT_ROW                                         *
    FORM fcode_insert_row
                  USING    p_tc_name           TYPE dynfnam
                           p_table_name             .
    *&SPWIZARD: BEGIN OF LOCAL DATA----------------------------------------*
      DATA l_lines_name       LIKE feld-name.
      DATA l_selline          LIKE sy-stepl.
      DATA l_lastline         TYPE i.
      DATA l_line             TYPE i.
      DATA l_table_name       LIKE feld-name.
      FIELD-SYMBOLS <tc>                 TYPE cxtab_control.
      FIELD-SYMBOLS <table>              TYPE STANDARD TABLE.
      FIELD-SYMBOLS <lines>              TYPE i.
    *&SPWIZARD: END OF LOCAL DATA------------------------------------------*
      ASSIGN (p_tc_name) TO <tc>.
    *&SPWIZARD: get the table, which belongs to the tc                     *
      CONCATENATE p_table_name '[]' INTO l_table_name. "table body
      ASSIGN (l_table_name) TO <table>.                "not headerline
    *&SPWIZARD: get looplines of TableControl                              *
      CONCATENATE 'G_' p_tc_name '_LINES' INTO l_lines_name.
      ASSIGN (l_lines_name) TO <lines>.
    *&SPWIZARD: get current line                                           *
      GET CURSOR LINE l_selline.
      IF sy-subrc <> 0.                   " append line to table
        l_selline = <tc>-lines + 1.
    *&SPWIZARD: set top line                                               *
        IF l_selline > <lines>.
          <tc>-top_line = l_selline - <lines> + 1 .
        ELSE.
          <tc>-top_line = 1.
        ENDIF.
      ELSE.                               " insert line into table
        l_selline = <tc>-top_line + l_selline - 1.
        l_lastline = <tc>-top_line + <lines> - 1.
      ENDIF.
    *&SPWIZARD: set new cursor line                                        *
      l_line = l_selline - <tc>-top_line + 1.
    *&SPWIZARD: insert initial line                                        *
      INSERT INITIAL LINE INTO <table> INDEX l_selline.
      <tc>-lines = <tc>-lines + 1.
    *&SPWIZARD: set cursor                                                 *
      SET CURSOR LINE l_line.
    ENDFORM.                              " FCODE_INSERT_ROW
    *&      Form  FCODE_DELETE_ROW                                         *
    FORM fcode_delete_row
                  USING    p_tc_name           TYPE dynfnam
                           p_table_name
                           p_mark_name   .
    *&SPWIZARD: BEGIN OF LOCAL DATA----------------------------------------*
      DATA l_table_name       LIKE feld-name.
      FIELD-SYMBOLS <tc>         TYPE cxtab_control.
      FIELD-SYMBOLS <table>      TYPE STANDARD TABLE.
      FIELD-SYMBOLS <wa>.
      FIELD-SYMBOLS <mark_field>.
    *&SPWIZARD: END OF LOCAL DATA------------------------------------------*
      ASSIGN (p_tc_name) TO <tc>.
    *&SPWIZARD: get the table, which belongs to the tc                     *
      CONCATENATE p_table_name '[]' INTO l_table_name. "table body
      ASSIGN (l_table_name) TO <table>.                "not headerline
    *&SPWIZARD: delete marked lines                                        *
      DESCRIBE TABLE <table> LINES <tc>-lines.
      LOOP AT <table> ASSIGNING <wa>.
    *&SPWIZARD: access to the component 'FLAG' of the table header         *
        ASSIGN COMPONENT p_mark_name OF STRUCTURE <wa> TO <mark_field>.
        IF <mark_field> = 'X'.
          DELETE <table> INDEX syst-tabix.
          IF sy-subrc = 0.
            <tc>-lines = <tc>-lines - 1.
          ENDIF.
        ENDIF.
      ENDLOOP.
    ENDFORM.                              " FCODE_DELETE_ROW
    *&      Form  COMPUTE_SCROLLING_IN_TC
    *       text
    *      -->P_TC_NAME  name of tablecontrol
    *      -->P_OK       ok code
    FORM compute_scrolling_in_tc USING    p_tc_name
                                          p_ok.
    *&SPWIZARD: BEGIN OF LOCAL DATA----------------------------------------*
      DATA l_tc_new_top_line     TYPE i.
      DATA l_tc_name             LIKE feld-name.
      DATA l_tc_lines_name       LIKE feld-name.
      DATA l_tc_field_name       LIKE feld-name.
      FIELD-SYMBOLS <tc>         TYPE cxtab_control.
      FIELD-SYMBOLS <lines>      TYPE i.
    *&SPWIZARD: END OF LOCAL DATA------------------------------------------*
      ASSIGN (p_tc_name) TO <tc>.
    *&SPWIZARD: get looplines of TableControl                              *
      CONCATENATE 'G_' p_tc_name '_LINES' INTO l_tc_lines_name.
      ASSIGN (l_tc_lines_name) TO <lines>.
    *&SPWIZARD: is no line filled?                                         *
      IF <tc>-lines = 0.
    *&SPWIZARD: yes, ...                                                   *
        l_tc_new_top_line = 1.
      ELSE.
    *&SPWIZARD: no, ...                                                    *
        CALL FUNCTION 'SCROLLING_IN_TABLE'
             EXPORTING
                  entry_act             = <tc>-top_line
                  entry_from            = 1
                  entry_to              = <tc>-lines
                  last_page_full        = 'X'
                  loops                 = <lines>
                  ok_code               = p_ok
                  overlapping           = 'X'
             IMPORTING
                  entry_new             = l_tc_new_top_line
             EXCEPTIONS
    *              NO_ENTRY_OR_PAGE_ACT  = 01
    *              NO_ENTRY_TO           = 02
    *              NO_OK_CODE_OR_PAGE_GO = 03
                  OTHERS                = 0.
      ENDIF.
    *&SPWIZARD: get actual tc and column                                   *
      GET CURSOR FIELD l_tc_field_name
                 AREA  l_tc_name.
      IF syst-subrc = 0.
        IF l_tc_name = p_tc_name.
    *&SPWIZARD: et actual column                                           *
          SET CURSOR FIELD l_tc_field_name LINE 1.
        ENDIF.
      ENDIF.
    *&SPWIZARD: set the new top line                                       *
      <tc>-top_line = l_tc_new_top_line.
    ENDFORM.                              " COMPUTE_SCROLLING_IN_TC
    *&      Form  FCODE_TC_MARK_LINES
    *       marks all TableControl lines
    *      -->P_TC_NAME  name of tablecontrol
    FORM fcode_tc_mark_lines USING p_tc_name
                                   p_table_name
                                   p_mark_name.
    *&SPWIZARD: EGIN OF LOCAL DATA-----------------------------------------*
      DATA l_table_name       LIKE feld-name.
      FIELD-SYMBOLS <tc>         TYPE cxtab_control.
      FIELD-SYMBOLS <table>      TYPE STANDARD TABLE.
      FIELD-SYMBOLS <wa>.
      FIELD-SYMBOLS <mark_field>.
    *&SPWIZARD: END OF LOCAL DATA------------------------------------------*
      ASSIGN (p_tc_name) TO <tc>.
    *&SPWIZARD: get the table, which belongs to the tc                     *
      CONCATENATE p_table_name '[]' INTO l_table_name. "table body
      ASSIGN (l_table_name) TO <table>.                "not headerline
    *&SPWIZARD: mark all filled lines                                      *
      LOOP AT <table> ASSIGNING <wa>.
    *&SPWIZARD: access to the component 'FLAG' of the table header         *
        ASSIGN COMPONENT p_mark_name OF STRUCTURE <wa> TO <mark_field>.
        <mark_field> = 'X'.
      ENDLOOP.
    ENDFORM.                                          "fcode_tc_mark_lines
    *&      Form  FCODE_TC_DEMARK_LINES
    *       demarks all TableControl lines
    *      -->P_TC_NAME  name of tablecontrol
    FORM fcode_tc_demark_lines USING p_tc_name
                                     p_table_name
                                     p_mark_name .
    *&SPWIZARD: BEGIN OF LOCAL DATA----------------------------------------*
      DATA l_table_name       LIKE feld-name.
      FIELD-SYMBOLS <tc>         TYPE cxtab_control.
      FIELD-SYMBOLS <table>      TYPE STANDARD TABLE.
      FIELD-SYMBOLS <wa>.
      FIELD-SYMBOLS <mark_field>.
    *&SPWIZARD: END OF LOCAL DATA------------------------------------------*
      ASSIGN (p_tc_name) TO <tc>.
    *&SPWIZARD: get the table, which belongs to the tc                     *
      CONCATENATE p_table_name '[]' INTO l_table_name. "table body
      ASSIGN (l_table_name) TO <table>.                "not headerline
    *&SPWIZARD: demark all filled lines                                    *
      LOOP AT <table> ASSIGNING <wa>.
    *&SPWIZARD: access to the component 'FLAG' of the table header         *
        ASSIGN COMPONENT p_mark_name OF STRUCTURE <wa> TO <mark_field>.
        <mark_field> = space.
      ENDLOOP.
    ENDFORM.                                          "fcode_tc_mark_lines
    *&      Module  STATUS_9000  OUTPUT
    *       text
    MODULE status_9000 OUTPUT.
      SET PF-STATUS 'S9000'.
      SET TITLEBAR 'T9000'.
    ENDMODULE.                 " STATUS_9000  OUTPUT
    *&      Module  USER_COMMAND_9000  INPUT
    *       text
    MODULE user_command_9000 INPUT.
      CASE sy-ucomm.
        WHEN 'BACK' OR 'EXIT' OR 'CANCEL'.
          LEAVE TO SCREEN 0.
        WHEN 'DISP'.
          SELECT vbeln netwr kunnr INTO CORRESPONDING FIELDS OF TABLE lt_vbak
          FROM vbak
          WHERE kunnr = sfkunnr.
    *    LEAVE TO LIST-PROCESSING [AND RETURN TO SCREEN <nnnn>].
    *    By default, the dialog processor returns to the PBO processing of
    *    the screen from which the list processor was called. The optional
    *    addition AND RETURN TO SCREEN allows you to specify a different
    *    screen in the current screen sequence at whose PBO event you want
    *    to resume processing.
        when 'LIST'.
        LEAVE TO LIST-PROCESSING.
        WRITE:/ 'Time  :', SY-UZEIT.
        LOOP AT LT_VBAK.
        WRITE:/ LT_VBAK-VBELN,
                LT_VBAK-NETWR,
                LT_VBAK-KUNNR.
        ENDLOOP.
        WHEN 'SUBM'.
    *& You can call executable programs from other ABAP programs using the
    *& following statement:
    *& SUBMIT <rep>|(<field>) [AND RETURN] [<options>].
          SUBMIT z_submit_report VIA SELECTION-SCREEN AND RETURN.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_9000  INPUT
                                                     TABLE CONTROL WIZARD SE51 CODE
    PROCESS BEFORE OUTPUT.
    *&spwizard: pbo flow logic for tablecontrol 'TCONTROL'
      module TCONTROL_change_tc_attr.
    *&spwizard: module TCONTROL_change_col_attr.
      loop at   LT_VBAK
           with control TCONTROL
           cursor TCONTROL-current_line.
        module TCONTROL_get_lines.
    *&spwizard:   module TCONTROL_change_field_attr
      endloop.
    MODULE STATUS_9000.
    PROCESS AFTER INPUT.
    *&spwizard: pai flow logic for tablecontrol 'TCONTROL'
      loop at LT_VBAK.
        chain.
          field LT_VBAK-VBELN.
          field LT_VBAK-NETWR.
          field LT_VBAK-KUNNR.
          module TCONTROL_modify on chain-request.
        endchain.
        field LT_VBAK-FLAG
          module TCONTROL_mark on request.
      endloop.
      module TCONTROL_user_command.
    *&spwizard: module TCONTROL_change_tc_attr.
    *&spwizard: module TCONTROL_change_col_attr.
    MODULE USER_COMMAND_9000.
    regards
    padma

  • How to use table control in module pool programming

    Hi
    I want to use a table control to fetch some data from mara table.
    Please guide me with the procedure and the steps which I can follow to complete my program correctly.
    thanks
    Lalit Gupta

    As [vinraaj|http://forums.sdn.sap.com/profile.jspa?userID=3968041] wrote, call transaction SE51, there is a Wizard to help you generate the table control, it will create the table control and some includes with PBO/PAI modules > Read [Using the Table Control Wizard|http://help.sap.com/saphelp_bw/helpdata/en/6d/150d67da1011d3963800a0c94260a5/frameset.htm]
    Also there is a tutorial in the wiki, read [Learn Making First Table Control |http://wiki.sdn.sap.com/wiki/display/ABAP/LearnMakingFirstTableControl] by [Krishna Chauhan|http://wiki.sdn.sap.com/wiki/display/~nc0euof]
    Regards,
    Raymond

  • How to create a table control from a program internal table

    Hi all,
    I try to create a table control that matches following requirements :
    - the source table is an internal table from program (not a dictionary table)
    - I need to specify my own column header titles
    - the fields need to be editable
    - some of the columns fields must be displayed as checkboxes, other one as texts
    When I try using "Table Control WIth Wizard", the generated TabControl has the expected columns titles but the fields are not displayed as checkboxes. Moreoever, when I look at "Dictionnary, program Fields list", the table fields choosed using wizard are locked (a padlock is displayed in front of the line) So, I can not check "checkbox display"
    When I try using simple Table Control -I mean without ALV-, I can use the "checkbox display" for wanted fields but I don't know how to specify the resquired columns headers titles
    So, could you please help me ? How to do both : maage columsn header titles and display some of the columns as checkboxes ?
    thanks for help
    Regards
    morgan

    Hi Morgan,
    Create an Interanal Table in Top Include and activate it first. Then go the Screen Layout and Drag and Drop a Table control.
    Enter a name like TC. now press F6 (Dictionary/Program Fields Window). Enter the Interanal Table and Press
    Get From  Program Push button. Select the required Columns and transfer them. Double click on the Table Control Area only (any corner of the TC) now you get attribute window POP UP. now select the check box for with column Header or remove the available column header and place your own Text Field and  give meaningful Text for them. With in the Table control you can Drag and Drop a Check Box which will occupy all the rows. Make sure you include one more column in the TOP include type C with length one.
    Hope this is very Clear to YOU.
    Cheers
    Ram

Maybe you are looking for

  • Printing from a DOS application to Adobe PDF Printer

    I have been asked to provide reports from a legacy DOS application to PDF and of course decided to use my Adobe PDF Printer that came with the copy of Adobe Acrobat 8 Standard I purchased. I am running Windows XP. I am able to overcome the obvious pr

  • Phone will NOT sync calendar

    I just bought this very expensive phone that I have spent the last 2 days trying to get to do the simplest task. I should have kept using my reliable Palm PDA. My I-Phone will not sync from my calendar to my phone. I have read every discussion on her

  • Max Number of Colums in a table..

    Hi All, I Am using Oracle 9i version.. May i Know Maximum Number of Columns in a table. ? Is there any possibilty to extend that? Advanced Thanking...

  • Group data locked error for MM01 using parallel processing

    Hello gurus,                    I am using Call txn method (MM01) Parallel Processing method ( around 9 threads ). The Materials are getting locked around 10 percent sometimes. This is happening randomly ..one day i dont have any locking errors ..nex

  • MacBook Pro Retina Black Screens and Becomes Unresponsive

    I've been having issues with my laptop where all of a sudden it would black screen and become unresponsive. Checking the console messages I see a lot of records referring to "AppleVTD: waiting space". This seems to be a reoccuring problem. I've alrea