Refresh ALV & set focus

Hi,
   I have a refresh option on my screen. It will bring latest data from database. After displaying data in ALV and scrolling down (lets assume scrolled down 10 records). if I select refresh, I am reloading data to ALV. But focus is going to first record. I have again scrool down to 11th record to check the data. How I can set focus to 11th record after repopulating data on ALV. I am using classes for ALV.
I will appriciate any inputs.
Regards,
Venkat.

Hi,
Check this example of using the method set_current_cell_via_id.
    DATA: ROWNO TYPE LVC_S_ROID.
    ROWNO-ROW_ID = 25.
Set the focus on the row number 25.
    CALL METHOD <b>grid1->set_current_cell_via_id</b>
      EXPORTING
        IS_ROW_NO    = rowno.
Hope this helps..
THanks,
Naren

Similar Messages

  • Help need on ALV Get focus & set Hot Key

    Hi Expert,
    In my project, I am working extensively in WDP ALV component. My have some tropical requirement in this project.
    1.     Get the reference of the particular box of a ALV table. There is some set-focus functionality, but there is nothing called get focus. Do any one have any ides, how can I get the reference of the particular selected box ( cell ) from a ALV table.
    2.     Is it possible to set Hot key in the WDP component? For a example, if I click that hot key, it will trigger some action.
    It will be an great help, if any one can provide any idea on this.
    Thanks in advance,
    Regards,
    Satrajit.

    Hi Satrajit,
    For hot keys..
    http://help.sap.com/saphelp_nw70ehp1/helpdata/en/47/b951297a6d2d65e10000000a42189c/content.htm
    You want to do on perticular cell.. this helps.
    http://help.sap.com/saphelp_NW70EHP1core/helpdata/en/45/12093591152464e10000000a1553f7/content.htm
    http://wiki.sdn.sap.com/wiki/display/WDABAP/HowtotriggertheeventON_CELL_ACTIONin+ALV
    OR based on attribute you can do any actions..
    for example :..
    DATA lt_table_settings  TYPE REF TO if_salv_wd_table_settings.
      DATA lt_column_settings TYPE REF TO if_salv_wd_column_settings.
      DATA lt_columns         TYPE salv_wd_t_column_ref.
      DATA ls_columns         TYPE salv_wd_s_column_ref.
      DATA lv_column          TYPE REF TO cl_salv_wd_column.
      lt_columns = lt_column_settings->get_columns( ).
    *** To change and set Column Header Text ***
      LOOP AT lt_columns INTO ls_columns.
        lv_column = ls_columns-r_column.
        CASE ls_columns-id.
          WHEN 'DEALER '. // your attribute name
        // your action...
    ENDCASE.
    ENDLOOP.
    Cheers,
    Kris.

  • Set Focus to a cell in ALV on action performed outside ALV

    Hi All,
    In my application i have created a dynamic ALV using technical structures.
    I have few fixed columns and few scrollable columns.
    The scrollable columns represents dates. The caption of the ALV headers are set later with the dates.
    I have a date navigator control. On choosing a date, the headers of date columns changes.
    Table layout is fixed with 4 displayed scrollable columns displayed each time.
    Issue:
    When i use horizontal scroll on ALV and then navigate on a date, then the ALV headers are updated. But the scroll position is not changed. I would want to focus on the first date column.
    I tried 2 options to set focus. But both dont seem to work.
    Could you provide me some suggestions?
    Option 1:
      CALL METHOD lo_view->if_wd_view_controller~request_focus
        EXPORTING
          context_element = lo_el_time_ps            " i get the element reference for the right index )
          attribute       = lv_attribute_name            "first date column name (technical name)
    Option 2:
    lo_interfacecontroller = wd_this->wd_cpifc_alv_usage1( ).
    lo_interfacecontroller->set_focus(
                                      index = lv_index                       " i get the element reference for the right index )
                                     column = lv_attribute_name ).   "first date column name (technical name)
    Regards,
    Rekha

    hi Carles Costa,
    i think your issue is type of Purchase document. if it is Item type then matrix (38) and column(1) is itemcode,
    if service type then matrix(39) and column 1 is Description.
    this code oMatrix.Columns.Item("1").Cells.Item(pVal.Row).Click() or oMatrix.Columns.Item("1").Cells.Item(pVal.Row).Click(BoCellClickType.ct_Regular) is correct.
    hope this help you.
    thanks
    H2

  • ALV set row and column position

    Hi Experts,
    I have editable ALV, after edit I refresh ALV, but problem is, that position is set to position 1.1. I need to keep cursor at edited position.
    I use ALV through function module REUSE_ALV_GRID_DISPLAY.
    Thansk&regards,
    Jirka

    In order to refresh the ALV and keep the scroll position, you have to read the scroll posiition before refresh and set the scroll position after the refresh..
    Below code will help,.. Whenever you want to refresh the alv use these in your coding...
    FORM refresh_alv_display.
    DATA: li_rows    TYPE lvc_s_roid,
             li_col     TYPE lvc_s_col,
             lws_row_id TYPE lvc_s_roid,
             lws_col_id TYPE lvc_s_col,
             ls_col     TYPE lvc_s_col,
             ls_num     TYPE lvc_s_roid.
       CALL METHOD c_grid->get_current_cell
         IMPORTING
           es_col_id = li_col
           es_row_no = li_rows.
       CALL METHOD c_grid->get_scroll_info_via_id
         IMPORTING
           es_col_info = ls_col
           es_row_no   = ls_num.
       CALL METHOD c_grid->refresh_table_display.
       CALL METHOD c_grid->set_scroll_info_via_id
         EXPORTING
           is_col_info = ls_col
           is_row_no   = ls_num.
       lws_row_id-row_id    = li_rows-row_id.
       lws_col_id-fieldname = li_col-fieldname.
       CALL METHOD c_grid->set_current_cell_via_id
         EXPORTING
           is_column_id = lws_col_id
           is_row_no    = lws_row_id.
    ENDFORM.

  • How to set focus on a textinput/poplist using PPR

    HI,
    Is it possible to use PPR to set focus on a Text input or Poplist.
    if Yes, which attribute in the UI Item we need to use?
    will the attribute 'Access Key' work for the same?
    If PPR is not an option then getting a java bean for the UI Item is the only option?
    Thanks,
    Gowtam.

    Gowtam,
    No, the two basic differences between PPR and fire action!
    1)Fire action submit the entire OA Page Form elements, while PPR only refreshes the form components of that particular region.
    2)When PPR event is done, framework neglects any other action done on the page.
    Now, like your basic question, why should u use PPR event ?Instead y not firaction always?
    The reason is the very first defination of PPR.If i have n number of items on my page, if I define every action as fire action after each event page will refresh, so even for a small update like vanishing a field, i have to refresh the entire page which will be unusual for the user because it will take some time to load if page has some heavy components like hgrids , tables etc. Thats y we prefer PPR event over fire action in case of individual events, which is much fast, refreshing only particular form items.
    In standard j2ee web applications, the same is done using DHTML and javascript.
    I hope i am clear.
    --Mukul                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Refresh alv list display

    Hi,
    how to refresh an ALV LIST display?
    Thanks.

    Hi,
    Content and Structure Change
    Use
    You are able to change the internal data table in various ways. Depending on which type of change you use, you  have to proceed differently to make the change visible on the front end in the ALV output as well.
    You are able to make the following changes:
    ·        You change content or the sequence of the individual data records
    Afterwards you need to refresh the ALV output
    ·        You replace the entire data table
    Refresh Display of the ALV Output
    If you have changed single values, added rows or deleted rows in the data table of list-type ALV outputs, you need to complete these changes in the ALV output as well by refreshing the ALV display.
    For Changes in the Tree Structure you do not have to refresh the display. In the other ALV tools, you do not have to refresh the ALV output when you make the following changes:
    §         Changes to the Display of Columns
    §         Changes Sequence of Columns in the ALV display
    §         Changes to the DDIC Reference of Columns
    By default, the ALV output automatically scrolls to the beginning. However, you are able to determine that the current display (position on the screen) not be changed.
    You are able to refresh the ALV output in two ways:
    ·        All settings for filters and sorting remain.
    This setting can lead to newly inserted data records not being displayed because the filter setting hid exactly these data records.
    ·        All settings for filters and sorting remain.
    Features
    For changes to content and structure, you are able to make the following settings:
    ·        Refresh ALV output
    ·        Swap the data table of the ALV output
    Refresh ALV output
    With the refresh, you ensure that the changed values are available on the front end as well.
    Display type
    ALV Tool
    Classic ABAP list
    Full screen
    In the Container
    Simple, two-dimensional table
    Yes
    Yes
    Yes
    Hierarchical-sequential list
    Yes
    Tree structure
    No
    No
    Methods
    Function
    Class
    Method
    Refresh ALV output without deleting filter and sort settings
    CL_SALV_TABLE
    CL_SALV_HIERSEQ_TABLE
    REFRESH
    (Parameter REFRESH_MODE: SOFT)
    Refresh ALV output and delete filter and sort settings
    REFRESH
    (Parameter REFRESH_MODE: FULL)
    Change the Structure of the Data Table with SET_DATA
    Depending on which ALV tool you are using, the parameters of the SET_DATA method are different:
    If you assign a new structure with SET_DATA, all objects that referred to the previous structure will be deleted such as all sort objects in list-type ALV outputs or all node objects in tree structures.
    Methods
    Function
    Class
    Method
    Change structure and data table
    CL_SALV_TABLE
    CL_SALV_HIERSEQ_TABLE
    CL_SALV_TREE
    CL_SALV_HIERSEQ_LEVEL
    SET_DATA
    Change the Structure of the Data Table with the SET_DATA Method
    ALV Tool
    Parameter
    Remarks
    Simple, two-dimensional table
    T_TABLE
    Table for structure and contents of the ALV output
    Hierarchical-sequential list
    (in CL_SALV_HIERSEQ_TABLE)
    LEVEL
    Hierarchy level whose structure you wish to change
    T_TABLE
    New table of hierarchy level
    T_BINDING
    List of up to five foreign-key relationships
    (in CL_SALV_HIERSEQ_LEVEL)
    VALUE
    New table of hierarchy level
    T_BINDING
    List of up to five foreign-key relationships
    Tree structure
    T_TABLE
    Initial table
    Empty table, only sets the structure

  • Refresh ALV ( Internal Table Will Be Change)

    Hi friends
    I am using 2 internal table. And they have their own field catalog. I can refresh alv grid.
    If my refresh data have stuation 1 I am using Inta another stuation I am using Intb.
    How can I refresh my ALV grid with different catalog and internal table?

    Hi,
    yes you can do that,
    Check this sample code, in your case you have to use two performs for display. with the help of SELFIELD-EXIT = 'X'. you can get what you want.
    REPORT  ZTEST_ALV.
    type-pools:slis.
    DATA: GT_SFLIGHT TYPE TABLE OF SFLIGHT.
    DATA: GT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
          FIELDCAT type SLIS_FIELDCAT_ALV.
    data: l_layout type SLIS_LAYOUT_ALV.
    SELECT * FROM SFLIGHT INTO TABLE GT_SFLIGHT.
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
      EXPORTING
        I_PROGRAM_NAME         = sy-repid
        I_STRUCTURE_NAME       = 'SFLIGHT'
        I_INCLNAME             = sy-repid
      CHANGING
        CT_FIELDCAT            = gt_fieldcat
      EXCEPTIONS
        INCONSISTENT_INTERFACE = 1
        PROGRAM_ERROR          = 2
        OTHERS                 = 3.
    IF SY-SUBRC <> 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    perform alv_display.
    *&      Form  status
    *       text
    form status USING P_EXTAB TYPE SLIS_T_EXTAB  .
      set pf-status 'AAA' excluding p_extab.
    endform.                    "status
    *&      Form  USER_COMMAND
    *       text
    *      -->P_UCOMM    text
    *      -->P_SELFIELD text
    FORM USER_COMMAND USING    P_UCOMM    LIKE SY-UCOMM
          P_SELFIELD TYPE SLIS_SELFIELD.
      case p_ucomm.
        when 'TEST'.
            fieldcat-no_out = 'X'.
            modify gt_fieldcat from fieldcat
                   transporting no_out where fieldname = 'PRICE'.
    p_selfield-exit = 'X'.
    perform alv_display.
    endcase.
    ENDFORM.                    "USER_COMMAND
    *&      Form  alv_display
    *       text
    FORM alv_display .
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
      EXPORTING
        IS_LAYOUT                = l_layout
        I_CALLBACK_PROGRAM       = sy-repid
        I_STRUCTURE_NAME         = 'SFLIGHT'
        I_CALLBACK_PF_STATUS_SET = 'STATUS'
        I_CALLBACK_USER_COMMAND  = 'USER_COMMAND'
        IT_FIELDCAT              = GT_FIELDCAT[]
      TABLES
        T_OUTTAB                 = GT_SFLIGHT.
    ENDFORM.                    " alv_display
    Regards
    vijay

  • Setting focus on a component from backing bean

    Is there an easy way to set focus in a specific component on the jspx from a method in the backing bean? (other than javaScript coding...)

    Hi,
    did you take a look at
    About control the cursor position in a JSF web page
    It contains some links to other weblogs. The links are helpfull. Maybe you'll be able to find your solution there......
    Good luck
    Luc Bors

  • How to set focus on a input field in a selected row of a table?

    In a previous discussion (http://scn.sap.com/thread/3564789) I asked how to access an input (sap.m.Input) field of a selected row in a table. In the answer that was supplied I was shown how to get the items of the table. Then using the selected index to get the selected item get the cells. Then I could set editable on the proper cell(s). This worked fine.
    Now I need to set the focus on one of the fields. I tried something like this:
                var oNewLink = table.getSelectedItem();
                var oNewLinkName = oNewLink.getCells()[1];
                oNewLinkName.focus();
    But this doesn't seem to work.
    I have searched through other discussions and have seen this technique for putting focus on a field if you have its ID:
    sap.ui.getCore().byId(id_of_the_input_field).$().focus();
    In my case though I do not have an ID since the row and its cells are generated. How can I set focus on the cell of a certain row in a table?

    Hello Venkatesh. Yes that code does work. First I tried it on a table cell that was already rendered and it did work. The next time I tried it on a table row that was being added and it did not work there. So I added an on after rendering function for the table and added that code there. That did not work until I added a delay (timeout) to do a context switch before calling the focus and that worked.
    Once last thing though sometimes when I call focus on an input field (actually in a table row cell) if the field has text in it already the flashing cursor is at the beginning of the text and other times it is at the end of the text (which is the desired way). It depends on where I click in the row. Is there anyway to make sure the flashing cursor is at the end of the text when the focus is applied to a field that contains text?

  • How to set focus on the title of JTabbedPane

    I have created a JTabbedPane and added three JPanels to it. They are titled, say "Panel 1", "Panel 2" and "Panel 3". And each of them contains buttons and text areas. Since this app is for physically disabled users, it must provide navigation through these three tabs with keyboard operations only (i.e. without mouse clicks).
    When the title "Panel 1" gets focused, users can go to "Panel 2" by the right arrow key. When Panel 2 is brought up, however, the title "Panel 2" does not get focused. Instead the first button inside panel 2 is focused. In order for users to navigate to 'Panel 3" by the arrow key, the title "Panel 2" has to be focused. How do I set focus on the tab title?
    I have tried 'requestFocus()' on Panel 2, but it does not work. Please help me with this issue. Thanks in advance.

    I'd be quite interested to know if this can be doen as well so I thought I'd post this message to move it to the top of the board.
    Thanks.

  • How to set focus on a custom PO Item screen field when in error?

    Hi All,
    I have an interesting situation that i'm wondering if others have solved.  We have extended the PO item table (EKPO) by adding two new fields.  We then have implemented two BAdI's:  ME_GUI_PO_CUST and ME_PROCESS_PO_CUST to add them to the ME21N/ME22N/ME23N screens and logic to do some validation, via these respective BAdI's mentioned.  Everything works perfectly - with one small issue.  When we are doing some validation via a method on the ME_PROCESS_PO_CUST - and "invalidate" the field (and throw an error) when it is in error - I also want to be able to "set focus" on the field in question (basically: go to the particular tab on the ME* screen and highlight the field).  I have tried using SET CURSOR FIELD *****  within this BAdI (ME_PROCESS_PO_CUST) - but doesn't seem to work.  Has anyone tried to do this and have come up with a solution?  Would be much appreciative if you shared it!!!  Thanks much.
    Cheers,
    Matt
    ERP version that we have is:  ECC 6.0

    Just have a look at oss note 310154 - ME21N/ME51N: Customer-specific check, generating error log.
    In short:
    Add your error messages in EXIT_SAPMM06E_012 (using specific macros).
    Sample code (provided in Oss note) :
      loop at tekpo where knttp eq 'X'.
        loop at tekkn where ebeln eq tekpo-ebeln and
                            ebelp eq tekpo-ebelp and
                            kostl eq space.
          if not tekkn-id is initial.
            mmpur_business_obj_id tekkn-id.
            mmpur_metafield MMMFD_ACCOUNTINGS.
          endif.
          mmpur_message_forced 'E' 'ZE' '777' '' '' '' ''.
        endloop.
      endloop.

  • Back again - set focus

    Hi again,
    I've been struggling with setting focus on each instance of a field within a repeating subform. My subform is limited to 5 instances. Min of 1.
    As the user exits the only textfield in the subform, I have a new instance creating. I want the focus set to the new instance but I have not been able to get anything to work. My latest attempt has been to try to pass a count using the instancemanager to a variable in the setfocus string.
    Here is what I have thus far. I know I need to resolve the node but that process is confusing the heck out of me. I've read and re-read everything I've been able to find but I havent been able to wrap my head around that part successfully.
    Can anyone point me in the correct direction or suggest a better solutions? TIA!
    form1.Account_Client_Information.Long_Title.Account_Long_Title::exit - (JavaScript, client)
    var oSubform = xfa.resolveNode("Long_Title");
    var oNewInstance = oSubform.instanceManager.addInstance(1);
    xfa.form.recalculate(1);
    var count = (this.instanceManager.count)
    xfa.host.messageBox("Text Field Index in new Subform: " + count);
    var vfocindex = xfa.resolveNode("Account_Long_Title[count]");
    xfa.host.setFocus(vfocindex);

    Hi,
    The addInstance method will return the subform that you want so you only need to do;
    var oNewInstance = Subform1.instanceManager.addInstance(1);
    xfa.host.setFocus(oNewInstance.Account_Long_Title)
    Regards
    Bruce

  • How to set focus in text box at server side

    Hi,
    I have small problem , i have a text box in form , which is get validated at server side in servlet , if it found some thing wrong then it throws exception , i want that when an exception is thrown it should set focus for that perticular text box. so what should i write to perform such a activity.

    Get hold of the element ID in the servlet (and keep the code conventions) and print it out to some Javascript function which does a focus during the onload.
    There's an example of focus/highlight using JSP/Servlet/Javascript in this article: [http://balusc.blogspot.com/2008/07/dao-tutorial-use-in-jspservlet.html]. Also see the screenshots at the very bottom.

  • Setting focus in a PDF form

    Hi,
    I'm trying to move a cursor to a particular field based on certain conditions using JavaScript. The method I am using is xfa.host.setFocus("fldTest"); in the initialize event. For some reason the focus isn't getting set to fldTest, but when I first hit tab it goes into the first field that is in the tab order. Is there any way around this?
    Thanks,
    Chad

    You might want to check the reference path of the field that you want to set focus on.
    Ex: xfa.host.setFocus("form1.page1.subform1.TextField1");

  • Setting focus to new instance of a field...need help.

    Hi there,
    I have a flowed form which consists of multiple subforms. I have one subform which is basically one textfield that is set to a min of 1 and a max of 5.
    These are to correspond to fields in our system of record that have 5 fields for company long name with a 36 character field limit.
    I've got the limits set up just fine and I have added simple script to add a new instance when the user exits the field.
    The focus goes to the next field set in the tab order but what I want is the focus set on the new instance of field created but I have not been able to find an example of how to do that.
    Any suggestions would be greatly appreciated. Thanks!

    Well,
    I've been reading and trying various things but cant get anything to work like I want it to.
    The sample provided works for 2 iterations but mine has to do this for up to 5 instances. I have not been able to figure out how to get this to work.
    Anyone have any additional suggestions?
    btw...here is my modified version. ES2 is whay I'm using.
    Long_Title.occur.max = "5";
    var oSubform = xfa.resolveNode("Long_Title");
    var oNewInstance = oSubform.instanceManager.addInstance(1); // I think you probably managed this first part better than here
    xfa.form.recalculate(1); // I THINK THIS IS IMPORTANT
    var count = (this.Long_Title.nodes.length)
    var testIndex = oNewInstance.Account_Long_Title.index;
    xfa.host.messageBox("Text Field Index in new Subform: " + count); // TextField1 will conserve index 0 because it is the only textfield in the new Sub1
    var NEW_TEXTFIELD = xfa.resolveNode("Long_Title[1].Account_Long_Title[0]"); // However, Sub1 gets index 1 because it is not alone any more
    xfa.host.setFocus(NEW_TEXTFIELD); // This actually sets focus on the newly created instance of TextField1 (actually Sub1 instance)

Maybe you are looking for

  • Imported songs in strange order

    Imported songs are not in the correct order in iTunes. I've tried changing the order of the song names but it only reverses the order. The strange thing is after updating into my ipod the order is the same as the cd on my ipod but iTunes still has th

  • Application Builder  Import App Bug

    When an application is imported and installed you have three choices, run, edit app, and edit app attributes.. This is on page f?p=4000:57 If you click the run application it ALWAYS points to /apex/f?p=APP_ID:1:SESSION I for one do not have a page on

  • Change in SQL from case sensitive to case insensitive

    Hi Experts We have to change the collation setting for one of my clients databases (SAP doc at the time was erroneous) I am wondering if I can change at the same time the DB from being case sensitive to being case insensitive? thx, Richard

  • Cash Purchase in Maintenance

    Dear Gurus; In one of the scenarios, my client wants to have cash purchase in regular maintenance order as well as preventive maintenance order. So there is no PR & hence no PO. How it can be mapped in SAP? Thanks & Regards Hemant

  • Making the print driver quit automatically in Mac OS X?

    This is a very minor issue, but one that's been irritating me for a while. Why don't the print driver applications close automatically after finishing a job? Is there a way I can configure them to do this?