You are on page 1of 2

Google Drive For Work

Get Unlimited Online Storage, Docs, Spreadsheets & Presentations.

SAP PM & ABAP Code Niraj Visnoi
Table Control modification in SAP ABAP at run time

Table Control modification at run time.
Home
Basic Concepts   Input Help   Step Loop   Table Control   ListBox   SubScreen   TabStrip
What is SAP ?

SAP LSMW Explained Attributes & Creation   CXTAB_CONTROL  Modification  
with example

SAP PM T­Codes

PM BRD/COR
Maintenance We can modify the table control at run time or we can provide additonal functionality to our ABAP
Code like 'Inserting blank lines' , 'sorting by column', 'deleting selected rows' ,'hiding certain columns'
Add Your URL etc by setting the various fields of the structure CXTAB_CONTROL in abap either in PBO or PAI.
User Exits &
 
Enhancements ADDING BLANK LINES
To add blank lines to table control we do not need to change any of the fields of the structure
Best Of SAP Links CXTAB_CONTROL simply adding blank lines to the internal table will do.
BDC Code
INSERT INITIAL LINE INTO itab.
 
My Resume SORTING BY COLUMN
We have to first determine which column of table control was selected for sorting.Then we have to
SAP SmartForms Step
by Step
determine the name of the field from this information to use in SORT itab STABLE BY field command.
e.g.
SAP ABAP ALV Grid DATA: col LIKE LINE OF tab_con­COLS "tab_con is name of table control,
Explained with Example                                                             "COLS field is an internal table of TYPE
Useful Tips
                                                            "CXTAB_COLUMN  .This variable will
                                                            "be used to access column attributes of
Contact Information                                                             "the table control. 
Guest Book and  
Consultants List
*We will read the column properties of selected column into col variable from
ABAP Code *collection of columns COLS.
*SELECTED is the field of structure CXTAB_COLUMN and indicates selection.
ABAP System Fields  
SAPScript
READ TABLE tab_con­COLS INTO col WITH KEY selected = 'X' .
 
SAPScript Graphics IF SY_SUBRC EQ 0.
*col­SCREEN­NAME(+offset)  is used to determine the actual field name(like *PHONE) as*col­
SAPScript Print
Program
SCREEN­NAME will return the screen name like ADDRESS­*PHONE.
*the value of offset depends upon the length of the name of the structure.
ABAP ListViewer  
SORT itab STABLE BY col­SCREEN­NAME(+offset)
Dialog Programming
ENDIF.
SAP Tables  
 
SAP ALE and IDOC  
Recommended SAP
ABAP Coding guidelines DELETING SELECTED ROWS
Deletion of selected rows is simple. To delete selected rows first we will determine the rows which
SAP General ABAP have been selected through selection column .
Submit Your Code
 
FOR SINGLE ROW SELECTION
SAP Books For IF mark EQ 'X' .             "mark is the name of selection column field
consultants DELETE itab FROM workarea . 
Free Website
ENDIF.
Submission and ROR  
Sitemap generator FOR MULTIPLE ROW SELECTION
*To deetermine the rows selected we will use the selection column field to loop
Free Domain Search
*through the internal table.
Free HoroScope LOOP AT itab WHERE mark EQ 'X'.  "mark is the name of selection column field
DELETE itab                                    " and is part of the internal table .
ENDLOOP.

HIDING A COLUMN
To hide a column we will use the INVISIBLE field of the structure CXTABA_CONTROL and set its
value to 'X'.
 
e.g. To hide column number 3.
DATA col LIKE LINE OF tab­con­COLS .
READ TABLE tab_con­COLS INTO col WHERE index = 3. "tab_con is the name
                                                                                      " of table control.
col­INVISIBLE = 3.
MODIFY  tab­con­COLS FROM col INDEX 3.

DISABLING INPUT
To disable/enable fields of a column we will use the field SCREEN­INPUT of the
structure CXTAB_COLUMN and set its value to 0 or 1.
 
e.g. To disable input at column 3 of the table control .
DATA col LIKE LINE OF tab_con­COLS.
READ TABLE tab_con­COLS INTO col INDEX 3.
col­SCREEN­INPUT = 0 .
MODIFY tab_con­COLS FROM col INDEX 3.
 
NOTE: Similarly other operations can be performed by changing the value of various fields of
structure CXTAB_CONTROL.
 

Enter supporting content here

Add To Favorite  http://sap.niraj.tripod.com

Google Search     SAP ABAP Bdc Code  
 Search http://sap.niraj.tripod.com   Search www

Share

BDC Code   UserExits & Enhancements  SAPScript Explained   SAPScript Graphics
SAPScript Print Program   ABAP ListViewer   ABAP Code   Best Of SAP ABAP Links
My Resume   Contact Information   Free Website Submission   Free Domain Search
Free HoroScope   Submit Your Code   Add URL   SAP Forum   Adverise With Us
Dialog Programming   SAP Books   Dialog Programming    HOME

 http://sap.niraj.tripod.com      Niraj Visnoi *INDIA * niraj_visnoi@consultant.com      
 CELL No. 91 9911413767       Copyright © 2006 all rights reserved                           

Google Drive For
Work
Get Unlimited Online Storage,
Docs, Spreadsheets &
Presentations.

You might also like