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
412

how to get cursor position to a field in table control

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
392

Hi

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.

u need to comment the performs of table control fields and write ur own perform statements. And u have to declare the table control fields as separate internal tables.

Go through this urls.

www.saptechnical.com

www.sap-img.com

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

Reward points for useful Answers

Regards

Anji

3 REPLIES 3
Read only

Former Member
0 Likes
393

Hi

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.

u need to comment the performs of table control fields and write ur own perform statements. And u have to declare the table control fields as separate internal tables.

Go through this urls.

www.saptechnical.com

www.sap-img.com

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

Reward points for useful Answers

Regards

Anji

Read only

Former Member
0 Likes
392

Hello,

U can use GET CURSOR FIELD f.

GET

Basic form 2 GET CURSOR. ...

Variants:

1. GET CURSOR FIELD f.

2. GET CURSOR LINE line.

Variant 1

GET CURSOR FIELD f.

Additions:

1. ... OFFSET off

2. ... LINE line

3. ... VALUE g

4. ... LENGTH len

5. ... AREA

Effect

Transfers the name of the field at the cursor position to the field f.

The return code is set as follows:

SY-SUBRC = 0:

Cursor was positioned on a field.

SY-SUBRC = 4:

Cursor was not positioned on a field.

Note

Unlike screen processing, list processing allows you to output literals, field symbols, parameters and local variables of subroutines. Literals, local variables and VALUE parameters of subroutines are treated like fields without names (field name SPACE, return value 0).

Otherwise, GET CURSOR FIELD returns only names of global fields, regardless of whether they are addressed directly (i.e. by "WRITE"), by field symbols or by reference parameters.

Example

DATA: CURSORFIELD(20),

GLOB_FIELD(20) VALUE 'global field',

REF_PARAMETER(30) VALUE 'parameter by reference',

VAL_PARAMETER(30) VALUE 'parameter by value',

FIELD_SYMBOL(20) VALUE 'field symbol'.

FIELD-SYMBOLS: <F> TYPE ANY.

PERFORM WRITE_LIST USING REF_PARAMETER VAL_PARAMETER.

ASSIGN GLOB_FIELD TO <F>.

AT LINE-SELECTION.

GET CURSOR FIELD CURSORFIELD.

WRITE: / CURSORFIELD, SY-SUBRC.

FORM WRITE_LIST USING RP VALUE(VP).

DATA: LOK_FIELD(20) VALUE 'local field'.

ASSIGN FIELD_SYMBOL TO <F>.

WRITE: / GLOB_FIELD, / LOC_FIELD,

/ RP, / VP,

/ 'literal', / FIELD_SYMBOL.

ENDFORM.

When you double-click the word " global field", CURSORFIELD contains the field name GLOB_FIELD, on "parameter by reference" the field name REF_PARAMETER, on " field symbol" the field name FIELD_SYMBOL, and on "local field", "parameter by value" and "literal" the value SPACE.

Addition 1

... OFFSET off

Effect

Copies the position of the cursor within the field to the field off (1st column = 0).

If the cursor is not somewhere within a field (SY-SUBRC = 4), the offset value is set to 0.

Addition 2

... LINE line

Effect

With step loops, lin contains the number of the loop line where the cursor stands. In list processing, this is the absolute line number (as stored in the system field SY-LILLI).

Addition 3

... VALUE g

Effect

g contains the value of the field where the cursor stands, always in output format (character display).

Addition 4

... LENGTH len

Effect

len contains the output length of the field where the cursor stands.

Addition 5

... AREA a

Effect

If the cursor is positioned on the field of a table view control, the name of the control is placed in the field a.

Variant 2

GET CURSOR LINE line.

Additions:

1. ... OFFSET off

2. ... VALUE g

3. ... LENGTH len

Effect

As for variant 1 with addition LINE, except that there are differences with the return code and the effect of the additions.

The return code is set as follows:

SY-SUBRC = 0:

The cursor is on one of the list lines (list processing) or on a loop line (step loop).

SY-SUBRC = 4:

The cursor is not on one of the list or loop lines.

Addition 1

... OFFSET off

Effect

Applies to list processing only. The field off contains the position of the cursor relative to the beginning of the list line (1st column = 0). With horizontally shifted lists, the offset value can thus be greater than 0, even if the cursor is positioned on the extreme left of the window.

Addition 2

... VALUE g

Effect

List processing only. The field g contains the list line where the cursor is positioned.

Addition 3

... LENGTH len

Effect

List processing only. len contains the length of the line (LINE-SIZE).

Related

SET CURSOR

Additional help

Setting the Cursor Position

Reading Lists at the Cursor Position

Thanks

Ashu

Read only

Former Member
0 Likes
392

answered