‎2007 Mar 16 11:18 AM
Hi all,
can anyone please tell me coding or syntex for <b>get cursor</b> in screen?
thanks in advance.
‎2007 Mar 16 11:23 AM
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.
‎2007 Mar 16 11:23 AM
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.
‎2007 Mar 16 11:34 AM
‎2007 Mar 16 11:43 AM
i want to use <b>get cursor</b> in screen programmin in which i am displayin material numbers in one table view.
when i select one material among that materials and click one button, the other details like material doc. number and quantity should display in other table which also in that screen only.
can u please help me?
‎2007 Mar 16 11:56 AM
For Selecting a line , you can use the boxes in front of each row
double click on table control and give <b>single selection</b> ,
but you have to add one more field in your internal table to represent that box of length 1
then you can loop at the internal table and read the selected line
‎2007 Mar 16 12:03 PM
follow these steps to select record from table control and get the details of that record
Re: How do we capture the record selected in the table control?
Posted: Mar 16, 2007 8:02 AM in response to: Rakesh More Reply E-mail this post
1. Add on more field to ur internal table of lenght 1 say BOX(1)
2. Double click on table control , in attributes , select the checkbox w/ selColumn and to right of that give ITAB-BOX where itab is ur internal table
3. And on attributes screen under Line Selection select Single Selection
4. Now you can select your table control entries using that BOX
5. Now using READ statement you can get the selected records details and pass them to next screen
Message was edited by:
Chandrasekhar Jagarlamudi
‎2007 Mar 17 12:11 PM
Hi,
For this requirement you do need to go with GET CURSOR logic instead you need to selection in an table control is required.
I have answered this in another thread of yours.
Please close the thread if you got answer.
Reward points if it helped you in all of your raised threads.
Br,
Laxmi
‎2007 Mar 16 11:27 AM
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.
rewards Points if answer was helpful...
Kishi.
‎2007 Mar 16 12:25 PM
hi,
You can use get cursor as follows.
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>.
Cursor position on the screen.
PROGRAM DEMO_DYNPRO_GET_CURSOR.
DATA: OK_CODE LIKE SY-UCOMM,
SAVE_OK LIKE OK_CODE.
DATA: INPUT_OUTPUT(20) TYPE C,
FLD(20) TYPE C,
OFF TYPE I,
VAL(20) TYPE C,
LEN TYPE I.
CALL SCREEN 100.
MODULE INIT_SCREEN_0100 OUTPUT.
SET PF-STATUS 'STATUS_100'.
ENDMODULE.
MODULE USER_COMMAND_0100 INPUT.
SAVE_OK = OK_CODE.
CLEAR OK_CODE.
CASE SAVE_OK.
WHEN 'CANCEL'.
LEAVE PROGRAM.
WHEN 'SELE'.
GET CURSOR FIELD FLD OFFSET OFF VALUE VAL LENGTH LEN.
ENDCASE.
ENDMODULE.
The screen flow logic is as follows:
PROCESS BEFORE OUTPUT.
MODULE INIT_SCREEN_0100.
PROCESS AFTER INPUT.
MODULE USER_COMMAND_0100.
The module INIT_SCREEN_100 sets the GUI status STATUS_100 during the PBO event. In the status, the cancel icon (F12) is active with the function code CANCEL, and the function key F2 is active with the function code SELE.
When you run the program, the user can select any screen element by double-clicking it, or use any screen element connected to the function code SELE. The output fields on the screen return the cursor position.
regards,
veeresh