‎2007 Jul 30 7:32 AM
‎2007 Jul 30 7:37 AM
Hi
get cursor is used to store the value of the field on which the cursor is placed
get cursor value f1----
>this stores the value in the field f1
which can b used later
first display the material number on the list from an internal table
loop at it_mara.
write : / it_mara-matnr.
endloop.
after list is diplayed place the cursor on the matnr and click it
that value is stored in field f1.
which can b later used to display on secondary list or any other purpose...
its just like hide statement..
see this is how u use Get Cursor command under At Line Selection Event.
**********************************************************************************************
AT LINE-SELECTION.
DATA : f(50),
v(50).
GET CURSOR FIELD f VALUE v.
CASE f.
WHEN 'F1'.
write v.
WHEN 'F2'.
write v.
endcase.
**********************************************************************************************
this code will get the name of the field that u select in the output list into variable 'f' and the contents of that field into variable' v ' which u can use for ur logical purppose as shown.
hope this helps....
<b>Reward If useful Answer*</b>
‎2007 Jul 30 7:33 AM
hi sahil
It will get the value of the cursor for other use.
Regards,
Azhar
‎2007 Jul 30 7:34 AM
<b>GET CURSOR </b>
Syntax
GET CURSOR { {FIELD field [field_properties]}
| {LINE line [line_properties]} }.
Effect
If this statement is specified during list processing, it will transfer - depending on the specification of FIELD or LINE - the name of the output field or the number of the list line on which the screen cusor in the currently displayed list is positioned (after the user action) into the variables field or line. For field, a character-type (prior to Release 6.10 flat) variable is expected; for line, a variable of the type i is expected. With the additions field_properties and line_properties, further information on the cursor position can be imported.
With the FIELD addition, only the names of global data objects of the ABAP program can be determined. If the cursor is positioned on the output of a data object that is not visible in the current context or a literal, field will be initialized. The latter has no influence on the other additions or on sy-subrc.
GET CURSOR - field_properties
Syntax
... [VALUE val] [LENGTH len]
[[DISPLAY|MEMORY] OFFSET off] [LINE lin].
Extras:
1. ... VALUE val
2. ... LENGTH len
3. ... [DISPLAY|MEMORY] OFFSET off
4. ... LINE lin
Effect
Using these additions, further information on the cursor position can be read during list processing with the addition FIELD of the GET CURSOR statement.
Addition 1
... VALUE val
Effect
The addition VALUE assigns the formatted content of the output area on which the cursor is positioned to the data object val. For val, a character-type (prior to Reease 6.10, flat) variable is expected.
Addition 2
... LENGTH len
Effect
The addition LENGTH assigns the length of the output area on which the cursor is positioned to the data object len. For len, a variable of the type i is expected.
Addition 3
... [DISPLAY|MEMORY] OFFSET off
Effect
The addition OFFSET without an addition or with the addition DISPLAY assigns the position of the cursor in the output area on which it is positioned to the data object off. For off, a variable of the type i is expected.
The addition OFFSET with the addition MEMORY assigns the offset of the character in the area of the data object in the list buffer (on whose output the cursor is positioned) to the data object off. If the cursor is positioned in a Unicode system on one of the characters < or > for characters cut off in the display, the position of the character in the list buffer that was overwritten by the character is assigned. For off, a variable of the type i is expected.
Addition 4
... LINE lin
Effect
The addition LINE assigns the number of the list row on which the cursor is positioned to the data object lin. For lin, a variable of the type i is expected.
GET CURSOR - line_properties
Syntax
... [VALUE val] [LENGTH len] [[DISPLAY|MEMORY] OFFSET off].
Extras:
1. ... VALUE val
2. ... LENGTH len
3. ... [DISPLAY|MEMORY] OFFSET off
Effect
With these additions, further information on the cursor position can be read using the addition LINE of the statement GET CURSOR.
Addition 1
... VALUE val
Effect
The addition VALUE assigns the formatted content of the list line on which the cursor is positioned to the data object val. For val, a character-type (prior to Release 6.10 flat) variable is expected.
Addition 2
... LENGTH len
Effect
The addition LENGTH assigns the line length set using the addition LINE-SIZE of the statement introducing the program or using NEW-PAGE (this is the line on which the cursor is positioned) to the data object len. For len, a variable of the type i is expected.
Addition 3
... [DISPLAY|MEMORY] OFFSET off
Effect
The addition OFFSET without an addition or with the addition DISPLAY assigns the position of the cursor in the displayed line on which it is positioned to the data object off. For off, a variable of the type i is expected.
The addition OFFSET with the addition MEMORY assigns the position of the character in the list buffer line (on whose output the cursor is currently positioned) to the data object off. If the cursor in a Unicode system is on one of the characters < or > for characters cut off in the display, the position of the character in the list buffer that is overwritten by the character is assigned. For off, a variable of the type i is expected.
Regards,
Pavan
‎2007 Jul 30 7:34 AM
get cursor command is used to captrure the value of a field which is displayed in the output.
‎2007 Jul 30 7:35 AM
hi,
get cursor is used to store selected field value.
GET CURSOR : Transfers the name of the field at the cursor position to the field f.
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.
If the hidden information is not sufficient to uniquely identify the selected line, the command GET CURSOR is used. The GET CURSOR command returns the name of the field at the cursor position in a field specified after the addition field, and the value of the selected field in a field specified after value.
GET CURSOR
Use the statements GET CURSOR FIELD and GET CURSOR LINE to pass the output field or output line on which the cursor was positioned during the interactive event to the ABAP program.
But by using GET CURSOR we can select the fields after list has been processed.
check the program DEMO_LIST_HIDE for hide technique.
DEMO_LIST_GET_CURSOR for get cursor technique.
‎2007 Jul 30 7:36 AM
Hi
<b>GET CURSOR</b>
Use the statements GET CURSOR FIELD and GET CURSOR LINE to pass the output field or output line on which the cursor was positioned during the interactive event to the ABAP program.
After user interaction with the screen, you may need to know the position of the cursor when the action occurred. This is particularly important if the user chooses the Choose function (F2 or mouse double-click).
To find out the cursor position, use the following statement:
GET CURSOR FIELD <f> [OFFSET <off>]
[LINE <lin>]
[VALUE <val>]
[LENGTH <len>].
This statement transfers the name of the screen element on which the cursor is positioned during a user action into the variable <f>. If the cursor is on a field, the system sets SY-SUBRC to 0, otherwise to 4.
The additions to the GET CURSOR statement have the following functions:
OFFSET writes the cursor position within the screen element to the variable <off>.
LINE writes the line number of the table to the variable <lin> if the cursor is positioned in a table control. If the cursor is not in a table control, <lin> is set to zero.
VALUE writes the contents of the screen field in display format, that is, with all of its formatting characters, as a string to the variable <val>.
LENGTH writes the display length of the screen field to the variable <len>.
Check this sample report using GET CURSOR
TYPES : BEGIN OF ty_test,
code TYPE i,
name(10) TYPE c,
amount TYPE p DECIMALS 2,
END OF ty_test.
DATA : it_test TYPE STANDARD TABLE OF ty_test WITH HEADER LINE INITIAL SIZE 10.
DATA : wa TYPE ty_test,
chk1 TYPE c,
fldname(30), fldval(50).
*set pf-status 'PF01'.
*set titlebar 'PF01'.
*
INITIALIZATION.
it_test-code = 300.
it_test-name = 'Ramesh'.
it_test-amount = 5500.
APPEND it_test.
wa-code = 207.
wa-name = 'Prem'.
wa-amount = 5000.
APPEND wa TO it_test.
it_test-code = 117.
it_test-name = 'James Bond'.
it_test-amount = 9900.
INSERT it_test INDEX 3.
it_test-code = 217.
it_test-name = 'Sivaraman'.
it_test-amount = 9900.
INSERT it_test INDEX 3.
it_test-code = 201.
it_test-name = 'Saravanan'.
it_test-amount = 1000.
APPEND it_test.
it_test-code = 210.
it_test-name = 'Shanmugam'.
it_test-amount = 6000.
APPEND it_test.
WRITE : / 'Loop Display ( Appended rows ) :-'.
LOOP AT it_test.
WRITE : / chk1 AS CHECKBOX,
sy-tabix, sy-vline, it_test-code, it_test-name, it_test-amount.
HIDE : it_test-code, it_test-name.
ENDLOOP.
SKIP.
END-OF-SELECTION.
CLEAR : it_test-code, it_test-name.
WRITE : / 'this from end of selection'.
*&--------------------------------------------------------------------*
*& Form DISP1
*&--------------------------------------------------------------------*
* text
*---------------------------------------------------------------------*
FORM disp1.
WINDOW STARTING AT 15 10
ENDING AT 80 15.
DO.
CLEAR chk1.
READ LINE sy-index FIELD VALUE chk1.
IF sy-subrc NE 0.
EXIT.
ELSE.
CHECK chk1 NE space.
WRITE : / it_test-code, it_test-name.
MODIFY CURRENT LINE :
FIELD VALUE chk1 FROM ' '
FIELD FORMAT chk1 INPUT OFF.
ENDIF.
ENDDO.
ENDFORM. "DISP1
***line double click ****
AT LINE-SELECTION.
CHECK sy-lsind = 1.
WINDOW STARTING AT 5 4
ENDING AT 85 20.
WRITE: / 'THE USER DOUBLE-CLICKED A LINE IN THE REPORT'.
WRITE: / sy-lisel.
WRITE : / 'Sometime ',it_test-name, ' is good '.
WRITE : / 'Sometime ',it_test-name, ' is bad '.
WRITE : / 'Sometime ',it_test-name, ' is rich '.
WRITE : / 'Sometime ',it_test-name, ' is poor '.
WRITE : / 'Who knows, who is ',it_test-name, ' ? '.
WRITE : /, / 'we can also use this in SELECT statement'.
CLEAR : it_test-code, it_test-name.
.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ULINE.
SKIP.
SKIP.
WRITE : / 'Below from Get Cursor Field...'.
GET CURSOR FIELD fldname VALUE fldval.
CONDENSE fldname.
CONDENSE fldval.
WRITE : / 'You have clicked ', fldname, ' & its value is ', fldval.
***function key press F6 ****
AT PF06.
PERFORM disp1.
*AT USER-COMMAND.
* CASE SY-UCOMM.
* WHEN 'STOP' OR 'CANCEL'.
* LEAVE TO SCREEN 0.
* WHEN 'TESTME'.
* PERFORM DISP1.
* ENDCASE.
Reward all helpfull answers
Regards
Pavan
‎2007 Jul 30 7:37 AM
Hi
get cursor is used to store the value of the field on which the cursor is placed
get cursor value f1----
>this stores the value in the field f1
which can b used later
first display the material number on the list from an internal table
loop at it_mara.
write : / it_mara-matnr.
endloop.
after list is diplayed place the cursor on the matnr and click it
that value is stored in field f1.
which can b later used to display on secondary list or any other purpose...
its just like hide statement..
see this is how u use Get Cursor command under At Line Selection Event.
**********************************************************************************************
AT LINE-SELECTION.
DATA : f(50),
v(50).
GET CURSOR FIELD f VALUE v.
CASE f.
WHEN 'F1'.
write v.
WHEN 'F2'.
write v.
endcase.
**********************************************************************************************
this code will get the name of the field that u select in the output list into variable 'f' and the contents of that field into variable' v ' which u can use for ur logical purppose as shown.
hope this helps....
<b>Reward If useful Answer*</b>
‎2008 Mar 13 3:47 PM
‎2008 Mar 14 7:10 AM
Hi,
use of get cursor command in reports
GET
Basic form 2
GET CURSOR ...
Variants:
GET CURSOR FIELD f.
GET CURSOR LINE line.
Variant 1
GET CURSOR FIELD f.
Extras:
... OFFSET off
... LINE line
... VALUE g
... LENGTH len
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 on 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.
Extras:
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).
regards,
vineela.
‎2008 Mar 14 7:22 AM
hi,
while doing interactive reporting in order to get the secondary lists based on the value of the field what we click we will use get cursor field.
it will take the cursor value and based on that it will display lists
the syntax is
get cursor field v_fld value v_kunnr
in the above v_fid takes tha field name and that value will be stored in v_kunnr.
thanks®ards,
pavan t.