Friday, December 17, 2010
Line selection is important in table control. Operations like Delete, Modify, Copy can be done for the line selected.

Steps involved

We should take one variable in your internal table or in structure which is used for table control fields

DATA :BEGIN OF itab OCCURS 0 ,
       mark TYPE c ,
       matnr LIKE mara-matnr ,
       matkl LIKE mara-matkl,
       maktx LIKE makt-maktx,
     END OF itab .
CONTROLS: tabc TYPES tableview USING screen 100.
This mark variable should be given in Table control properties. follow the path.
  • Double click on the table control.
  • Attributes
  • w/SelColumn and in that give itab-mark. Check in the figure.


Flow Logic of the screen.

PROCESS BEFORE OUTPUT.
MODULE status_0100.
LOOP AT itab WITH CONTROL tabc
ENDLOOP.

PROCESS AFTER INPUT.
MODULE CANCEL AT exit-command.
LOOP AT itab.
 MODULE read_table_control.
ENDLOOP.
MODULE user_command_0100.
Code for read_table_control

REPORT ZTEST_PROGRAM.
*----------------------------------------------------------------------*
*  MODULE read_table_control INPUT
*----------------------------------------------------------------------*
MODULE READ_TABLE_CONTROL INPUT.
  MODIFY ITAB INDEX TABC-CURRENT_LINE."this will update the itab table
  "mark field with 'X ' whatever we
  "have selected on table control
ENDMODULE.                    "read_table_control INPUT
If you want to Delete some of the records from Table control follow this code.
Create one pushbutton and give Fucnction code to that and write below code.

CASE okcode.
 WHEN 'DELETE'.
  LOOP AT itab WHERE mark = 'X'.
   DELETE itab.
  ENDLOOP.
ENDCASE. 

1 comment:

  1. Not working value get clear again from 'X' to blank..
    What is the issue

    ReplyDelete

Your useful comments, suggestions are appreciated.Your comments are moderated.

Followers

Contact Form

Name

Email *

Message *

Web Dynpro ABAP Book

An SAP Consultant

Follow US


Want to Contribute ?

If you are interested in writing about the new stuff you learn everyday while working, please write to the.sap.consultants@gmail.com.

Click on Contribution for more details.