Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Table control

Former Member
0 Kudos

Hi All,

I have to display data from ztable in table control & also I have to allow user to modify & insert new records from there.

Is this possible?

If yes kindly suggest how?

Regards,

Dilip

6 REPLIES 6

athavanraja
Active Contributor
0 Kudos

it is possible. in the graphical screen painter there is a button for table control with wizard, just follow the wizard.

Regards

Raja

Former Member
0 Kudos

Hi,

It is possible. Create a screen and cick the layout button. it will take u to the screen painter. there add table control and other stuffs and handle the logic in PBO/PAI according to your requirement.

Regs,

Venkat

Former Member
0 Kudos

Hi,

Check this example.



REPORT demo_dynpro_tabcont_loop_at.

CONTROLS flights TYPE TABLEVIEW USING SCREEN 100.
DATA: cols LIKE LINE OF flights-cols,
      lines TYPE i.

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 CORRESPONDING FIELDS OF 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'.
  DESCRIBE TABLE itab LINES lines.
  flights-lines = lines.
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.

Regs,

Venkat

jayanthi_jayaraman
Active Contributor
0 Kudos

Hi,

Check this link.In that link,I am explaining everything step-by-step[dispalying records and manipulations in table control].

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/documents/a1-8-4/table control in abap.pdf

Kindly get back in case of clarifications.Otherwise,reward points if you find it as useful.

andreas_mann3
Active Contributor
0 Kudos

Hi Dillip,

and have a look here :

look at this sample program in transaction SE38:

RSDEMO_TABLE_CONTROL

regards Andreas

0 Kudos

Hi All,

Following is the code to delete the selected rtecord. But it is deleting the first record in the table control.

module read_tab input.

ok_code = sy-ucomm.

clear :sy-ucomm.

if ok_code = 'DEL'.

DELETE TABLE IT_ZEMP FROM ZEMP.

describe table it_zemp lines tab-lines.

endif.

endmodule. " read_tab INPUT

<b>This is how i have declared in the flow logic.</b>

PROCESS BEFORE OUTPUT.

MODULE STATUS_0100.

loop at it_zemp into zemp with control tab." cursor tab-current_line.

current_line.

module read_table.

endloop.

PROCESS AFTER INPUT.

MODULE USER_COMMAND_0100.

loop at it_zemp ." with control tab.

module read_tab.

endloop.