Cursor positioning in table control: marking content of a field

Hello everybody,
I use a table-control for data input. For fast data input, my customers need dynamic positioning of the cursor. I'm using the set cursor field ... line ... statement and it works fine, except for one problem with a large text-field:
Is it possible to set the cursor in a field plus mark all the content of the field? The behaviour, i'm looking for is that any input in the field will replace the existing content. Is there any other option?
Thank you for any suggestions, regards, Kathrin!

So you want dynamic cursor positioning within a table control. Take a look at FM SCROLLING_IN_TABLE and demo program DEMO_DYNPRO_TABCONT_LOOP. If this does not address your requirements the you can do it manually as follows:
For example, your internal table has 30 rows, your table control displays 10 rows (value of sy-loopc) at one time. The value of <tabctrl>-top_line contains 11, meaning you are at the second page of table control. Your cursor is at 12th row and now on pressing ENTER, you want the cursor to be positioned at 13th row.
In your PAI, issue the statement GET CURSOR LINE <lineno>. This will give you the current cursor position in the table control with reference to the top row currently displayed. So the value of <linno> will be 2.
In your PBO, calculate the next line no to position your cursor into. This can be done by the formula:
  next_line = <tabctrl>-TOP_LINE + <linno> - 1.
Then issue the statement SET CURSOR FIELD <field_name> LINE <next_line>.
Hope this helps.
Regards
Message was edited by: Shehryar Khan

Similar Messages

  • Set cursor position within table control while scrolling

    hi,
    Anybody can guide me how to set the cursor with in table control while scrolling down,normally it is going to first input filed.
    Thanks and Regards,
    palani.

    Hi Palani,
    Could you please share with me what all you have done regarding get and set cursor. I am facing similar problem where
    I have made a Z Table Control where i have given vertical and horizontal scrolling . Now when I scroll and try to select a row, then ZTABLE_CONTROL-CURRENT_LINE fetches line number not from the top, it fetches from the current top of ztablecontrol.
    It is onlyy changing the value on scrolling, if i do not scroll table control then value is coming correct.
    My requirement is whenever i select any row of ZTABLE CONTROL i need to get the curent line number from top. Please guide me what should i do.
    Early reply will be rewarded.
    Thanks.

  • To handle cursor position in table control while using insert initial line

    hi,
          I have a requirement to handle cursor position in my table control in which i am using insert initial line by incrementing the index. Now i am handling the cursor position by using set cursor but after 14 records it is going to the first field of the screen. My table control length is 14 records.
          How to handle this, please reply me if anyone know.
    thanks & regards,
        sekhar.

    hi,
             I need to page down the page and then want to set cursor position but for this system command i am getting space for every command. Page down and cursor down or enter every thing it is taking as space. So for this how can i handle it.
    thanks & regards,
        sekhar.

  • How to delete the row in table control with respect to one field in module pool programming?

    Hi,
    Can I know the way to delete the row in table control with respect to one field in module pool programming
    Regards
    Darshan MS

    HI,
    I want to delete the row after the display of table control. I have created push button as delete row. If I click on this push button, the selected row should get deleted.
    I have written this code,
    module USER_COMMAND_9000 input.
    DATA OK_CODE TYPE SY-UCOMM.
    OK_CODE = SY-UCOMM.
    CASE OK_CODE.
         WHEN 'DELETE'.
            LOOP AT lt_source INTO ls_source WHERE mark = 'X'.
                APPEND LS_SOURCE TO LT_RESTORE.
                DELETE TABLE LT_SOURCE FROM LS_SOURCE.
                SOURCE-LINES = SOURCE-LINES - 1.
            ENDLOOP.
    But I'm unable to delete the selected rows, It is getting deleted the last rows eventhough I select the other row.
    So I thought of doing with respect to the field.

  • Can not deselect edit position in table control

    A table control has a property called editpos.  This property returns the cell cordinates for the cell that the use is editing and is writeable.  The property correctly returns -1 and -2 values depending if a header is selected or nothing is selected, however, if a -1 or -2 is written to the property it just selects cell 0,0.  Is this behavior a bug?
    I wanted to input -2,-2 to deselect the current cell that is being edited.  Anyone have another idea on how to achieve this?

    Thank you for the reply.  Actually, I am not interested in the table data.  I am only interested in the current edit position within the table control.  The table property editpos states
    Edit Position Property
    Property of Table.
    The row-column pair index of the current text entry. Values of (0,0) indicate the top-left text entry. A value of –1 indicates the row or column header. Values of (–2, –2) indicate that no edits are being made to the text of the control. This property does not set text focus on a control that does not already have text focus.
    Since the property returns cordinates for selected column headers (-1,x), row headers (x,-1) or no selection (-2,-2).  I was surprised if I tried to write a value of -1 or -2 to either the row or colum it would act as if I had typed a 0.  For example, (-2,-2) would select cell (0,0) and (-1,4) would select cell (0,4).  This behavior seemed like a bug to me or should at least be noted in the property help file.
    I did manage to find a solution for my particular problem however.  Since I am not trying to move to the header row or column and just wanted to deselect the current edit position I just set KeyFocus to false.

  • Table control : Need to change Single field as non editable

    Hi Experts,
                    Plz help me out. In a table control there r 7 fields and only one field is editable. When i change the status of a record as delete in tat table control, only the deleted record (all fields)should become non-editable. Is it possible? Pls suggest.
    Regards,
    J. Sriram.

    Hi,
    In PBO of your screen
    you should be using a step loop like this :
    CONTROLS control1 TYPE TABLEVIEW USING SCREEN 100.
    LOOP AT itab WITH CONTROL control1.
    ENDLOOP.
    Where the control1 is the tableview control defined in your program
    and placed on your screen.
    Put a second loop on screen inside this loop ant set the related attribute :
    LOOP AT itab WITH CONTROL control1.
    LOOP AT SCREEN.
    IF SCREEN-NAME = 'COLUMN1'.
    SCREEN-INPUT = 0.
    MODIFY SCREEN.
    ENDIF.
    ENDLOOP.
    ENDLOOP.
    So you can set cells editable or non-editable
    and you can filter it which record & which field..

  • Search Help on Table Control - Fill more than one field in the table?

    Hey everyone,
    I have built a screen with a Table Control on it... the fields of the table control are linked to an internal table...  The internal table has the line type of a structure I've defined in the data dictionary.  Within that structure in the data dictionary, I've linked some fields to search helps (For example, a MATNR and CUSTOMER search help)...  I've defined in the structure definition which fields from the search help are to be returned to which fields in the structure.
    The problem is, even though I have the search help set to export both the customer number and location when using the search help on the customer field, it still does not fill the location field within the table.  Is this a limitation of using search helps within table controls?
    I'm also finding that by defining the search help through the structure, instead of directly within the screen, the search help round button does not show up on the field, yet I can still press F4 to bring up the search help.  Is there a reason why it's not showing the search help clickable button even though it works fine using F4?
    For doing search helps in Table Controls, is it better to just build the search help, attach it directly to the field in the table, and then after the user picks the single field, use the PAI to run a select and fill the rest of the fields required?
    Thanks,
    Dallas

    Hi Dallas,
    (1)
    What  i understood is that you added a search help by defining it in the internal table type for a field customer number..in the search help you have 2 fields customer number and location...user press the search help ..then you need to fill 2 different fields or 1 field?
    if you need to fill the customer location or location (only one) then you need to set the "import" in the search help for whichever is required.....
    if you need to fill 2 or more different fields..then you can use the technique you have mentioned last , to do a select in PAI and fill the fields....but this you can use if the combination for the fields is unique...eg: u have customer number and location..if customer X can be mapped to location X and location Y..when a select statement is done there are 2 options..so in such cases it is better to leave the option to the user otherwise if there is a clear mapping like customer X can be mapped only to location X then you can use the select..
    (2)
    usually when you define it as a type in the internal table the icon doesn't show up..but you can do alternative like mentioned..go to the table,find the search help for the required field if present or create a new one if required and place the search help mentioned in the screen itself..so as to see the icon...sometimes users are adamant that they need the search help icon to be seen..so it depends on if your user
    (3)
    as in the example of customer number and location mentioned we can provide them different search helps and do the needful processing in PAI to fill the fields
    Table controls may be used for different purposes and requirements....even a checkbox,push button can be placed as a field in table control and used,but yes most of the time requirements are like what is mentioned in your case...
    Regards
    Byju

  • How to set column attributes in table control?

    I have the following requirement to build a table by using table control:
    if content of col 1 = 'Y', enable input for col 2 for that line only.
    if content of col 1 = 'N', disable input for col 2 for that line only.
    So the input attribute for col 2 in each line can be different.
    How can I achieve this?
    I have tried using loop at screen or loop at tablecontrol-cols into wa_cols statements,
    but these will change the entire column attributes to either on or off, and not on individual line.
    Instead of changing the COLUMN attributes, I think I should change the CELL attributes. 
    What is the syntax for that, is there something like tablecontrol-field?
    Thanks for any help in advance.

    I still not able to get the field attributes set on individual lines.
    These are my codes, can you help again.
    PROCESS BEFORE OUTPUT.
      MODULE pbo_0200.
      MODULE zitem_change_tc_attr.
      LOOP AT   lt_asset_item
           INTO ls_asset_item
           WITH CONTROL zitem
           CURSOR zitem-current_line.
        MODULE ZITEM_CHANGE_FIELD_ATTR.
        MODULE zitem_get_lines.
      ENDLOOP.
    MODULE zitem_change_field_attr OUTPUT.
    loop at screen.
      if ls_asset_item-replace_asset = 'X'.
         if screen-group1 EQ 'FR4'.        "these are the columns I want to turn input ON or OFF.
          screen-input = '1'.
          modify screen.
         endif.
      endif.
    endloop.
    Endmodule.
    At debug mode, the screen-input did change to '1'.  Can I check the return code of the MODIFY SCREEN statement?
    I tried to initialize the colums to be output only at screen definition, but it still doesn't help.
    I don't think I have to do anything at the PAI event.
    PROCESS AFTER INPUT.
    MODULE save_cursor_position.
      LOOP AT lt_asset_item.
       FIELD ls_asset_item-replace_asset
         MODULE get_replace_asset ON REQUEST.
        CHAIN.
         FIELD LS_ASSET_ITEM-REPLACE_ASSET.
         FIELD ls_asset_item-replace_cost.
          MODULE zitem_modify ON CHAIN-REQUEST.
        ENDCHAIN.
        FIELD ls_asset_item-mark
          MODULE zitem_mark ON REQUEST.
      ENDLOOP.
      MODULE zitem_user_command.
    Thanks again.

  • TABLE CONTROL IN SUBSCREEN

    Hi experts,
    In module pool programming in main screen i have added one sub screen.in subscreen i added one table control.my problem is i am not able to get cursor position in table controland how to disable the records in table control.how to enable one record in table control.please any body help me
    thanks in advance.
    tharangini.

    hi,
    set cursor field 'ITABL-MAKTX' line tabcon-top_line.
    tabcon is table control name.

  • Ok-code to scroll down in a table control on batch input

    Hello,
    I'm trying to create a batch input session for transaction VA02 (Change  sales  order) :
    I need to go scroll down in the table control of the screen (item -> Conditions) 3 times to delete the a line; In the batch input (SHDB), i go scroll down by clicking on the scroll bar of the table control, mark the line of the page and delete it.
    The recording show me the ok-code /00 to scroll down (with BDC_CURSOR in the second line), but in the program it don't work, the ok do nothing the 3 times and mark the incorrect line.
    Can anyone tell an idea of what is the correct ok-code to scroll down?
    Thanks in advance
    Alvaro
    PD:  My SAP system is an ECC 6.0

    Hi Alvaro
    One time i had to do similar work for Creation of General Task List in PM module and this is how i did it
                             'X'      'SAPLCMDI'             '3500',
                             ' '      'BDC_CURSOR'          'RIHSTPX-DISP(01)',
                             ' '      'BDC_OKCODE'          '=P+',
                             ' '      'RIHSTPX-IDNRK(01)'    itab-idnrk,
                             ' '      'RIHSTPX-MENGE(01)'    itab-menge,
                             ' '      'RIHSTPX-MEINS(01)'    itab-meins,
                             ' '      'RIHSTPX-DISP(01)'     itab-disp.
    I had to select line 1 hence you can see the position number ( 01 ) in the field name. As you can see based on this positioning you can select the appropriate line and make modifications as you like and also use okcode of  '=P+' to scroll done. Hope this  helps. Reward if appropriate.
    Best Regards
    Sid Arora

  • Exact cell in list and Table Control

    Hi,
    Is there someone who knows,
    how to to get exact cell from lists (START-OF-SELECTION)
    or from Table Control.
    For example:
    In list I wrtie:
    number name date
    1234    | es    | 10/07/07
    and now if I click for example on "es" now there should window apear about name "es"
    the same with Table Control.
    I know that get selected line is not the problem
    but how to get column ???
    Please it's very important
    Best regards,
    Greg.

    hi,
    You can retrieve information either about the current field or the current line.
    For field information, use this syntax:
    GET CURSOR FIELD <f> [OFFSET <off>]
                                          [LINE <lin>]
                                         [VALUE <val>]
                                         [LENGTH <len>].
    This statement transfers the name of the field 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 system transports the names of global variables, constants, field symbols, or reference parameters of subroutines. For literals, local fields, and VALUE parameters of subroutines, the system sets SY-SUBRC to 0, but transfers SPACE as the name.
    The options have the following effects:
    OFFSET <off>
    The field <off> contains the position of the cursor within the field. If the cursor is on the first column, <off> = 0.
    LINE <lin>
    The field <lin> contains the number of the list line on which the cursor is positioned (SY-LILLI).
    <b>VALUE <val></b>
    The field <val> contains the character string output representation of the field on which the cursor is positioned. The representation includes formatting characters.
    LENGTH <len>
    The field <len> contains the output length of the field on which the cursor is positioned.
    <b>you try with this logic.</b>
    **define variables for holding field name and field values
    DATA: fieldname type n,
              fieldval      type n.
    <b>GET CURSOR FIELD  fieldname  VALUE fieldval </b>
    now the fieldname and fieldval variables hold the values which was selected by user based on cursor position.
    the variable declarations based on your selected fields.
    regards,
    Ashok Reddy

  • Data retrieve from one table control to another table control

    Hi all,
    I had an requirement like to create Two table controls.
    for first Table control i had an sel field defined as 'MARK'.
    when i check the row in the first table control think it  is header data for sales order .
    all the item details have to retrieve in the second table control.
    This is my requirement, i am not able to trigger when selecting the row in table control.
    will anybody had an experience like this.
    Regards,
    Madhavi

    Hi Madhavi,
    If  we need the case to display header and item as mentioned in 2 table controls....
    we can display in table control 2/item only (the line items of the one selected in the table control 1 or the header )...so ,at a time we need to display line items for only 1 header ....
    so ...first disable the selections/multiple selections to disable the row selector
    We have already declared a field type C to capture the value for the field selector...so we can convert this field to a radio button and then assign a function code to the radio button at screen level
    Whenever you click on the radio button ..immediately the function code is triggered..then in PAI ..we can check and find the header record with 'X' and populate the data for the table control 2
    Hope it helps
    Regards
    Byju

  • WIZARD FOR TABLE CONTROL DOCUMENTS REQUIRED

    hI ALL,
    cAN ANYBODY SEND ME DOCUMENTS RELATED TO TABLE CONTROL USING WIZARD.i NEED TO CREATE A TABLE IN WHICH I WOULD FILL THE TABLE WITH AND WHEN I SAVE IT I NEED THE ZTABLE TO BE UPDATED .
    cAN ANYBODY SEND ME SOME DOCUMENTS REGARDING HOW TO USE WIZARD.
    mY EMAIL ID :
    [email protected]
    tHANKS IN ADVANCE

    Hi Kajol,
    I was searching online and came with this short steps from this link:
    http://sap.ittoolbox.com/groups/technical-functional/sap-r3-dev/dialogprogramcall-dump-725857#
    (1) drag the table control (with wizard) on the full screen. (2) press continue. (3) enter the name of your table control (any name you want) (4) press continue (5) select 'internal table' (6) enter name of your internal table (the one that contains data to be displayed for table control) (7) press continue (8) fields of your itab will be displayed then, select the fields you want to be seen on your table control (9) continue pressing 'continue' until complete button is shown (10) press 'complete'.
    I tried giving database table name instead of internal table at point number (6).
    Also, did you go thru this link:
    http://help.sap.com/saphelp_nw04/helpdata/en/6d/150d67da1011d3963800a0c94260a5/content.htm
    Hope this will be of some help to you.
    Regards,
    Vivek

  • Table control: Line selection single issue

    Hi experts,
    I have created a table control and in the screen painter I have defined the line selection as "Single" for table control.
    The table control can display upto 20 lines in a screen and i can select a single record only which pertains to my requirement. if I try to select two records it will not allow.
    Issue: consider  i select a single record from the first 20 lines displayed in screen, then i scroll the records in the table control so that it displays the records from 21 to 40. if I select a single record now from line 21 to 40, the first record that i selected is not getting deselected. That is, totally two lines are getting selected.
    How to overcome this issue
    Thanks in advance
    Regards
    Anand

    Ok
    The "problem" is here:
    Types: Begin of ty_ic,
      ic(20),
      desc(20),
      sel(1)                                 <--------------------------------
    End of ty_ic.
    You've ha a field for selected line and that field is used in table control definition as you've written:
    "Note: wa_ic is the structure used in table control and wa_ic-sel is the mark field defined the table control attributes"
    So you're using the structure WA_IC as header line of internal table IT_IC and also as input/put field of your table control (I mean the screen fields of table control are based on WA_IC).
    You don't need any code in PBO to move the data from internal table to table control, because the headerline of IT_IC and field of table control are the same, infact you've implemented only the code in PAI to save the data from table control to IT_IC:
    Loop at it_ic.
    Modify it_ic from wa_ic index tc_ic-current_line
    Endloop
    t's a good solution if it needs to transfer all data to table control automatically: it doesn't need any code in PBO
    but, of course, there'll be a problem when you don't need to display something, in this case you have to think a solution, I mean you have to write a code in order to avoid to display those data.
    It's the case of the selected line: in your situation all selected lines keep the selection, because the code to clear IT_IC-SEL is missing: only the user can deselect a line, but if he doesn't do it, the line will remain selected after navigation.
    So you make to be sure to clear all selected lines are not displayed.
    You need to create a code in PAI out of the loop of table control where you clear the flag SEL, in order to do it you need to consider:
    - The index of the first record displayed in table control is stored in field TC_IC-TOP_LINE
    - The index of the last record displayed in table control can be calculated: the variable SY-LOOPC indicates how many rows can be displayed in table control, so the last record will be: TC_IC-TOP_LINE + SY-LOOPC.
    So you need to clear the field SEL for all records not displayed, a code like this:
    PROCESS PAI.
      LOOP AT IT_IC.
         MODULE GET_LOOPC.
      ENDLOOP.
      MODULE CLEAR_SEL.
      MODULE GET_LOOPC..
          TOT_LINE_DISPLAYED = SY-LOOPC.
      ENDMODULE
      MODULE CLEAR_SEL.
    * Here you need to clear the selection of the records before of TOP_LINE
           IF TC_IC-TOP_LINE > 1.
              LOOP AT IT_IC INTO WA_IC  TO TC_IC-TOP_LINE.
                 CLEAR WA_IC-SEL.
                 MODIFY IT_IC FROM WA_IC.
              ENDLOOP.
         ENDIF.
    * Here you need to clear the selection of the records after the last one:
          LAST_INDEX = TOT_LINE_DISPLAYED + TC_IC-TOP_LINE.
         DESCRIBE TABLE IT_IC LINES SY-TABIX,
         IF SY-TABIX > LAST_INDEX.
              LOOP AT IT_IC INTO WA_IC  FROM LAST_INDEX.
                 CLEAR WA_IC-SEL.
                 MODIFY IT_IC FROM WA_IC.
              ENDLOOP.
         ENDIF.
      ENDMODULE.

  • Table control in modulepool

    Hi,
    I have table control in modulepool.I have to edit some cells in my table control and update the same fields in actual table after pressing save button.And also I should maintain the modified field in some Ztable.
    Plese provide me the code if any body having the same scenario.
    It is urgent.
    Thanks
    suresh

    refer these
    http://sap.niraj.tripod.com/id25.html
    http://sap.niraj.tripod.com/id29.html
    <b>http://help.sap.com/saphelp_nw2004s/helpdata/en/9f/dbac5135c111d1829f0000e829fbfe/content.htm</b>
    regards,
    srinivas

Maybe you are looking for

  • Need to add a second hard drive. Which model?

    Hello, I would like to add a second hard drive to my G3. My current 12 Gig ATA/133 hard drive is not sufficient anymore for my projects. I would like to choose a SATA hard drive and I need some help with the selection of a model. I am choosing SATA b

  • Captivate (5) project won't open in Web Browser

    Hello, Since a few weeks I can't open my projects in the web browser. Accept one of the projects (only questionslides), i have been searching for differents in the setttings but i couldn't find any differtens. When I publish the project in a .swf sti

  • AVG add-in for Outlook 2013

    I'm running Outlook 2013 under Windows 8.1. I am also running AVG Internet Security 2015 (purchased version, not the free anti-virus one). I have enabled the AVG add-in. The first time I started Outlook after installing AVG, I noticed that the AVG gr

  • Path for Pictures,Logos stored in SAP Server ??

    Dear All,          I am Preparing a Z report for that I want to Import Logo.          I hv already stored the Logo in SAP Server with SMW0, but for downloading that logo 2 Excel Application I want the path (URL) where it is stored.         Can anyone

  • Query - Fiscalyear/period - Display - Restricted KF

    Hello Guys, I have a requirement from the users like they will be entering the fiscal period/fiscal year in the selection screen for example: FisPer/Fis Year ---> 001/2009 to 006/2009 in the output I have a keyfigure called for example ZKEYFIG it has