Custom Table updation thru table control

Hi All,
My requirement is to update the custom table by creating a custom screen with table control,say my z table has 2 fields name1 and bukrs.
if i enter the value in table control then i click the save icon these fields should get updated in the z table .can any one send me the piece of code for this,since i have not worked on table control i need it in detail.
Useful answers will be rewarded....
Thanks in Advance.....

PROGRAM  ZSD_REBATE_MASTER MESSAGE-ID FV
         NO STANDARD PAGE HEADING.
TABLES: KONA,
        ZSD_BILLINFO,
        ZSD_RBT_ELG_INV,
        KNVV.
DATA: OK_CODE LIKE SY-UCOMM,
      L_CODE LIKE SY-UCOMM.
DATA : BEGIN OF I_KNVV_DATA OCCURS 0,
       GJAHR LIKE ZSD_RBT_MAS_DATA-GJAHR,
       KNUMA LIKE ZSD_RBT_MAS_DATA-KNUMA,
       VKBUR LIKE ZSD_RBT_MAS_DATA-VKBUR,
       VKORG LIKE ZSD_RBT_MAS_DATA-VKORG,
       VTWEG LIKE ZSD_RBT_MAS_DATA-VTWEG,
       SPART LIKE ZSD_RBT_MAS_DATA-SPART,
       OTQTY LIKE ZSD_RBT_MAS_DATA-OTQTY,
       PCPDAYS LIKE ZSD_RBT_MAS_DATA-PCPDAYS,
       OTPC LIKE ZSD_RBT_MAS_DATA-OTPC,
       MATKL LIKE ZSD_RBT_MAS_DATA-MATKL,
      EBDFROM LIKE ZSD_RBT_MAS_DATA-EBDFROM,
      EBDTO LIKE ZSD_RBT_MAS_DATA-EBDTO,
       STATUS LIKE ZSD_RBT_MAS_DATA-STATUS,
     END OF I_KNVV_DATA.
DATA : G_ANS(1), GR1, FLAG(1),LS(1).
*&      Module  STATUS_1500  OUTPUT
      text
MODULE STATUS_1500 OUTPUT.
  SET PF-STATUS '1500'.
  SET TITLEBAR 'HEADING_1500'.
ENDMODULE.                 " STATUS_1500  OUTPUT
*&      Module  USER_COMMAND_1500  INPUT
      text
MODULE USER_COMMAND_1500 INPUT.
  OK_CODE = SY-UCOMM.
  L_CODE = OK_CODE.
  IF L_CODE = 'EXIT'.
    LEAVE PROGRAM.
  ELSEIF L_CODE = 'OK'.
    PERFORM ERROR_MESSGE.
    IF FLAG <> '1'.
      SELECT SINGLE * FROM ZSD_RBT_ELG_INV WHERE KNUMA = KONA-KNUMA.
      IF SY-SUBRC = 0.
        UPDATE ZSD_RBT_MAS_DATA SET STATUS = 'C'
                       WHERE KNUMA = KONA-KNUMA.
        COMMIT WORK.
      ENDIF.
      CALL SCREEN 1600.
    ENDIF.
  ENDIF.
ENDMODULE.                 " USER_COMMAND_1500  INPUT
*&      Module  MOD_CHECK_INPUT  INPUT
      text
MODULE MOD_CHECK_INPUT INPUT.
  SELECT SINGLE * FROM KONA WHERE KNUMA = KONA-KNUMA.
  IF SY-SUBRC <> 0.
    MESSAGE E999 WITH 'Agreement No. ' KONA-KNUMA 'does not exists'.
  ENDIF.
ENDMODULE.                 " MOD_CHECK_INPUT  INPUT
*&      Module  EXIT  INPUT
      text
MODULE EXIT INPUT.
  OK_CODE = SY-UCOMM.
  L_CODE = OK_CODE.
  CLEAR OK_CODE.
  IF L_CODE = 'EXIT'.
    LEAVE PROGRAM.
  ENDIF.
ENDMODULE.                 " EXIT  INPUT
***&SPWIZARD: DATA DECLARATION FOR TABLECONTROL 'GRID_MAST'
*&SPWIZARD: DEFINITION OF DDIC-TABLE
TABLES:   ZSD_RBT_MAS_DATA.
*&SPWIZARD: TYPE FOR THE DATA OF TABLECONTROL 'GRID_MAST'
TYPES: BEGIN OF T_GRID_MAST,
         GJAHR LIKE ZSD_RBT_MAS_DATA-GJAHR,
         KNUMA LIKE ZSD_RBT_MAS_DATA-KNUMA,
         VKBUR LIKE ZSD_RBT_MAS_DATA-VKBUR,
         VKORG LIKE ZSD_RBT_MAS_DATA-VKORG,
         VTWEG LIKE ZSD_RBT_MAS_DATA-VTWEG,
         SPART LIKE ZSD_RBT_MAS_DATA-SPART,
         OTQTY LIKE ZSD_RBT_MAS_DATA-OTQTY,
         PCPDAYS LIKE ZSD_RBT_MAS_DATA-PCPDAYS,
         OTPC LIKE ZSD_RBT_MAS_DATA-OTPC,
         MATKL LIKE ZSD_RBT_MAS_DATA-MATKL,
        EBDFROM LIKE ZSD_RBT_MAS_DATA-EBDFROM,
        EBDTO LIKE ZSD_RBT_MAS_DATA-EBDTO,
         STATUS LIKE ZSD_RBT_MAS_DATA-STATUS,
       END OF T_GRID_MAST.
*&SPWIZARD: INTERNAL TABLE FOR TABLECONTROL 'GRID_MAST'
DATA:     G_GRID_MAST_ITAB   TYPE T_GRID_MAST OCCURS 0 WITH HEADER LINE,
          G_GRID_MAST_WA     TYPE T_GRID_MAST. "work area
DATA:     G_GRID_MAST_COPIED.           "copy flag
*&SPWIZARD: DECLARATION OF TABLECONTROL 'GRID_MAST' ITSELF
CONTROLS: GRID_MAST TYPE TABLEVIEW USING SCREEN 1600.
*&SPWIZARD: LINES OF TABLECONTROL 'GRID_MAST'
DATA:     G_GRID_MAST_LINES  LIKE SY-LOOPC.
DATA: L_LINE LIKE GRID_MAST-CURRENT_LINE.
*&SPWIZARD: OUTPUT MODULE FOR TC 'GRID_MAST'. DO NOT CHANGE THIS LINE!
*&SPWIZARD: COPY DDIC-TABLE TO ITAB
**&      Module  GRID_INACT  OUTPUT
      text
MODULE GRID_MAST_INIT OUTPUT.
  DATA: L_FLAG(1).
  IF G_GRID_MAST_COPIED IS INITIAL.
*&SPWIZARD: COPY DDIC-TABLE 'ZSD_RBT_MAS_DATA'
*&SPWIZARD: INTO INTERNAL TABLE 'g_GRID_MAST_itab'
    PERFORM GET_DATA.
    LOOP AT I_KNVV_DATA.
      G_GRID_MAST_ITAB-GJAHR = I_KNVV_DATA-GJAHR.
      G_GRID_MAST_ITAB-KNUMA = I_KNVV_DATA-KNUMA.
      G_GRID_MAST_ITAB-VKBUR = I_KNVV_DATA-VKBUR.
      G_GRID_MAST_ITAB-VKORG = I_KNVV_DATA-VKORG.
      G_GRID_MAST_ITAB-VTWEG = I_KNVV_DATA-VTWEG.
      G_GRID_MAST_ITAB-SPART = I_KNVV_DATA-SPART.
      G_GRID_MAST_ITAB-OTQTY = I_KNVV_DATA-OTQTY.
      G_GRID_MAST_ITAB-PCPDAYS = I_KNVV_DATA-PCPDAYS.
      G_GRID_MAST_ITAB-OTPC = I_KNVV_DATA-OTPC.
      G_GRID_MAST_ITAB-MATKL = I_KNVV_DATA-MATKL.
     G_GRID_MAST_ITAB-EBDFROM = I_KNVV_DATA-EBDFROM.
     G_GRID_MAST_ITAB-EBDTO = I_KNVV_DATA-EBDTO.
      G_GRID_MAST_ITAB-STATUS = I_KNVV_DATA-STATUS.
     G_GRID_MAST_ITAB-OTPC = I_KNVV_DATA-OTPC.
      APPEND G_GRID_MAST_ITAB.
    ENDLOOP.
    L_FLAG = 'X'.
    G_GRID_MAST_COPIED = 'X'.
    REFRESH CONTROL 'GRID_MAST' FROM SCREEN '1600'.
  ENDIF.
  IF L_FLAG IS INITIAL.
    L_LINE = GRID_MAST-CURRENT_LINE.
    IF NOT G_GRID_MAST_WA IS INITIAL.
     READ TABLE G_GRID_MAST_ITAB INDEX GRID_MAST-CURRENT_LINE.
     IF SY-SUBRC <> 0.
      MOVE-CORRESPONDING G_GRID_MAST_WA TO G_GRID_MAST_ITAB.
      APPEND G_GRID_MAST_ITAB.
      REFRESH CONTROL 'GRID_MAST' FROM SCREEN '1600'.
     CLEAR G_GRID_MAST_WA.
     ENDIF.
    ENDIF.
  ELSE.
    CLEAR L_FLAG.
  ENDIF.
ENDMODULE.                    "GRID_MAST_INIT OUTPUT
*&SPWIZARD: OUTPUT MODULE FOR TC 'GRID_MAST'. DO NOT CHANGE THIS LINE!
*&SPWIZARD: MOVE ITAB TO DYNPRO
MODULE GRID_MAST_MOVE OUTPUT.
  IF NOT G_GRID_MAST_WA IS INITIAL.
    MOVE-CORRESPONDING G_GRID_MAST_WA TO ZSD_RBT_MAS_DATA.
    CLEAR G_GRID_MAST_WA.
  ENDIF.
  GRID_MAST-LINES = G_GRID_MAST_LINES + 100.
ENDMODULE.                    "GRID_MAST_MOVE OUTPUT
**&SPWIZARD: OUTPUT MODULE FOR TC 'GRID_MAST'. DO NOT CHANGE THIS LINE!
**&SPWIZARD: GET LINES OF TABLECONTROL
MODULE GRID_MAST_GET_LINES OUTPUT.
  SELECT SINGLE * FROM ZSD_RBT_ELG_INV WHERE KNUMA = KONA-KNUMA.
  IF SY-SUBRC = 0.
    UPDATE ZSD_RBT_MAS_DATA SET STATUS = 'C'
                   WHERE KNUMA = KONA-KNUMA.
    COMMIT WORK.
    IF ZSD_RBT_ELG_INV-ZFLAG = 'C'.
      LOOP AT SCREEN.
        IF SCREEN-GROUP1 = 'GR1'.
          SCREEN-INPUT = '0'.
        ENDIF.
        MODIFY SCREEN.
      ENDLOOP.
    ENDIF.
  ENDIF.
  G_GRID_MAST_LINES = SY-LOOPC.
ENDMODULE.                    "GRID_MAST_GET_LINES OUTPUT
*&SPWIZARD: INPUT MODULE FOR TC 'GRID_MAST'. DO NOT CHANGE THIS LINE!
*&SPWIZARD: MODIFY TABLE
MODULE GRID_MAST_MODIFY INPUT.
  MOVE-CORRESPONDING ZSD_RBT_MAS_DATA TO G_GRID_MAST_WA.
  IF L_FLAG IS INITIAL.
    L_LINE = GRID_MAST-CURRENT_LINE.
    IF NOT G_GRID_MAST_WA IS INITIAL.
    IF L_LINE = GRID_MAST-CURRENT_LINE.
     READ TABLE G_GRID_MAST_ITAB INDEX GRID_MAST-CURRENT_LINE.
     IF SY-SUBRC = 0.
      MODIFY G_GRID_MAST_ITAB    FROM G_GRID_MAST_WA
    INDEX GRID_MAST-CURRENT_LINE.
    ELSE.
      MOVE-CORRESPONDING G_GRID_MAST_WA TO G_GRID_MAST_ITAB.
      APPEND G_GRID_MAST_ITAB.
      REFRESH CONTROL 'GRID_MAST' FROM SCREEN '1600'.
    ENDIF.
    ELSE.
      MOVE-CORRESPONDING G_GRID_MAST_WA TO G_GRID_MAST_ITAB.
      APPEND G_GRID_MAST_ITAB.
      REFRESH CONTROL 'GRID_MAST' FROM SCREEN '1600'.
     CLEAR G_GRID_MAST_WA.
     ENDIF.
    ENDIF.
  ELSE.
    CLEAR L_FLAG.
  ENDIF.
MODIFY G_GRID_MAST_ITAB
   FROM G_GRID_MAST_WA
   INDEX GRID_MAST-CURRENT_LINE.
ENDMODULE.                    "GRID_MAST_MODIFY INPUT
*&SPWIZARD: INPUT MODULE FOR TC 'GRID_MAST'. DO NOT CHANGE THIS LINE!
*&SPWIZARD: PROCESS USER COMMAND
MODULE GRID_MAST_USER_COMMAND INPUT.
  OK_CODE = SY-UCOMM.
  PERFORM USER_OK_TC USING    'SY-UCOMM'
                              'G_GRID_MAST_ITAB'
                              'FLAG'
                     CHANGING OK_CODE.
  SY-UCOMM = OK_CODE.
ENDMODULE.                    "GRID_MAST_USER_COMMAND INPUT
*&      Module  STATUS_1600  OUTPUT
      text
MODULE STATUS_1600 OUTPUT.
  SET PF-STATUS 'STATUS_1600'.
  SET TITLEBAR 'HEADING_1600'.
ENDMODULE.                 " STATUS_1600  OUTPUT
*&      Module  USER_COMMAND_1600  INPUT
      text
MODULE USER_COMMAND_1600 INPUT.
  CASE SY-UCOMM.
    WHEN 'CAN'.
      CLEAR: G_GRID_MAST_COPIED, G_GRID_MAST_ITAB.
      LEAVE TO SCREEN '1500'.
    WHEN 'BACK'.
      CLEAR: G_GRID_MAST_COPIED, G_GRID_MAST_ITAB.
      LEAVE TO SCREEN '1500'.
    WHEN 'EXIT'.
      LEAVE TO SCREEN '1500'.
    WHEN 'SAVE'.
    DELETE FROM ZSD_RBT_MAS_DATA WHERE KNUMA EQ KONA-KNUMA.
      PERFORM SAVE_DATA.
   WHEN 'DELE'.
  ENDCASE.
ENDMODULE.                 " USER_COMMAND_1600  INPUT
*&      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
FORM GET_DATA...
FORM GET_DATA.
  CLEAR : I_KNVV_DATA, ZSD_BILLINFO, G_GRID_MAST_COPIED,
  G_GRID_MAST_ITAB, ZSD_RBT_MAS_DATA, KNVV, ZSD_RBT_ELG_INV.
  REFRESH: I_KNVV_DATA, G_GRID_MAST_ITAB.
  SELECT SINGLE * FROM KONA WHERE KNUMA = KONA-KNUMA.
  IF SY-SUBRC = 0.
    SELECT * FROM ZSD_RBT_MAS_DATA
           INTO
           CORRESPONDING FIELDS OF
           TABLE I_KNVV_DATA
           WHERE KNUMA = KONA-KNUMA.
    IF SY-SUBRC <> 0.
      SELECT * INTO CORRESPONDING FIELDS OF TABLE I_KNVV_DATA
      FROM KNVV
      WHERE KUNNR = KONA-BONEM.
      SELECT SINGLE * FROM ZSD_BILLINFO WHERE KUNAG = KONA-BONEM.
      LOOP AT I_KNVV_DATA.
        SELECT SINGLE * FROM ZSD_RBT_ELG_INV
            WHERE KNUMA = KONA-KNUMA
              AND VKORG = I_KNVV_DATA-VKORG
              AND VTWEG = I_KNVV_DATA-VTWEG
              AND SPART = I_KNVV_DATA-SPART.
        IF SY-SUBRC = 0.
          I_KNVV_DATA-STATUS = ZSD_RBT_ELG_INV-ZFLAG.
        ENDIF.
        I_KNVV_DATA-GJAHR = ZSD_BILLINFO-GJAHR.
        I_KNVV_DATA-KNUMA = KONA-KNUMA.
        MODIFY I_KNVV_DATA INDEX SY-TABIX.
      ENDLOOP.
    ENDIF.
  ENDIF.
ENDFORM.                    "GET_DATA
FORM SAVE_DATA...
FORM SAVE_DATA.
  IF NOT G_GRID_MAST_ITAB IS INITIAL.
    CALL FUNCTION 'POPUP_TO_CONFIRM'
       EXPORTING
        TITLEBAR                    = 'Confirmation'
  DIAGNOSE_OBJECT             = ' '
   TEXT_QUESTION               = 'Do you want to save the document?'
        TEXT_BUTTON_1               = 'YES'
  ICON_BUTTON_1               = ' '
        TEXT_BUTTON_2               = 'NO'
  ICON_BUTTON_2               = ' '
         DEFAULT_BUTTON              = '1'
         DISPLAY_CANCEL_BUTTON       = ''
  USERDEFINED_F1_HELP         = ' '
  START_COLUMN                = 25
  START_ROW                   = 6
  POPUP_TYPE                  =
  IV_QUICKINFO_BUTTON_1       = ' '
  IV_QUICKINFO_BUTTON_2       = ' '
      IMPORTING
        ANSWER                      = G_ANS
TABLES
  PARAMETER                   =
      EXCEPTIONS
        TEXT_NOT_FOUND              = 1
        OTHERS                      = 2
    IF SY-SUBRC <> 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    IF G_ANS = '1'.
      SELECT SINGLE * FROM ZSD_RBT_MAS_DATA
          WHERE KNUMA = KONA-KNUMA.
      IF SY-SUBRC = 0.
        LOOP AT G_GRID_MAST_ITAB.
         IF G_GRID_MAST_ITAB-OTQTY > 0.
              I_KNVV_DATA-PCPDAYS
              I_KNVV_DATA-OTPC
              I_KNVV_DATA-EBDFROM
              I_KNVV_DATA-EBDTO
          ZSD_RBT_MAS_DATA-GJAHR = G_GRID_MAST_ITAB-GJAHR.
          ZSD_RBT_MAS_DATA-KNUMA = G_GRID_MAST_ITAB-KNUMA.
          ZSD_RBT_MAS_DATA-VKBUR = G_GRID_MAST_ITAB-VKBUR.
          ZSD_RBT_MAS_DATA-VKORG = G_GRID_MAST_ITAB-VKORG.
          ZSD_RBT_MAS_DATA-VTWEG = G_GRID_MAST_ITAB-VTWEG.
          ZSD_RBT_MAS_DATA-SPART = G_GRID_MAST_ITAB-SPART.
          ZSD_RBT_MAS_DATA-MATKL = G_GRID_MAST_ITAB-MATKL.
          ZSD_RBT_MAS_DATA-OTQTY = G_GRID_MAST_ITAB-OTQTY.
          ZSD_RBT_MAS_DATA-PCPDAYS = G_GRID_MAST_ITAB-PCPDAYS.
          ZSD_RBT_MAS_DATA-OTPC = G_GRID_MAST_ITAB-OTPC.
         ZSD_RBT_MAS_DATA-EBDFROM = G_GRID_MAST_ITAB-EBDFROM.
         ZSD_RBT_MAS_DATA-EBDTO = G_GRID_MAST_ITAB-EBDTO.
          MODIFY ZSD_RBT_MAS_DATA.
          COMMIT WORK.
         ENDIF.
        ENDLOOP.
      ELSE.
        LOOP AT G_GRID_MAST_ITAB.
         IF G_GRID_MAST_ITAB-OTQTY > 0.
              I_KNVV_DATA-PCPDAYS
              I_KNVV_DATA-OTPC
              I_KNVV_DATA-EBDFROM
              I_KNVV_DATA-EBDTO
          ZSD_RBT_MAS_DATA-GJAHR = G_GRID_MAST_ITAB-GJAHR.
          ZSD_RBT_MAS_DATA-KNUMA = G_GRID_MAST_ITAB-KNUMA.
          ZSD_RBT_MAS_DATA-VKBUR = G_GRID_MAST_ITAB-VKBUR.
          ZSD_RBT_MAS_DATA-VKORG = G_GRID_MAST_ITAB-VKORG.
          ZSD_RBT_MAS_DATA-VTWEG = G_GRID_MAST_ITAB-VTWEG.
          ZSD_RBT_MAS_DATA-SPART = G_GRID_MAST_ITAB-SPART.
          ZSD_RBT_MAS_DATA-OTQTY = G_GRID_MAST_ITAB-OTQTY.
          ZSD_RBT_MAS_DATA-PCPDAYS = G_GRID_MAST_ITAB-PCPDAYS.
          ZSD_RBT_MAS_DATA-OTPC = G_GRID_MAST_ITAB-OTPC.
         ZSD_RBT_MAS_DATA-EBDFROM = G_GRID_MAST_ITAB-EBDFROM.
         ZSD_RBT_MAS_DATA-EBDTO = G_GRID_MAST_ITAB-EBDTO.
          ZSD_RBT_MAS_DATA-STATUS = G_GRID_MAST_ITAB-STATUS.
          ZSD_RBT_MAS_DATA-MATKL = G_GRID_MAST_ITAB-MATKL.
          INSERT ZSD_RBT_MAS_DATA.
          COMMIT WORK.
         ENDIF.
        ENDLOOP.
      ENDIF.
    ENDIF.
  ENDIF.
ENDFORM.                    "SAVE_DATA
ENDMODULE.                 " GRID_CHECK  OUTPUT

Similar Messages

  • Custom Table Control in VA21/22/23 Tranaction Issue

    Hi Friends,
    Working on SAP R/3 Release 4.6C.
    There is a custom Table Control in one of the screen of VA21 Transaction.
    My requirement is to insert one more Field/Column to this table Control.
    The following are the sequence of fields in Table Control.
    Column1
    Column2
    Column3
    Column4
    After Inserting the Field in the middle of Column1 and Column2.
    The Sequence of Table Control is getting Changed.
    The Table Control has to show like this.
    Column1
    Column2     "New Field which is added
    Column3
    Column4
    Column5
    But I'm getting as below
    Column5
    Column3
    Column2     "New Field which is added
    Column1
    Column4
    When executing the Table Control Screen in SE51 with Screen Name and Screen Number,I am getting the perfect output.
    When executing thro VA21/22/23, Iam getting sequence mismatch.
    Anyone come across this scenario. Please guide to solve this.
    Thanks.

    Solved.
    Thanks.

  • Could you please send me the links to get an idea on Custom table controls

    Hi Friends,
               I am working on custom table controls, Could you please send me any links on Custom table controls or documentation.
       Thanks and Regards,
       Sandeep Kumar Bonam

    Hello Sandeep,
    See here for the latest table features in 2004s.
    <a href="/people/bertram.ganz/blog/2006/07/03/web-dynpro-java-foundation--whats-new-in-sap-netweaver-2004s:///people/bertram.ganz/blog/2006/07/03/web-dynpro-java-foundation--whats-new-in-sap-netweaver-2004s
    This link also has a lot information on tables
    <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/d43bb0e5-0601-0010-3a97-d9760726bf4c">https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/d43bb0e5-0601-0010-3a97-d9760726bf4c</a>
    Regards,
    Sudeep.

  • Populating item number in table control

    I have created a custom table control. It is very similar to the VA01 or Vl01N table controls to add items. When the user enters the material name, the item number column needs to be populated.
    Currently I have something like this
    LOOP at i_items.
    MODULE tblcntrl_modify INPUT.
    ENDLOOP
    MODULE tblcntrl_modify INPUT. "PAI
       posnr = sy-stepl * 10.
       more logic for input validation.
    ENDMODULE
    The issue I have is that when I scroll in the table control, the posnr for each item gets recalculated and they get whacked .. so I get a scenario like this
    10 mat1
    20 mat2
    30 mat3
    10 mat4
    40 mat5
    what is the best way to populate the item number. Thank you

    hi,
    u have to make one module in PAI brtn  <b>LOOP-ENDLOOP, CHAIN-ENDCHAIN</b>
    LOOP AT itab_det.
        CHAIN.
         FIELD itab_det-comp_code.
          FIELD itab_det-bill_no.
          FIELD itab_det-bill_date.
          FIELD itab_det-vend_cust_code.
          FIELD itab_det-bill_amt.
          MODULE <b>tab1_modify</b> ON CHAIN-REQUEST.
        ENDCHAIN.
        FIELD itab_det-mark
          MODULE tab1_mark ON REQUEST.
      ENDLOOP.
    <b>MODULE tab1_modify INPUT.</b>
      IF itab_det-bill_no <> ' ' .
        CLEAR:net_pr,tax,bil_amt,bil_dt.
        SELECT SINGLE fkdat netwr mwsbk FROM vbrk INTO (bil_dt,net_pr,tax)
        WHERE vbeln = itab_det-bill_no .
        bil_amt = net_pr + tax.
        itab_det-bill_date = bil_dt.
        itab_det-bill_amt = bil_amt.
      ENDIF.
      MODIFY itab_det
        FROM itab_det
        INDEX tab1-current_line.
      APPEND itab_det.
    <b>ENDMODULE.                    "TAB1_MODIFY INPUT</b>
    here i am fetching Bill Amount and Bill Date according to Entered Bill Number in Table control.
    So i am checking bill number here in If condition and when i press enter that two value automatically populated...
    reward if useful.....

  • BDC_OK code for scrolling in custon table control

    Hi All,
    I have a requirement to create a BDC program for transaction ME31K, but the problem is this ME31K transaction is enhanced adding a custom screen which has three custom table controls. Now this screen is also included in the BDC program.
    I am facing problem in tracking the BDC_OKcode for scrolling for these custom table controls. Tried with '=P+' but not working.
    While recording it is capturing '/00' for scrolling but while executing through program it is not working.
    If anybody has faced this situation before please suggest how to go about it.
    Please note '=NP'  is not avaiable as it is a custom screen.
    Thanks in advance.

    go on the screen where you have table control, put /h in command field.
    now scroll in table control, this will go in debugger and now check sy-ucomm.
    hope you get it.

  • Table control:screen painter(Module Pool)

    hi !
    Table name :ZDR_MOD.
    Internal table:ITAB.
      I am doing Custom table control in screen painter.I have done desgin in screen painter,I am not writing any doing in PAI abd PBO. while compiling it showing error like,
    "The field "ITAB-MANDT" is not assigned to a loop."LOOP ... ENDLOOP" must appear in PBO and PAI""
    Report coding:
    EPORT  ZDR_PGM_TMP.
    tables:zdr_mod.
    CONTROLS tc TYPE TABLEVIEW USING SCREEN 100.
    data:itab TYPE STANDARD TABLE OF zdr_mod with HEADER LINE.
    DATA : flg, "Flag to set the change mode
    ln TYPE i. "No. of records
    select * from zdr_mod into CORRESPONDING FIELDS OF TABLE ITAB.
    call SCREEN 100.
    INCLUDE ZDR_PGM_TMP_STATUS_0100O01.
    INCLUDE ZDR_PGM_TMP_USER_COMMAND_01I01.
    thank in advance
    Dharma

    Hi,
    When a table control is added onto the Screen Painter, it is mandatory that the fields that you have added on from the dictionary be present in your program and is used within a loop...endloop.
    PROCESS BEFORE OUTPUT.
    MODULE STATUS_0100.
       LOOP AT T_ITAB INTO WA_ITAB WITH CONTROL TABCONTROL1.
         MODULE PURCHASEITEM_DETAILS.
       ENDLOOP.
    PROCESS AFTER INPUT.
    LOOP AT T_ITAB.
         MODULE USER_COMMAND_0100.
    ENDLOOP.
    The internal table that you declare will have the same structure as that your table control. So it always loops with respect to the table control.

  • Updating custom table through table control in module pool

    Hi
    I am entering a data in the module pool screen in a table control . The functionality is that whatever i enter in a row gets updated in a custom table in the database with the same values . My problem is that when i enter some values and press the save button on the module pool screen , the data gets updated on the table but gets invisible from the module pool screen . The user wants the data to be displayed even after it has been saved ..if anyone can help on this ...
    thanks

    hi,
    Check whether u have activated the report and screen.

  • Custom fields in migo table control not updating

    hi ,
    This is to have your valuable suggestion , wrt , following issue..
    In transaction MIGO , i have to add two fields uebto and untto in table control .
    I am able to add them in table control, but some how not able to pick data for these fields .
    error coming is :
    " System error: Incorrect Customizing for field
    ZZUEBTO".
    if any face such type of issue , answer me .
    Thanx,
    jeet

    Hi,
    Thanks for your reply.  I have added the custom fields in the item detail.  But the customer wants the custom fields in the table view also.
    Is there any screen exit available to modify the table control of MIGO?
    Thanks.

  • How to find out the volume of the data updated in the custom table

    Hi,
    I need to find out the the volume of the data inserted or updated in the the custom table(Y tables).I have tried by the sm37.the job running in to update the table but i didnot get thde amount of the data.and if get the volume of the data which being updated in the custom table is there any option to control that amount to being updated?
    Thanks in advance .....waiting for the respone.

    Hi Sreenivas.
    How did you find the solution to this? Trying to do the same thing!
    Cheers,
    Tom

  • How to update and retrieve the table control entries and field entries.

    Hello everyone,
    i have a requirement,
    i have    company code , plant, fiscal year, posting period  fields in the selection screen and then below that i have a  table control which contains 4 fields  invoice no., check number, check date and amount.
    i have to enter the values and when i press  SAVE button , these values have to update in a custom table which i had created.
    please send me the coding how to do this object.
    will be rewarded.
    thanks in advance.

    Hi Suresh
      this is actual requirement
    in the CAT2.
    1. Add a new column for WBS description and derive the value as per the FS
    2. Retrieve project number and description and update in the column specified
    3. When a service order is selected it should do the same for 2.
    4. Finally repeat for the worklist view (which is the section above)
       here i am able to display values at data entry area
    for service order and network but not worklist area ?
        updation is not coming, can u plz go throw it..
    Thanks
    Chinna

  • Sale Order Item : Custom Field : Table Control

    I have added two fields to sale order item table control in program SAPMV45A screen no . 4900. Now the field which i have added are working fine while creating sale order but while changing those fields are not changing.
    condition is like this: the custom field are automatically filled by some logic and if the user want to change those field he will able to do. Now 1st condition is fine and when i change those field they will show the previous saved value inspite of changed value. 
    I have also added those field in additional data b tab in screen 8459 , there they are working fine but here the problem remains the same.

    Hi,
    u can use BAPI_SALESORDER_CHANGE to update the values of those fields. for that u need to extend few tables and coding that u can get from the BAPI documentation. If not getting reply back. i can help u..
    regards,
    pavan.

  • Reg:Table Control in Custom Screen

    Hi All,
    I am having a requirement of adding a custom screen in vendor master,interms of adding field i done it successfully by using BADI's,but now i added a table control in the custom screen,now whenever am trying to create a new vendor its showing vendor successfully created for the company code,but if i try to open any transaction after that am getting an error like "Express document "Update was terminated" received from author "Reference User Development"" , and if i go for transcation code XK03 if i try to open the particular vendor its showing error "Vendor has not been created".
    Regards
    Arpitam

    Hi Suchithra,
    For each and every fields in the screen will have by default properties as Group number which Group1 and Group3 but when u create a table control manually you might have forgot to maintain the the Group number details because of which it is showing in display rather in change.
    Please maintain the Group details in screen field properties and check. I think it will work.
    Regards,
    Aditya.

  • To add a custom field in table control in transaction me21n and me22n

    Hi Guru's,
    I have a requirement to add a field in the table control at the time of creation of PO (ME21N). I enhansed the structure MEPO1211, but it is not appearing in the transaction. What should i do in order to bring that field in table control.
    I implemented badis ME_GUI_PO_CUST and ME_PROCESS_PO_CUST by seeing some forum results.But i didnt get how to implement...
    Please help me in this regard how to follow the steps and if possible please provide a sample code.
    Thanks & Regards,
    R.P.Sastry

    hi,
    Suppose in the there are three tabs BADI customer1, BADI customer2 and BADI customer3 at item level.
    Say:
    On BADI customer1 there are three fields FIELD1, FIELD2 and FIELD3.
    On BADI customer2 there are two fields FIELD4 and FIELD5.
    On BADI customer3 there are three fields FIELD6, FIELD7 and FIELD8.
    Then the fields have to be added to EKPO (or requisite custom table as the need may be) and also fields are also to be added to custom structures.
    Create a Structure ZSTRUCTURE1 which will contain the three fields FIELD1, FIELD2 and FIELD3.
    Create another Structure ZSTRUCTURE2 which will contain the two fields FIELD4 and FIELD5.
    Create another Structure ZSTRUCTURE2 which will contain the three fields FIELD6, FIELD7 and FIELD8.
    The Structure STRUCTURE1 has to be passed for tab BADI customer1, the Structure STRUCTURE2 has to be passed for tab BADI customer2 and the Structure STRUCTURE3 has to be passed for tab BADI customer3.
    Each custom tab/screen should have its own structure to handle the screen fields, but the screen field data has to be transfered to and from EKPO (or requisite custom table as the need may be) for database update/retrieve.
    Hope this helps.
    Regards,
    Ritesh

  • Updation of data in table control

    Hi friends,
    i have developed a custom tab in purchase order.
    in that customer tab i created a push button.
    after pressing the push button it will call a user defined screen with table control.
    after entering the data in the table control a z table should update with the information
    given in the table control including purchase order number created after saving the po.
    can any one help me
    Thanks and Regards,
      Ramesh

    Hi,
    go to xm06 function group --> screen which you have created ..create a module in PAI event and capture the table control values ...as entered and pass to memeory id .....through export statement ...
    in the function module EXIT_SAPMM06E_012 get the exported values through import  parameters ...and update the ztable...
    Thanks,
    Shailaja Ainala.

  • Custom Color  required to table control in Standard transaction

    Hi Expers,
    I required to populate a table control row with custom color/s.  The table control is belongs to SAP Standard transaction MF50.
    Can you please suggest.
    Thanks,
    Prasad

    Hello Madhu,
    As indicated by u have have asked for the access key and have added a field. Where have u added this field. Secondly in which table are u going to update this material field once it starts getting displayed. Also have u put in code in ur PBO and PAI for the same. Please respond to the questions so that we can provide u with better option.

Maybe you are looking for