Skip to Content
avatar image
Former Member

Table Control

Hi All

I have taken one ztable which have two fields matnr and mbrsh. I have create one table control and i will insert that two fields into table control. I want to save that two fields into ztable. Please tell me step-wise how to do this and tell me loops also in flow logic.

Thanks and Regards.

Pradip Pawar

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • avatar image
    Former Member
    Aug 17, 2007 at 08:57 AM

    Hi,

    In user command when you will use 'save ' option of menu to save values from table control , in PAI inside loop of table control genrate a module to save data.

    module save_data.

    this module will have

    modify z_tabname from table i_tabname.

    for this you have to first take data from work area of tab control into itab then modify or directly modify from work area.

    In loop beacuse it will modify index wise each record.

    reward if useful.

    thanks,

    Madhura.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 17, 2007 at 06:22 AM

    Hi,

    after creating the table control

    there will be empty space to enter the values...

    after entering the values

    use the command

    modify ztable from table itab.

    if the lines which are appearing is not enough

    then

    you have to clik the next page button which is available

    on top

    there

    for eg it the function code is 'PAGE'

    then

    case sy-ucomm.

    when 'PAGE'.

    clear itab.

    append itab.

    endcase

    so that a blank will be created for you...

    and you can insert the values

    thanks & regards,

    Venkatesh

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Venkatesh,

      I did like this modify ztable from table itab. How how shouid we will get data into Itab from table control. I mean to Say I insert records into table control. I need procedure after this.

      Thanks in advance.

      Pradip Pawar

  • avatar image
    Former Member
    Aug 17, 2007 at 06:47 AM

    Hi pradip,

    check this program demo_dynpro_tabcont_loop_at.

    hope this solves ur problem

    REPORT demo_dynpro_tabcont_loop_at.

    CONTROLS flights TYPE TABLEVIEW USING SCREEN 100.

    DATA cols LIKE LINE OF flights-cols.

    DATA: ok_code TYPE sy-ucomm,

    save_ok TYPE sy-ucomm.

    DATA: itab TYPE TABLE OF demo_conn.

    TABLES demo_conn.

    SELECT * FROM spfli INTO TABLE itab.

    LOOP AT flights-cols INTO cols WHERE index GT 2.

    cols-screen-input = '0'.

    MODIFY flights-cols FROM cols INDEX sy-tabix.

    ENDLOOP.

    CALL SCREEN 100.

    MODULE status_0100 OUTPUT.

    SET PF-STATUS 'SCREEN_100'.

    ENDMODULE.

    MODULE cancel INPUT.

    LEAVE PROGRAM.

    ENDMODULE.

    MODULE read_table_control INPUT.

    MODIFY itab FROM demo_conn INDEX flights-current_line.

    ENDMODULE.

    MODULE user_command_0100 INPUT.

    save_ok = ok_code.

    CLEAR ok_code.

    CASE save_ok.

    WHEN 'TOGGLE'.

    LOOP AT flights-cols INTO cols WHERE index GT 2.

    IF cols-screen-input = '0'.

    cols-screen-input = '1'.

    ELSEIF cols-screen-input = '1'.

    cols-screen-input = '0'.

    ENDIF.

    MODIFY flights-cols FROM cols INDEX sy-tabix.

    ENDLOOP.

    WHEN 'SORT_UP'.

    READ TABLE flights-cols INTO cols WITH KEY selected = 'X'.

    IF sy-subrc = 0.

    SORT itab STABLE BY (cols-screen-name+10) ASCENDING.

    cols-selected = ' '.

    MODIFY flights-cols FROM cols INDEX sy-tabix.

    ENDIF.

    WHEN 'SORT_DOWN'.

    READ TABLE flights-cols INTO cols WITH KEY selected = 'X'.

    IF sy-subrc = 0.

    SORT itab STABLE BY (cols-screen-name+10) DESCENDING.

    cols-selected = ' '.

    MODIFY flights-cols FROM cols INDEX sy-tabix.

    ENDIF.

    WHEN 'DELETE'.

    READ TABLE flights-cols INTO cols WITH KEY screen-input = '1'.

    IF sy-subrc = 0.

    LOOP AT itab INTO demo_conn WHERE mark = 'X'.

    DELETE itab.

    ENDLOOP.

    ENDIF.

    ENDCASE.

    ENDMODULE.

    Regards,

    Prasant

    *Reward if helpful

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 10, 2007 at 05:54 AM

    Thanks all for your valuable support.

    Regards.

    Pradip Pawar

    Add comment
    10|10000 characters needed characters exceeded