Application Development and Automation 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: 
Read only

table control

Former Member
0 Likes
471

hi all,

can anybody tell me that how to handle new entery made in new row entered by user in table control. How to set the cursor on new row in table control and how to process that data of that row such that it can be updated in database table.

very urgent.

Thanks and Regards,

noor

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
358

hi noor,

table control is used to put data on screen in table form

and same is the case to get data from screen entered in form of table..

so there are multiple entries to display on screen

And multiple enteries to get from screen.

so we use loop-endloop in both PBO and PAI

ABAP Tableview Control

Basic form

CONTROLS ctrl TYPE TABLEVIEW USING SCREEN scr.

Effect

Creates a table control ctrl of the type TABLEVIEW. The reference screen for the initialization is the screen scr.

The table control (referred to here as TC ) facilitates the display and entry of one-line, tabular data in dialog transactions.

The functional scope has been defined so that you can use the standard methods of a TC to easily implement many typical set operations, which are usually handled by an elementary STEP-LOOP.

Functional scope

· Tabular area for displaying and editing data.

· Column width and column position modifiable by user and by program.

· Storing and loading of user-specific column layout.

· Selection column for line selection with color selection display.

· Variable column headers as pushbuttons for column selection.

· Single selection, multiple selection, Select/deselect all.

· Scrolling functions (horizontal and vertical) using the scroll bar.

· Fixing of any number of key columns.

· Setting attributes for each cell at runtime.

Programming

The data exchange between the application and the SAPgui is achieved with a STEP-LOOP, that is an ABAP module is called to transfer data line-by-line for each page.

Example

Processing without an internal table

PROCESS BEFORE OUTPUT.

LOOP WITH CONTROL ctrl.

MODULE ctrl_pbo.

ENDLOOP.

PROCESS AFTER INPUT.

LOOP WITH CONTROL ctrl.

MODULE ctrl_pai.

ENDLOOP.

In this case, the module ctrl_pbo OUTPUT is called once for each output line before the screen is displayed, in order to fill the output fields.

After the user has entered data on the screen, the module ctrl_pai INPUT is executed to check the input and copy the new contents.

Example

Processing with an internal table

PROCESS BEFORE OUTPUT.

LOOP AT itab WITH CONTROL ctrl CURSOR ctrl-CURRENT_LINE.

ENDLOOP.

PROCESS AFTER INPUT.

LOOP AT itab WITH CONTROL ctrl.

MODULE ctrl_pai.

ENDLOOP.

Here, the system fills the output fields before displaying the screen by reading the internal table itab.

When the user has entered data, the module ctrl_pai INPUT must be executed to check the input and to refresh the contents of the internal table.

If there are several table controls on one screen, the order of the loop statements in the flow logic must correspond to the order of the controls on the screen (from top left to bottom right).

Vertical scrolling with the scroll bar is followed by the event PAI for the displayed page. Then, cntl-TOP_LINE is increased and PBO is processed for the next page.

Program-driven scrolling and most of the functions described above are achieved by manipulating the control attributes.

Attributes

The CONTROLS statement creates a complex data object of the type CXTAB_CONTROL with the name of the control.

You maintain the initial values in the Screen Painter and assign the screen with the initial values for a control using the addition USING SCREEN.

A further dynamic initialization occurs in the "1st access to the control" (setting or reading values). However, the time of the "1st access" is not clearly specified. This is especially important for the LINES component, which controls the scroll bar of the table control.

For a description of individual components of the structure CXTAB_CONTROL, refer to:

Table Controls in ABAP Programs

When displaying the control, the system uses the current contents at the time when all PBO modules have run. The modified values (changed by the user on the screen) are set directly before the first PAI is called.

Inspire if usefull,

Thanks,

Kalyan.

3 REPLIES 3
Read only

Former Member
0 Likes
358

Hi Noor,

Please refer this link and also T-code ABAPDOCU .

https://www.sdn.sap.com/irj/sdn/advancedsearch?query=table+control&cat=sdn_all

in T-code ABAPDOCU u will find examples for table control in one of the dropdowns.

Cheers

Mohinder Singh

Read only

Former Member
0 Likes
358

Hi Mohd,

syntax:

CONTROLS .

if you only want to determine the row of the table control. SY´-SUBRC allows you to check if the cursor is placed in a row of a table control.

Check the below links.

http://www.planetsap.com/howdo_a.htm

http://help.sap.com/saphelp_nw2004s/helpdata/en/9f/dbac5135c111d1829f0000e829fbfe/content.htm

http://sap.niraj.tripod.com/id25.html

Read only

Former Member
0 Likes
359

hi noor,

table control is used to put data on screen in table form

and same is the case to get data from screen entered in form of table..

so there are multiple entries to display on screen

And multiple enteries to get from screen.

so we use loop-endloop in both PBO and PAI

ABAP Tableview Control

Basic form

CONTROLS ctrl TYPE TABLEVIEW USING SCREEN scr.

Effect

Creates a table control ctrl of the type TABLEVIEW. The reference screen for the initialization is the screen scr.

The table control (referred to here as TC ) facilitates the display and entry of one-line, tabular data in dialog transactions.

The functional scope has been defined so that you can use the standard methods of a TC to easily implement many typical set operations, which are usually handled by an elementary STEP-LOOP.

Functional scope

· Tabular area for displaying and editing data.

· Column width and column position modifiable by user and by program.

· Storing and loading of user-specific column layout.

· Selection column for line selection with color selection display.

· Variable column headers as pushbuttons for column selection.

· Single selection, multiple selection, Select/deselect all.

· Scrolling functions (horizontal and vertical) using the scroll bar.

· Fixing of any number of key columns.

· Setting attributes for each cell at runtime.

Programming

The data exchange between the application and the SAPgui is achieved with a STEP-LOOP, that is an ABAP module is called to transfer data line-by-line for each page.

Example

Processing without an internal table

PROCESS BEFORE OUTPUT.

LOOP WITH CONTROL ctrl.

MODULE ctrl_pbo.

ENDLOOP.

PROCESS AFTER INPUT.

LOOP WITH CONTROL ctrl.

MODULE ctrl_pai.

ENDLOOP.

In this case, the module ctrl_pbo OUTPUT is called once for each output line before the screen is displayed, in order to fill the output fields.

After the user has entered data on the screen, the module ctrl_pai INPUT is executed to check the input and copy the new contents.

Example

Processing with an internal table

PROCESS BEFORE OUTPUT.

LOOP AT itab WITH CONTROL ctrl CURSOR ctrl-CURRENT_LINE.

ENDLOOP.

PROCESS AFTER INPUT.

LOOP AT itab WITH CONTROL ctrl.

MODULE ctrl_pai.

ENDLOOP.

Here, the system fills the output fields before displaying the screen by reading the internal table itab.

When the user has entered data, the module ctrl_pai INPUT must be executed to check the input and to refresh the contents of the internal table.

If there are several table controls on one screen, the order of the loop statements in the flow logic must correspond to the order of the controls on the screen (from top left to bottom right).

Vertical scrolling with the scroll bar is followed by the event PAI for the displayed page. Then, cntl-TOP_LINE is increased and PBO is processed for the next page.

Program-driven scrolling and most of the functions described above are achieved by manipulating the control attributes.

Attributes

The CONTROLS statement creates a complex data object of the type CXTAB_CONTROL with the name of the control.

You maintain the initial values in the Screen Painter and assign the screen with the initial values for a control using the addition USING SCREEN.

A further dynamic initialization occurs in the "1st access to the control" (setting or reading values). However, the time of the "1st access" is not clearly specified. This is especially important for the LINES component, which controls the scroll bar of the table control.

For a description of individual components of the structure CXTAB_CONTROL, refer to:

Table Controls in ABAP Programs

When displaying the control, the system uses the current contents at the time when all PBO modules have run. The modified values (changed by the user on the screen) are set directly before the first PAI is called.

Inspire if usefull,

Thanks,

Kalyan.