Get cursor on a control table
Hi guys,
i created a control table with the ti_master inside.
im trying to get the postion when double click, i already got the event, F2, with PICK,
my problem is that i dont know how to get the row and the column that was clicked, im using get cursor but im a little bit lost.
the name of my control table is USERS
the internal table name is TI_users
i use GET CURSOR USERS, but is an error
so i think is GET CURSOR TI_USERS., but i search on SY and i cant see the values.
any ideas?
Take a look at <a href="http://help.sap.com/saphelp_nw04/helpdata/en/9f/dbabf135c111d1829f0000e829fbfe/frameset.htm">Finding Out the Cursor Position</a> there SAP provide a sample.
GET CURSOR FIELD <f> [OFFSET <off>]
[LINE <lin>]
[VALUE <val>]
[LENGTH <len>].
<i>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>.</i>
Regards
Similar Messages
-
How to Get Cursor Position in a Table
Hi Experts,
I have a table, with input fields. I have a button to add as many rows as I want. For the second column I have
a OVS. Now assume I have added 3 rows and I want to edit the first row again. So I click the first row and click
on the OVS selector, and finally when I select a value in the OVS it comes to the Third row, that is the row
with the Lead Selection. How do I get it to come in the first row?Hi Murli,
If I understand your requirement correctly, you have table which has OVS for one field. If this problem is only because of leadselection you can disable the lead selection by setting selectionMode property of the table to none. Try it out once.
But I guess the problem might be different, you can try like this.
Create a child node for the table node with Cardinality 1...1 Singleton false
Create the attribute and impliment OVS and bind this to your second column of the table.
Regards,
Siva -
Getting Cursor for Table control while scrolling
Hi Experts,
I am displaying 3 pages of records using table controls,
and when i double click on the record, i have to display some pop up based on the values present in the particular record,
this is done by getting the line number of the record using GET CURSOR LINE and reading the internal table with the index obtained from GET CURSOR LINE
This is working fine for one page. I am getting problem for more than one pages
i.e. if i have to validate for the 23rd record, it will be the second record in the second page, so i will get line number as 2nd instead of 23rd (using GET CURSOR LINE) and i will read the 2nd record in the internal table instead of reading the 23rd record.
This will lead to improper pop up messages.
So please let me know how can i catch/get the line number of particular record irrespective of number of pages.
Thanks,
Kavyadeclare two variables to get line count and line index
data: wrk_linecnt(10),
wrk_lineindx(10).
get cursor line wrk_linecnt.
wrk_lineindx = <table control name>-top_line + wrk_linecnt - 1. -
How to get current row data in table control
Hi , expert ,
I am professional in oracle , but now I am a new guy in SAP ABAP .
I have a question in UI
How to get current row data and click pushbutton in table control to open next screen ?
I want to get the current data and open next screen to carry out detail detail .
Thansk for all your suggestion .GET CURSOR LINE SY-CUROW .
READ TABLE internal_table index SY-CUROW. -
Get selected row in a table control
What is the best approach to get a selected row, all fields, in a table control? I see this done in various transactions in MM but do not see how to do this in documentation.
Thanksin the screen flow logic you need something like this:
LOOP AT t_partner.
MODULE get_selected_line.
MODULE process_partner.
ENDLOOP.
PAI module get_selected_line :
MODULE get_selected_line INPUT.
only get cursor position once....as it's constant within each loop
IF sy-stepl EQ 1.
CLEAR wv_cursor_0120.
GET CURSOR LINE wv_cursor_0120.
IF wv_cursor_0120 = 0.
wv_cursor_0120 = 1.
ENDIF.
convert the relative line of the screen to the actual line number in the table
wv_absolute_line = wv_cursor_0120 + tc_partner-top_line - 1.
ENDIF.
ENDMODULE. " GET_SELECTED_LINE INPUT
module process_partner needs to be something like this:
MODULE process_partner INPUT.
only process the selected line
CHECK sy-stepl = wv_cursor_0120.
CASE ok_code.
endcase.
endmodule. -
Need to get the row selected in table control without ay action
Dear Team,
I have a requirement in which I need to pass the row selected of a table control to a variable.
Here I need to get the row selected with out any other action
then the action of selection of a row.
Is it possible to read table control values using FM DYNP_VALUES_READ.
thanks in advance,
regards,
SaiHI,
Sai Kumar Potluri
I tried in IDES it working.
Here is the code.
REPORT ZPRA_TC_D.
TABLES : SCARR.
CONTROLS TC TYPE TABLEVIEW USING SCREEN 1.
DATA : SELLINE TYPE I,
SELINDEX TYPE I.
DATA : ACT LIKE SCARR-CARRID,
ANT LIKE SCARR-CARRNAME.
DATA : ITAB LIKE SCARR OCCURS 0 WITH HEADER LINE.
CALL SCREEN 1.
*& Module STATUS_0001 OUTPUT
* text
MODULE STATUS_0001 OUTPUT.
SET PF-STATUS 'ME'.
* SET TITLEBAR 'xxx'.
SELECT * FROM SCARR INTO TABLE ITAB.
ENDMODULE. " STATUS_0001 OUTPUT
*& Module MOV OUTPUT
* text
MODULE MOV OUTPUT.
MOVE-CORRESPONDING ITAB TO SCARR.
ENDMODULE. " MOV OUTPUT
*& Module USER_COMMAND_0001 INPUT
* text
MODULE USER_COMMAND_0001 INPUT.
CASE SY-UCOMM.
WHEN 'BACK' OR 'UP' OR 'EXIT'.
LEAVE PROGRAM.
WHEN 'SEL'.
GET CURSOR FIELD SCARR-CARRID LINE SELLINE.
SELINDEX = TC-TOP_LINE + SELLINE - 1.
READ TABLE ITAB INDEX SELINDEX.
ACT = ITAB-CARRID.
ANT = ITAB-CARRNAME.
ENDCASE.
ENDMODULE. " USER_COMMAND_0001 INPUT
In Flow Logic.
PROCESS BEFORE OUTPUT.
MODULE STATUS_0001.
LOOP AT ITAB WITH CONTROL TC.
MODULE MOV.
ENDLOOP.
PROCESS AFTER INPUT.
LOOP AT ITAB.
ENDLOOP.
MODULE USER_COMMAND_0001. -
Regarding sy-lilli, Get cursor line
Hi Folks,
I'm having some trouble with getting the cursor line in a search help selection.
This is my code:
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'XBLNR'
dynpprog = sy-repid
dynpnr = sy-dynnr
dynprofield = 'ITAB-FACTURA'
window_title = 'Facturas'
value_org = 'S'
TABLES
value_tab = itab_bsik_v[]
return_tab = return_tab
EXCEPTIONS
parameter_error = 1
no_values_found = 2
OTHERS = 3.
IF sy-subrc = 0.
ENDIF.
GET CURSOR LINE l_linea.
READ TABLE itab_bsik_v INDEX l_linea.
DATA: l_stepl LIKE sy-stepl,
l_indx LIKE sy-stepl.
DATA: dynpfields LIKE dynpread OCCURS 5 WITH HEADER LINE.
* Adjust for scroling within table control
CALL FUNCTION 'DYNP_GET_STEPL'
IMPORTING
povstepl = l_stepl
EXCEPTIONS
stepl_not_found = 0
OTHERS = 0.
l_indx = grid-top_line + l_stepl - 1.
REFRESH dynpfields.
CLEAR dynpfields.
dynpfields-fieldname = 'ITAB-FACTURA'.
dynpfields-fieldvalue = itab_bsik_v-xblnr.
dynpfields-stepl = l_stepl.
APPEND dynpfields.
dynpfields-fieldname = 'ITAB-BUZEI'.
dynpfields-fieldvalue = itab_bsik_v-buzei.
dynpfields-stepl = l_stepl.
APPEND dynpfields.
CALL FUNCTION 'DYNP_VALUES_UPDATE'
EXPORTING
dyname = sy-repid "Program name
dynumb = sy-dynnr "Screen number
TABLES
dynpfields = dynpfields
EXCEPTIONS
OTHERS = 0.
The internal table itab_bsik_v is filled with 10 records. So when user clicks on record 5, I would expect that l_linea gets 5 as cursor line, however I'm getting 1 always.
I tried changing the GET CURSOR LINE by sy-lilli but I'm not understanding really well the sy-lilli variable because when I click the first line of the search help result, I get a 4 as the index, and when I click in the last line I get 13.
If anyone could help me with this I really appreciate it.
Thanks for your help.
Regards,
Gilberto LiInstead of using GET CURSOR LINE why not u use return_tab.
This int. table should contins data selected ny user during F4 help. I have done few changes in ur code. pl. check whether it works or not.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'XBLNR'
dynpprog = sy-repid
dynpnr = sy-dynnr
dynprofield = 'ITAB-FACTURA'
window_title = 'Facturas'
value_org = 'S'
TABLES
value_tab = itab_bsik_v[]
return_tab = return_tab
EXCEPTIONS
parameter_error = 1
no_values_found = 2
OTHERS = 3.
IF sy-subrc = 0.
ENDIF.
GET CURSOR LINE l_linea.*
READ TABLE itab_bsik_v INDEX l_linea.*
read table return_tab into l_wa_return
with key fieldname = 'XBLNR'.
if sy-subrc eq 0.
l_XBLNR = l_wa_return-fieldval.
endif.
read table return_tab into l_wa_return
with key fieldname = 'BUZEI'.
if sy-subrc eq 0.
l_BUZEI = l_wa_return-fieldval.
endif.
DATA: l_stepl LIKE sy-stepl,
l_indx LIKE sy-stepl.
DATA: dynpfields LIKE dynpread OCCURS 5 WITH HEADER LINE.
Adjust for scroling within table control
CALL FUNCTION 'DYNP_GET_STEPL'
IMPORTING
povstepl = l_stepl
EXCEPTIONS
stepl_not_found = 0
OTHERS = 0.
l_indx = grid-top_line + l_stepl - 1.
REFRESH dynpfields.
CLEAR dynpfields.
dynpfields-fieldname = 'ITAB-FACTURA'.
dynpfields-fieldvalue = l_XBLNR.
dynpfields-stepl = l_stepl.
APPEND dynpfields.
dynpfields-fieldname = 'ITAB-BUZEI'.
dynpfields-fieldvalue = l_BUZEI.
dynpfields-stepl = l_stepl.
APPEND dynpfields.
CALL FUNCTION 'DYNP_VALUES_UPDATE'
EXPORTING
dyname = sy-repid "Program name
dynumb = sy-dynnr "Screen number
TABLES
dynpfields = dynpfields
EXCEPTIONS
OTHERS = 0. -
ALV-Grid - Get cursor position
Hi,
I replaced the table control in my dynpro with a custom container and placed an ALV-Grid in there.
So, my problem is now to get the cursor position when the user double clicks at the text in a cell.
It´s important for me to know at which position at the text he double clicked.
e.g.:
| Nr |Text |
|----|-------|
| 1|Hello |
| 2|Test |
The user clicks double between the 'e' and 's' at line 2 ('Test').
I need following information:
line 2
column 2
offset 3 (position, where the user clicked)
When I'm using the table control, it's no problem with
the ABAP-statement 'GET CURSOR' and property 'OFFSET',
but I didn't find a method with the same result for ALV-Grid.
Maybe you know a possibility?
Thank you.
Regards from Germanyhello,
go through these links.these links will surely solve your problem.just have a luk.
Get the cursor position row number in a table control.
upper is for table-ctrl
if you are working with alv.you can achieve it by.
call method cl_gui_control=>set_focus
exporting control = w_grid.
w_grid is ur gid name.
go through this link also
Get cursor position from grid
regards,
Shweta
Edited by: Shweta Joon on Aug 20, 2009 1:15 PM -
What is control tables in abap hr?what is the purpose?
what is control tables in abap hr?what is the purpose?
These are the screen elements used to display tabular data they can be called
as screen tables( like STEP LOOP).To use table control we have to create it on the screen using SCREEN PAINTER(SE51) and declare a control variable of TYPE TABLEVIEW using CONTROLS statement in the ABAP program. We have to use LOOP .. ENDLOOP statement in both PBO and PAI with or without AT int_table parameter. IF AT int_table parameter is not used than we have to place a MODULE call between the LOOP...ENDLOOP statement to fill the screen table rows from the ABAP program in PBO and program our own scrolling functions
using OK_CODE field.
Having a parallel loop(at screen table rows & int table rows) by using parameter
AT int_table makes the ABAP code simple.
A special structure of type CXTAB_CONTROL is used to set/get various
attributes of table control at runtime like CURRENT_LINE ,TOP_LINE.
ABAP declaration
CONTROLS: tab_con TYPE TABLEVIEW USING SCREEN nnnn
Here tab_con is the same name we used in screen for the table control.
This ABAP statement will declare a control variable that will be used to access
the table control , and set it's various attributes like number of fixed columns(tab_con-FIXED_COLS) ,total number of records it will display(tab_con-LINES).It is of type CXTAB_CONTROL and is a deep structure(structure containing structures).
REFRESH CONTROL tab_con FROM SCREEN nnnn
This ABAP statement will initialize the table control on the screen nnnn to its initial values.
PBO processingI
n PBO we have to use the screen LOOP ...ENDLOOP statement , with or without
intenal table.
LOOP WITH CONTROL tab_con.
MODULE fill_tab_con.
ENDLOOP.
Here a module should be called between the loop endloop statement to transfer
data from th ABAP program to the screen table through a structure.This module
should use the CURRENT_LINE attribute of the table control variable to get the
current screen table record index to read the data from the internal table into a work area.
e.g.
READ TABLE int_table INDEX tab_con-CURRENT_LINE
The record read will be placed in the header line of the internal table and will be available to the similarly named screen fields or if these are different it can be written explicitly. e.g.
screen_field_name = int_table-field_name
LOOP AT int_table INTO workarea WITH CONTROL tab_con CURSOR i FROM
n1 TO n2.
ENDLOOP.
Here the module call is not required to fill the screen table.The CURSOR parameter is a integer of type I indicating which absolute internal table line
should be the first to display on the table control .FROM n1 TO n2 can be used
to restrict the starting line and ending line number of the internal table , they are of type SY-TABIX.
In both cases before the LOOP statement a module should be called which
is generally for setting of status ,in which we should fill the LINES attribute
(tab_con-LINES ) of the control with the total number of internal table records,doing this ensures correct and automatic scrolling.
The ABAP statement DESCRIBE TABLE int_table LINES lines can be used
to get the total lines in an int table.
PAI Processing
We have to use LOOP ... ENDLOOP in PAI so that data can transfer fro table control to ABAP program. If we want to write changes to the data we should
call a module between the LOOP ... ENDLOOP. The MODULE call to process user commands (SY-UCOM) should be called after the ENDLOOP statement.
e.g.
PROCESS AFTER INPUT
MODULE mod AT EXIT-COMMAND.
LOOP AT itab_table or LOOP "depending on whether we are using AT int_table
MODULE modify_int_table.
ENDLOOP.
MODULE user_command.
In the MODULE call modify_int_table we can use
MODIFY int_table FROM workarea INDEX tab_con-CURRENT_LINE
or we can use
int_table-field_name = screen_field_name.
Thanks
Please Reward points if helpful.
Edited by: Richa Khosla on Mar 28, 2008 7:38 AM -
Search and move in a control table
Hi guys,
I create a control table that reads a lot of data, so i need to implement a search function.
the easy part is that i can search it in the internal table, my problem is that i need to move the cursor to that position. who do i scroll it?
its dynpro.
any ideas?Hi Javier, Please check this function "SCROLLING_IN_TABLE" and the next code that is generated by wizard
*& Form COMPUTE_SCROLLING_IN_TC
* text
* -->P_TC_NAME name of tablecontrol
* -->P_OK ok code
FORM COMPUTE_SCROLLING_IN_TC USING P_TC_NAME
P_OK.
*&SPWIZARD: BEGIN OF LOCAL DATA----------------------------------------*
DATA L_TC_NEW_TOP_LINE TYPE I.
DATA L_TC_NAME LIKE FELD-NAME.
DATA L_TC_LINES_NAME LIKE FELD-NAME.
DATA L_TC_FIELD_NAME LIKE FELD-NAME.
FIELD-SYMBOLS <TC> TYPE cxtab_control.
FIELD-SYMBOLS <LINES> TYPE I.
*&SPWIZARD: END OF LOCAL DATA------------------------------------------*
ASSIGN (P_TC_NAME) TO <TC>.
*&SPWIZARD: get looplines of TableControl *
CONCATENATE 'G_' P_TC_NAME '_LINES' INTO L_TC_LINES_NAME.
ASSIGN (L_TC_LINES_NAME) TO <LINES>.
*&SPWIZARD: is no line filled? *
IF <TC>-LINES = 0.
*&SPWIZARD: yes, ... *
L_TC_NEW_TOP_LINE = 1.
ELSE.
*&SPWIZARD: no, ... *
CALL FUNCTION 'SCROLLING_IN_TABLE'
EXPORTING
ENTRY_ACT = <TC>-TOP_LINE
ENTRY_FROM = 1
ENTRY_TO = <TC>-LINES
LAST_PAGE_FULL = 'X'
LOOPS = <LINES>
OK_CODE = P_OK
OVERLAPPING = 'X'
IMPORTING
ENTRY_NEW = L_TC_NEW_TOP_LINE
EXCEPTIONS
* NO_ENTRY_OR_PAGE_ACT = 01
* NO_ENTRY_TO = 02
* NO_OK_CODE_OR_PAGE_GO = 03
OTHERS = 0.
ENDIF.
*&SPWIZARD: get actual tc and column *
GET CURSOR FIELD L_TC_FIELD_NAME
AREA L_TC_NAME.
IF SYST-SUBRC = 0.
IF L_TC_NAME = P_TC_NAME.
*&SPWIZARD: et actual column *
SET CURSOR FIELD L_TC_FIELD_NAME LINE 1.
ENDIF.
ENDIF.
*&SPWIZARD: set the new top line *
<TC>-TOP_LINE = L_TC_NEW_TOP_LINE.
ENDFORM. " COMPUTE_SCROLLING_IN_TC
Regards
David N -
At line Selection & get cursor field
Hi friends,
Could any one of u please explain about<b> at line selection</b> and <b>GET CURSOR FIELD</b> ( GET CURSOR FIELD FNAM VALUE FVAL) with sample program.
Jai.Hello,
AT - Events in lists
Variants:
1. AT LINE-SELECTION.
2. AT USER-COMMAND.
3. AT PFn.
Variant 1
AT LINE-SELECTION.
Effect
Event in interactive reporting
This event is processed whenever the user chooses a valid line in the list (i.e. a line generated by statements such as WRITE,ULINE, or SKIP) with the cursor and presses the function key which has the function PICK in the interface definition. This should normally be the function key F2, because it has the same effect as double-clicking the mouse, or clicking once in the case of a hotspot.
The processing for the event AT LINE-SELECTION usually generates further list output (the details list) which completely covers the current list display. If you want the current list display to remain visible (to aid user orientation), you can do this with the key word WINDOW.
In most cases, the information from the selected line is used to retrieve more comprehensive information by direct reading. When displaying the original list, you store the key terms needed for this in the HIDE area of the output line.
Note
You can choose a line and start new processing even in the details lists.
The following system fields are useful for orientation purposes, since their values change with each interactive event executed.
SY-LSIND
Index of list created by current event (basic list = 0, 1st details list = 1, ...)
SY-PFKEY
Status of displayed list (SET PF-STATUS)
SY-LISEL
Contents of selected line
SY-LILLI
Absolute number of this line in the displayed list
SY-LISTI
Index of this list - usually SY-LSIND - 1 (READ LINE)
SY-CUROW
Last cursor position: Line in window
SY-CUCOL
Last cursor position: Column in window (GET CURSOR)
SY-CPAGE
1st displayed page of displayed list
SY-STARO
1st displayed line of this page of displayed list
SY-STACO
1st displayed column of displayed list (SCROLL LIST)
The system field SY-LSIND defines the line selection level (basic list: SY-LSIND = 0).
System field for interactive reporting are also contained in the System Fields for Lists documentation.
Example
DATA TEXT(20).
START-OF-SELECTION.
PERFORM WRITE_AND_HIDE USING SPACE SPACE.
AT LINE-SELECTION.
CASE TEXT.
WHEN 'List index'.
PERFORM WRITE_AND_HIDE USING 'X' SPACE.
WHEN 'User command'.
PERFORM WRITE_AND_HIDE USING SPACE 'X'.
WHEN OTHERS.
SUBTRACT 2 FROM SY-LSIND.
PERFORM WRITE_AND_HIDE USING SPACE SPACE.
ENDCASE.
CLEAR TEXT.
FORM WRITE_AND_HIDE USING P_FLAG_LSIND P_FLAG_UCOMM.
WRITE / 'SY-LSIND:'.
PERFORM WRITE_WITH_COLOR USING SY-LSIND P_FLAG_LSIND.
TEXT = 'List index'.
HIDE TEXT.
WRITE / 'SY-UCOMM:'.
PERFORM WRITE_WITH_COLOR USING SY-UCOMM P_FLAG_UCOMM.
TEXT = 'User command'.
HIDE TEXT.
IF SY-LSIND > 0.
WRITE / 'PICK here to go back one list level'.
ENDIF.
ENDFORM.
FORM WRITE_WITH_COLOR USING P_VALUE
P_FLAG_POSITIVE.
IF P_FLAG_POSITIVE = SPACE.
WRITE P_VALUE COLOR COL_NORMAL.
ELSE.
WRITE P_VALUE COLOR COL_POSITIVE.
ENDIF.
ENDFORM.
Depending on whether you choose the line at SY-LSIND or SY-UCOMM, the next details list contains the corresponding value with the color "positive". If the line is chosen without HIDE information, the list level is reduced.
Variant 2
AT USER-COMMAND.
Effect
Event in interactive reporting
This event is executed whenever the user presses a function key in the list or makes an entry in the command field.
Some functions are executed directly by the system and thus cannot be processed by programs. These include:
PICK
See variant AT LINE-SELECTION
PFn
See variant AT PFn
System command
System command
PRI
Print
BACK
Back
RW
Cancel
P...
Scroll function (e.g.: P+ , P- , PP+3, PS-- etc.)
Instead of this functions, you can use the SCROLL statement in programs.
Since many of these system functions begin with "P", you should avoid using this letter to start your own function codes.
Otherwise, the effect is as for AT LINE-SELECTION; also, the current function code is stored in the system field SY-UCOMM.
Example
DATA: NUMBER1 TYPE I VALUE 20,
NUMBER2 TYPE I VALUE 5,
RESULT TYPE I.
START-OF-SELECTION.
WRITE: / NUMBER1, '?', NUMBER2.
AT USER-COMMAND.
CASE SY-UCOMM.
WHEN 'ADD'.
RESULT = NUMBER1 + NUMBER2.
WHEN 'SUBT'.
RESULT = NUMBER1 - NUMBER2.
WHEN 'MULT'.
RESULT = NUMBER1 * NUMBER2.
WHEN 'DIVI'.
RESULT = NUMBER1 / NUMBER2.
WHEN OTHERS.
WRITE 'Unknown function code'.
EXIT.
ENDCASE.
WRITE: / 'Result:', RESULT.
After entry of a function code, the appropriate processing is performed under the event AT USER-COMMAND and the result is displayed in the details list.
Variant 3
AT PFn.
Effect
Event in interactive reporting
Here, n stands for a numeric value between 0 and 99.
This event is executed whenever the user presses a function key that contains the function code PFn in the interface definition. The default status for lists contains some of these functions.
Otherwise, the effect is as for the variant AT LINE-SELECTION. The cursor can be on any line.
Notes
To ensure that the chosen function is executed only for valid lines, you can check the current HIDE information.
This variant should be used only for test or prototyping purposes, since the default status is not normally used. Instead, you should set a program-specific status with SET PF-STATUS. This should not contain any function codes beginning with "PF".
Example
DATA NUMBER LIKE SY-INDEX.
START-OF-SELECTION.
DO 9 TIMES.
WRITE: / 'Row', (2) SY-INDEX.
NUMBER = SY-INDEX.
HIDE NUMBER.
ENDDO.
AT PF8.
CHECK NOT NUMBER IS INITIAL.
WRITE: / 'Cursor was in row', (2) NUMBER.
CLEAR NUMBER.
Additional help
User Action on Detail Lists
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
Vasanth -
How to call 'GET CURSOR' for another screen?
Hi Folks,
I'm displaying a modeless dialog box. It's basically a utility to enter predefined texts such as "Dear SIR," into a table control in the main screen.
Since this dialog box is modeless, the user can move the cursor on the <b>main</b> screen, after the dialog has been opened.
When user clicks "Add text" button, the dialog box is calling a callback form which notifies the main program & screen that new text should be inserted, but <u>where</u> should the new text go? We need the new cursor position after it was changed by the user!
When calling 'GET CURSOR' in the callback form, the result is failure. Also sy-curow sy-cucol are equal to 0.
Any ideas?Hi Ofer,
In your scenario, is it possible for you to use a modal dialog box? Using a modeless dialog box is not generally preferred, because it makes things a little confusing to the user. Also it is somewhat a little more complicated for the developer for precisely the same problems that you are facing.
Regards,
Anand Mandalika. -
To get selected cell info in table for WDA.
i'm developping in netweaver2004s.
a view has a table and a button.
another view has input fields.
i want to get cell info(selected field name not value)
so i use that info in another view.
i want to know same command 'GET CURSOR' in WDA.
please let me know that method.Hi,
You can specify the importing parameter ID as type string in the action handler of the button. It will contain the ID of the button.
Best regards,
Thomas -
GETTING ROW COUNTS OF ALL TABLES AT A TIME
Is there any column in any Data dictionary table which gives the row counts for particular table..
My scenario is...i need to get row counts of some 100 tables in our database...
instead of doing select count(*) for each table....is there any way i can do it?
similary How to get column counts for each table..in database .For example
Employee table has 3 columns...empid,empname,deptno....i want count(empid),
count(empname),count(deptno) ...is there any easy way for finding all column counts of each table in data base? is it possible?Why does "select count(mgr) from emp" return null and not 13?Good question ;)
Seems that xml generation in principle can't handle »counting nulls«:
SQL> select xmltype(cursor(select null c from dual)) x from dual
X
<?xml version="1.0"?>
<ROWSET>
<ROW>
</ROW>
</ROWSET>
1 row selected.
SQL> select cursor(select count(null) c from dual) x from dual
Cur
0
1 row selected.
SQL> select xmltype(cursor(select count(null) c from dual)) x from dual
select xmltype(cursor(select count(null) c from dual)) x from dual
Error at line 1
ORA-31011: XML parsing failed
ORA-19202: Error occurred in XML processing
LPX-00229: input source is empty
Error at line 0
ORA-06512: at "SYS.XMLTYPE", line 0
ORA-06512: at line 1
but
SQL> select xmltype(cursor(select count(1) c from dual)) x from dual
X
<?xml version="1.0"?>
<ROWSET>
<ROW>
<C>1</C>
</ROW>
</ROWSET>
1 row selected.Looks like a bug to me ... -
Cannot see data in SAP.Web.UI.Controls.Table
Hi,I have created a portal project and dragged a sap table into the design area. then i call a webservice and bind the resulting dataset to the table. the dataset seems to bind, since i can see there are the right number of pages in the table, but i cannot see any of the data. all the rows are blank. am i treating the ascx file correctly? i deploy and browse to test it.
this is the code in the aspx:
<%@ Register TagPrefix="sap" Namespace="SAP.Web.UI.Controls" Assembly="SAP.Web, Version=1.2.0.0, Culture=neutral, PublicKeyToken=50436dca5c7f7d23" %>
<%@ Control language="vb" Codebehind="PortalComponent1.ascx.vb" AutoEventWireup="false" Inherits="pdkdemo2.PortalComponent1" targetSchema="http://schemas.microsoft.com/intellisense/ie5" %>
<!%@ PortalComponent name="PortalComponent1" %>
<LINK href="C:\Program Files\SAP\SAP Portal Development Kit for .NET 1.0\Controls\ur\ur_design.css"
type="text/css" rel="stylesheet">
<body class="prtlBody">
<sap:Table id="Table1" runat="server">
<sap:Caption Text="Table" ID="Caption2"></sap:Caption>
<sap:TableRow ID="Table1_ItemTemplate">
<sap:TableCell ID="TableCell4" Title="Column1">
<sap:TextView ID="TextView4"></sap:TextView>
</sap:TableCell>
<sap:TableCell ID="TableCell5" Title="Column2">
<sap:TextView ID="TextView5"></sap:TextView>
</sap:TableCell>
<sap:TableCell ID="TableCell6" Title="Column3">
<sap:TextView ID="TextView6"></sap:TextView>
</sap:TableCell>
</sap:TableRow>
</sap:Table>
</body>
and this is the code behind:
Imports System
Imports System.Collections
Imports System.ComponentModel
Imports System.Data
Imports System.Drawing
Imports System.Web
Imports System.Web.UI
Imports SAP.Portal.Web.UI
Imports SAP.UI
Imports SAP.Web.UI.Controls
Public class PortalComponent1
Inherits SAP.Portal.Web.UI.PortalComponent
Protected WithEvents Table1 As SAP.Web.UI.Controls.Table
Protected WithEvents Caption1 As SAP.Web.UI.Controls.Caption
Protected WithEvents Table1_ItemTemplate As SAP.Web.UI.Controls.TableRow
Protected WithEvents TableCell1 As SAP.Web.UI.Controls.TableCell
Protected WithEvents TextView1 As SAP.Web.UI.Controls.TextView
Protected WithEvents TableCell2 As SAP.Web.UI.Controls.TableCell
Protected WithEvents TextView2 As SAP.Web.UI.Controls.TextView
Protected WithEvents TableCell3 As SAP.Web.UI.Controls.TableCell
Protected WithEvents Caption2 As SAP.Web.UI.Controls.Caption
Protected WithEvents TableCell4 As SAP.Web.UI.Controls.TableCell
Protected WithEvents TextView4 As SAP.Web.UI.Controls.TextView
Protected WithEvents TableCell5 As SAP.Web.UI.Controls.TableCell
Protected WithEvents TextView5 As SAP.Web.UI.Controls.TextView
Protected WithEvents TableCell6 As SAP.Web.UI.Controls.TableCell
Protected WithEvents TextView6 As SAP.Web.UI.Controls.TextView
Protected WithEvents TextView3 As SAP.Web.UI.Controls.TextView
Private Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim proxy As New secblrnd.Service1
Dim ds As DataSet
ds = proxy.GetData("U020_EQUIP", "ALL", "NO", 0, "MOODLET1", "MOODLET1")
Table1.DataSource = ds
Table1.DataBind()
End Sub
#Region "Web Form Designer generated code"
Protected Overrides Sub OnInit(ByVal e As EventArgs)
' CODEGEN: This call is required by the ASP.NET Web Form Designer.
InitializeComponent()
MyBase.OnInit(e)
End Sub
' Required method for Designer support - do not modify
' the contents of this method with the code editor.
Private Sub InitializeComponent()
End Sub
#End Region
End class
any assistance would be highly appreciated.Hi,
The problem is that the SAP table doesn't support this kind of "dynamic binding" at the moment. The SAP table can contain any one of several controls in each cell, and these controls have several possible properties to bind to. So currently you have to "tell" the table what you want to bind to.
You have several options:
1. The easiest option, if you can create a typed dataset in design-time, according to what your webservice returns, then do that... and then put an instance of it on your portal component, and bind your table to that typed dataset (using the designer property grid). This should create a default ItemTemplate with all textViews in the cells, and the texts will be bound to the columns.
2. Write code in ItemCreated Event handler of the table. This event will be raised for each row in the DS. There you can tell the cells to get the data from the content. Remember that you'd have to create the cells according to the number of columns and set the content of each cell to be what control you want (like TextView) and then fill the properties of that control.
3. If you know the Data structure, but don't want to or can't create a typed DataSet - First define the columns using the designer (right click the table, select "edit columns"). Then in the event handler (from "2") just set the property "text" of each TextView which is in the content of each cell (use the Cell's property "TableCellContent" to get to the TextView control)
4. Don't use databinding and create the table contents completely manually (See here -
How to modify cells in a table?)
One last thing, here's a link to some more explanations about DataBinding in SAP controls:
https://media.sdn.sap.com/html/submitted_docs/PDK_for_dotNET_10/Programming%20with%20PDK%20for%20.NET/SAP%20NetWeaver%20.NET%20Controls/Data%20Binding/Complex%20Data%20Binding.htm
If you choose a solution and need more help, just ask.
Regards,
Ofer
Maybe you are looking for
-
Problem with installing Paint shop Pro photo X2 on with Vista
Trying to install Paint shop photo x2 on my note book but at the end of the installation it freezes and there seems to be some problem with "registering"... Corel (supplier of paint shop) now advised me to change some drivers but the links I received
-
I would like to be able to run OSX 7 on my wife's MacBook Pro , as I have a new printer which required OSX7 or above. Her Macbook Pro is Model MacBook Pro 5,5 2,26GHz speed and 2GB memory. When I look for software updates I get the message that soft
-
I recently ran an updatedafter being prompted multiple times. Now I find there are a number of songs that I cannot sync to my iPhone. Some are songs purchased from iTunes. Is there anyway to remedy this? I'd really prefer not to have to repurchase
-
About acrobat professional 8.0
acrobat professional 8.0 can't work with office 2007 whant can i do?
-
On my iPad Mini screen, since I have bought it, there has been one small black dot in the middle of the screen (I'm presuming a dead pixel because its absolutely always there). And I'm not too bothered about it but if there was something I could do w