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
604

Hi,

how can you read the cursor in table control

Can anybody help me on this.

7 REPLIES 7
Read only

Former Member
0 Likes
566

Hi

set cursor field 'name of the field' line table_control_name-current_line.

P.s reward points if helpful

Read only

Former Member
0 Likes
566

Syntax for table controls

At PBO.

Loop at <itab> with control <name> cursor <name>-top_line.

module <mod_name>.

Endloop.

At PAI.

Loop at <itab>.

Endloop.

Declaration for table control.

controls <name> type tableview using screen <no>.

Read only

hymavathi_oruganti
Active Contributor
0 Likes
566

with controls statement specify cursor and it should be of type i.

later u can use it.

Read only

Former Member
0 Likes
566

HI

At PAI you <u>can read the current cursor position</u> using

GET CURSOR FIELD <f> LINE <lin> ...

At PBO you can set the cursor on a specific field of a specific row of a table control.

SET CURSOR FIELD <f> LINE <lin> [OFFSET <off>].

Using the optional addition OFFSET, you can enter the offset of the cursor in the field

FOR MORE DETAILS ON THIS GO TO THE LINK

<a href="http://help.sap.com/saphelp_nw04/helpdata/en/9f/dbac9f35c111d1829f0000e829fbfe/content.htm">http://help.sap.com/saphelp_nw04/helpdata/en/9f/dbac9f35c111d1829f0000e829fbfe/content.htm</a>

PLEASE REWARD POINTS IF THIS FINDS USEFUL..

REGARDS

ANOOP

Read only

Former Member
0 Likes
566

in PBO u can do like this.

loop at t_0100 with control tctrl_0100

cursor tctrl_0100-current_line.

module m_modify_line.

endloop.

Read only

Former Member
0 Likes
566

hi there check out this program for setting the cursor position.

////////////////////////////////////

REPORT demo_dynpro_set_cursor.

DATA: field1(14) TYPE c, field2(14) TYPE c, field3(14) TYPE c,

name(10) TYPE c.

SELECTION-SCREEN BEGIN OF BLOCK bloc WITH FRAME.

PARAMETERS: def RADIOBUTTON GROUP rad,

txt RADIOBUTTON GROUP rad,

f1 RADIOBUTTON GROUP rad,

f2 RADIOBUTTON GROUP rad,

f3 RADIOBUTTON GROUP rad.

SELECTION-SCREEN END OF BLOCK bloc.

PARAMETERS pos TYPE i.

IF txt = 'X'.

name = 'TEXT'.

ELSEIF f1 = 'X'.

name = 'FIELD1'.

ELSEIF f2 = 'X'.

name = 'FIELD2'.

ELSEIF f3 = 'X'.

name = 'FIELD3'.

ENDIF.

CALL SCREEN 100.

MODULE cursor OUTPUT.

IF def NE 'X'.

SET CURSOR FIELD name OFFSET pos.

ENDIF.

SET PF-STATUS 'SCREEN_100'.

ENDMODULE.

MODULE back INPUT.

LEAVE SCREEN.

ENDMODULE.

///////////////////////////////////////////////////////

execute the report name(as given) in se38 .

if ur looking for the cursor in table control then

in PAI module of the

LOOP AT <internal table>.

loops through an internal table and a screen table in parallel. In particular, LOOP AT loops through the portion of the internal table that is currently visible in the screen. You can use this form of the LOOP statement for both table controls and step loops.

The complete syntax for this form of the LOOP statement is:

LOOP AT <internal table> CURSOR <scroll-var>

[WITH CONTROL <table-control> ]

[FROM <line1> ] [TO <line2> ].

...<actions>...

ENDLOOP.

This form of LOOP loops through the internal table, performing <actions> for each row. For each internal table row, the system transfers the relevant program fields to or from the corresponding screen table row.

When using step loops, omit the CURSOR parameter in the PAI event. The FROM and TO parameters are only possible with step loops. (For further information, refer to Using Step Loops.) The WITH CONTROL parameter is only for use with table controls.

For further information, refer to the following sections:

How the System Transfers Data Values

Scrolling and the Scroll Variables

Read only

Former Member
0 Likes
566

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.

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 the most of the functionality described above is 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 .

Initialization is achieved automatically in the "1st access to the control" (setting or reading values).

You can use the customizing button (in the top right corner) to save the current setting (column widths and column positions) and use it as the initial value for the next call.

All the initial values can be overwritten by the program using the MOVE ... TO TC attributes statement.