How to make the first row  selected before the display of ALV grid

Hello Experts,
I created a ALV grid using custom container in a screen . Now i want do the follwing:
1. i want that, the  <b>first line must be selected before the display of ALV.</b>
2. I have selection buttons . But i dont want the multiselect button and the  
    standard  toolbar in the ALV grid.
Could any one please help me regarding the above?
Thanks & Regards
Sudhansu

can u pls explain in more details with an example?
I am telling u the scenario.
1. i have a screen(Modal dialog Box)  containing ALV grid with selection buttons for each row  (top part) and a subscreen(second part).
      Now when i click on a selection button, it will display the corresponding values in the subscreen.
    When this screen will display for the first time , then first row of the ALV grid should be selected and the corresponding values should be displayed in  the subscreen.
i   wrote the following code in the PAI. But when i select a record its not triggering the PAI.
DATA:
     gi_index_rows TYPE lvc_t_row, " Internal table for indexes of selected rows
     g_selected_row LIKE lvc_s_row, " Information about 1 row
     l_lines TYPE i.
  CLEAR g_wa_vdmeko.
*get selected row
  CALL METHOD g_alv_grid->get_selected_rows
    IMPORTING
      et_index_rows = gi_index_rows.
  DESCRIBE TABLE gi_index_rows LINES l_lines.
  LOOP AT gi_index_rows INTO g_selected_row.
    READ TABLE g_int_vdmeko INDEX g_selected_row-index INTO g_wa_vdmeko.
    SELECT SINGLE  *
           FROM vdmepov
           WHERE bukrs = g_wa_vdmeko-bukrs AND
                 styp  = g_wa_vdmeko-styp  AND
                 sbez  = g_wa_vdmeko-sbez  AND
                 svym  = g_wa_vdmeko-svym  AND
                 svnr  = g_wa_vdmeko-svnr.
  ENDLOOP.
I am displayinng the ALV using method "set_alv_for_first_display".
Please help if u have any idea..................
Thanks
Sudhansu

Similar Messages

  • How do I create a 1d array that takes a single calculation and insert the result into the first row and then the next calculation the next time the loop passes that point and puts the results in thsecond row and so on until the loop is exited.

    The attached file is work inprogress, with some dummy data sp that I can test it out without having to connect to equipment.
    The second tab is the one that I am having the problem with. the output array from the replace element appears to be starting at the index position of 1 rather than 0 but that is ok it is still show that the new data is placed in incrementing element locations. However the main array that I am trying to build that is suppose to take each new calculation and place it in the next index(row) does not ap
    pear to be working or at least I am not getting any indication on the inidcator.
    Basically what I am attempting to do is is gather some pulses from adevice for a minute, place the results for a calculation, so that it displays then do the same again the next minute, but put these result in the next row and so on until the specifiied time has expired and the loop exits. I need to have all results displayed and keep building the array(display until, the end of the test)Eventually I will have to include a min max section that displays the min and max values calculated, but that should be easy with the min max function.Actually I thought this should have been easy but, I gues I can not see the forest through the trees. Can any one help to slear this up for me.
    Attachments:
    regulation_tester_7_loops.vi ‏244 KB

    I didn't really have time to dig in and understand your program in depth,
    but I have a few tips for you that might things a bit easier:
    - You use local variables excessively which really complicates things. Try
    not to use them and it will make your life easier.
    - If you flowchart the design (very similar to a dataflow diagram, keep in
    mind!) you want to gather data, calculate a value from that data, store the
    calculation in an array, and loop while the time is in a certain range. So
    theres really not much need for a sequence as long as you get rid of the
    local variables (sequences also complicate things)
    - You loop again if timepassed+1 is still less than some constant. Rather
    than messing with locals it seems so much easier to use a shiftregister (if
    absolutely necessary) or in this case base it upon the number of iterations
    of the loop. In this case it looks like "time passed" is the same thing as
    the number of loop iterations, but I didn't check closely. There's an i
    terminal in your whileloop to read for the number of iterations.
    - After having simplified your design by eliminating unnecessary sequence
    and local variables, you should be able to draw out the labview diagram.
    Don't try to use the "insert into array" vis since theres no need. Each
    iteration of your loop calculates a number which goes into the next position
    of the array right? Pass your result outside the loop, and enable indexing
    on the terminal so Labview automatically generates the array for you. If
    your calculation is a function of previous data, then use a shift register
    to keep previous values around.
    I wish you luck. Post again if you have any questions. Without a more
    detailed understanding of your task at hand it's kind of hard to post actual
    code suggestions for you.
    -joey
    "nelsons" wrote in message
    news:[email protected]...
    > how do I create a 1d array that takes a single calculation and insert
    > the result into the first row and then the next calculation the next
    > time the loop passes that point and puts the results in thsecond row
    > and so on until the loop is exited.
    >
    > The attached file is work inprogress, with some dummy data sp that I
    > can test it out without having to connect to equipment.
    > The second tab is the one that I am having the problem with. the
    > output array from the replace element appears to be starting at the
    > index position of 1 rather than 0 but that is ok it is still show that
    > the new data is placed in incrementing element locations. However the
    > main array that I am trying to build that is suppose to take each new
    > calculation and place it in the next index(row) does not appear to be
    > working or at least I am not getting any indication on the inidcator.
    >
    > Basically what I am attempting to do is is gather some pulses from
    > adevice for a minute, place the results for a calculation, so that it
    > displays then do the same again the next minute, but put these result
    > in the next row and so on until the specifiied time has expired and
    > the loop exits. I need to have all results displayed and keep building
    > the array(display until, the end of the test)Eventually I will have to
    > include a min max section that displays the min and max values
    > calculated, but that should be easy with the min max function.Actually
    > I thought this should have been easy but, I gues I can not see the
    > forest through the trees. Can any one help to slear this up for me.

  • How can i change sequence of structrure when i display in alv grid.

    Hi,
    I am doing object oriented alv. Now i need to change my sequence of alv grid. How can i change sequence of structrure when i display in alv grid. Send me code if possible....
    IF G_CONTAINER IS INITIAL.
         CREATE OBJECT G_CONTAINER
             EXPORTING
                CONTAINER_NAME = 'CONTAINER'.
         CREATE OBJECT ALV_DISP
             EXPORTING
                I_PARENT = G_CONTAINER.
         CALL METHOD ALV_DISP->SET_TABLE_FOR_FIRST_DISPLAY
             EXPORTING
               I_STRUCTURE_NAME  = 'ZPMS_OUTPUT_V3'
              CHANGING
                IT_OUTTAB        = IT_PMT
                IT_FIELDCATALOG  = G_FLDCAT
              EXCEPTIONS
                INVALID_PARAMETER_COMBINATION = 1
                PROGRAM_ERROR                 = 2
                TOO_MANY_LINES                = 3
                OTHERS                        = 4.
         IF SY-SUBRC <> 0.
         ENDIF.
    Regards,
    Gurprit Bhatia
    Message was edited by:
            GURPRIT BHATIA

    Hi Gurprit,
    when you are maintaining the field catalog you can maintain the order by populating the value as 1,2,... into col_pos filed.
    <b><REMOVED BY MODERATOR></b>
    Satish
    Message was edited by:
            Alvaro Tejada Galindo

  • Can you move a row in a DataGridView to the first row and move the other rows down to make room?

    I'm using a DataGridView (I call it "dg") to display a list of items. I want the user to be able to position the cursor on a row in the middle of the list then click a button to move that row to the top of the list (and move the other rows between
    the first row and the row being moved down one row to accomodate the new first row).
    Robert Homes

    Hello,
    If the DataGridview does not have it's DataSource set we can use the following logic
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
    Dim data = (From T In DataGridView1.Rows(DataGridView1.CurrentRow.Index).Cells.Cast(Of DataGridViewCell)() Select T.Value).ToArray
    DataGridView1.Rows.RemoveAt(DataGridView1.CurrentRow.Index)
    DataGridView1.Rows.Insert(0, data)
    End Sub
    If the DataSource is set then we need to do what was done above but against the underlying data rather than the DataGridView itself. The base logic can be found in
    the following article in LanguageExtensions.vb but please note the code there is for a different type of move yet the logic is still the same in the end.
    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem.

  • How to make a particular row and column field editable in ALV

    Hi Experts,
    I have a requirement to make a particular row and column field editable in ALV output. Like i need to make 2nd row - 4th column editable of ALV output.
    Kindly help me out to solve this.
    Any help would be appreciated.
    Thanks,
    Ashutosh

    Hi Ashutosh,
    please check below, explained by some experts.
    In the below link  editing two columns MOD_RANK and TECH_RANK.
    These two columns will be in edit mode once after selecting the required record
    Editing single cell in a row of ALV table
    And also look for more info
    http://scn.sap.com/thread/884976

  • How to find the check box selected while using Class in ALV grid display

    hi,
    I am displaying the ALV report using Class 
    For Example: CALL METHOD MYGRID->SET_TABLE_FOR_FIRST_DISPLAY EXPORTING I_STRUCTURE_NAME = 'ACC1'
                                                             IS_VARIANT = GS_VARIANT
                                                             I_SAVE = 'A' "XSAVE
                                                             IS_LAYOUT  = LOUT
                                                     CHANGING  IT_FIELDCATALOG = IT_FIELD
                                                               IT_OUTTAB = ACC_NO[].
    In output i am getting 10 customer with check box, how do i find that customer number is selected.

    HI,
    Once user selects a check box, he would CLICK on a button ( say PROCESS )inorder to do the processing for the selected records. So in the PAI, under the EVENT ( OK CODE ) of the Button ( say PROCESS ), write the following code.
    CALL METHOD MYGRID->check_changed_data.
    Now,
    Loop at acc_no where check = `X`.
    Do the processing.
    endloop.
    Best regards,
    Prashant

  • Select row button not getting displayed in alv grid.

    Hi ,
    As per my requirement I am using tab strip in module pool.
    Each tab strip is containing one ALV.
    And user can change delete or create one record when the alv is displayed.
    The same should be saved in the database and ALV should be refreshed.
    When I am displaying the ALV the left most option of the ALV with which I can select the whole row is not coming.
    Because of which I am unable to call the method to get the selected row and delete or change accordingly.
    Why this button is not coming?
    I am using set_table_for_first_display in my program.
    Please help.

    Hi,
    In the method SET_TABLE_FOR_FIRST_DISPLAY, you will have to change the Selection Mode to 'A'. I guess you are not passing any values to the Layout parameters.
    Once you do that, you will find what your are looking for.
    Data : LA_LAYO type LVC_S_LAYO.
    LS_LAYO_SEL_MODE = 'A'.
    and pass this to the method's layout parameter.
    Cheers,
    SKC,

  • First row of table is displayed as selected always when application loads.

    Hi..
    I have a table with few rows in it.When the application loads the first row of table is displayed as selected always.I don't want any of the rows to be displayed as selected.
    How can I prevent this ?
    My jdev version 11.1.1.5.0
    Edited by: Lovin_JV_941794 on Mar 12, 2013 2:13 AM

    Hi,
    can you remove the attribute
    selectedRowKeys="#{bindings.XXXX.collectionModel.selectedRow}"This would ensure that there are no selected rows persisted. you can also paste the jspx code also for better answer.
    ~Abhijit

  • Pie Chart Only Displays the Data of the First Row of the Table

    Hi Experts,
    I have a problem that the pie chart will not change when click on a second row or other rows on the table. It only displays the data of the first row of the table. How can I set up to make it reflect on any rows when I click the table? Please help, and I would very appreciate that.
    Thanks,
    -Don

    Thanks a lot for your response. I have realized that the pie chart behaves that way, so I just use the filter to see the specific data that I want. Also, you can drag the row and drop it right at the first row to see the data in the pie chart.

  • Table- Why first row Selected from itself

    Hi,
    i have a jspx that have some fields and a button ,
    the user should fill this fields with data then click the button
    the button pass those values to a function that call a Stored Proceudre in the DB
    then the last code in that button is to refresh a table (by execute param) that read the inserted data
    why everytime the table refreshed give me the data with the first row SELECTED!!!!!!!!
    i am using ADFBC + JSF
    thanks in advance

    Hi,
    hope you handled the case where a user hits submit - or performs some other action that is performed on the current row - because you are now in an unpredictable state. Ideally you disable all related command buttons until a user selects a row
    Frank

  • DetailStamp facet iteration stops on the first row.

    Using Jdeveloper 10.1.3.2 using <f: facet name="detailStamp" I am having difficulty getting the iteration working correctly.
    I have placed a related child table to the parent table in the detailStamp. When I run the page I get a Master-Detail table that shows the related child rows of the first row in all the rows of the master table. I have tried the "ADF Developers Users Guide" methodolgy in Chapter 7 section 7.5.2 to use the table's varible to access the correct row accocated to the Master table.
    Steve-

    I read this once and I am not sure why it didn't click the first time I read it. But I believe the answer to my question is in the "Branch Rule Accessor of the Edit Rule page of the Tree Binding Editor. Which reads as follows:
    Branch Rule Accessor: If you are defining the rule for the main table, select the accessor method that returns the detail collection that you want to appear in the inline detail table. The list displays only the accessor methods that return the detail collections for the master collection you selected for the rule. If you are defining the rule for the inline table, select <none>, because you cannot embed a table inside the inline table.
    For more information see the
    "Application Development Framework Developer's Guide"
    Thanks Shay I am going to use the treeTable!
    Message was edited by:
    Steve Hogan

  • BUG - First create actually replaces the first row of the table

    I would like to be able to add new rows to a table and bound the create function to the button. The issue I encounter is the first time I press the button it instead actually changes the first row to be the newly inserted row instead of adding a new row. I have attached the code for my button below, it is very strange. Am I doing something incorrectly? I have the table I'm inserting into bound to the page and I can see the row actually get replaced even though all I am calling is a create method. Is this a bug? Any help would be appreciated. Code is below, I am simply setting the values for the create method prior to the call to the operationbinding:
    public String appendButton_action() {
    BindingContainer bindings;
    bindings = getBindings();
    FacesContext ctx = FacesContext.getCurrentInstance();
    Application app = ctx.getApplication();
    ctx = FacesContext.getCurrentInstance();
    app = ctx.getApplication();
    ValueBinding bind = app.createValueBinding("#{processScope.runId}");
    String runId = (String) bind.getValue(ctx).toString();
    bind = app.createValueBinding("#{bindings.RunId.inputValue}");
    bind.setValue(ctx, runId);
    bind = app.createValueBinding("#{processScope.ConfigurationId}");
    String configId = (String) bind.getValue(ctx).toString();
    bind = app.createValueBinding("#{bindings.ConfigId.inputValue}");
    bind.setValue(ctx, configId);
    OperationBinding operationBinding = (OperationBinding)bindings.getOperationBinding("Create");
    operationBinding.execute();
    operationBinding = (OperationBinding)bindings.getOperationBinding("Commit");
    operationBinding.execute();
    return null;
    }

    I am very disturbed that nobody cares there is a bug in ADF using Oracle BC's. Can somebody respond? It should be impossible to run a create method and get an update on the database without something being wrong in the persistence layer. I understand this is an in-depth question but there should be some resource available to resolve actual issues or at least provide some insight.

  • How to set the first row as selected in single selection of table

    when the page renders how do we make the first row as selected for single selection in a table.
    Thansk a lot for your help

    set the selection Attribute's value to 'Y' for the first row. Thats enough.
    eg;
    Row row=vo.first();
    row.setAttribute("SelectionAttribute", "Y");
    --Prasanna                                                                                                                                                                                                                                                                                                                                           

  • How do I set only the first row of a DataGrid as the selected row?

    I have a "Go" button on a search form that fetches data into an already data bound grid.  After the data is fetched, I want to make the first row in the Datagrid the selected row, as if the user clicked on it.  If the result set is empty, I don't want the code to crash.  (I only want one row to be able to be selected at a time)
                protected function btnGo_clickHandler(event:MouseEvent):void
                    getSBJsResult.token = baa_data_svc.getSBJs(cmbSrch.text);
                    grdSBJs. //  ?????  What goes here to select the first row?

    This should do it.
    If this post answered your question or helped, please mark it as such.
    if(myDataGrid.dataProvider.length > 0){
      myDataGrid.selectedIndex = 0;

  • How to display a table without selecting the first row as default ?

    Hello All,
      Can someone advise on how I am able to display a table but with no row selected on initial display ? Currently, the table is being displayed with the first entry selected by default (The orange box is selected). Thank you very much.
    from
    Kwok Wei

    Javadoc for IWDNode says:
    public void clearSelection()
        Clears the Node's multiple selection; does not change the lead selection.
    public void setLeadSelection(int index)
        Sets the lead selection to the given index. It may be called with NO_SELECTION to reset (clear) the lead selection.
        Parameters:
            index - the index of the element
        Throws:
            ContextException - if caller tries to reset the selection, but selection is mandatory
            IndexOutOfBoundsException - if the given index is not within the element list
        See Also:
            getLeadSelection()
    Armin

Maybe you are looking for

  • Camera Raw 4.5, 4.6, 5.0 and 5.1

    Just to try to answer some questions in advance now that Photoshop CS4 is shipping... Included with Photoshop CS4 is Camera Raw 5.0. Due to the lead timing required ship a product as complex as CS4, the raw format support in Camera Raw 5.0 matches th

  • CALS table in CS3: Table style ??

    Hi, It's not script related but as the xml features are mostly used by developpers, i will be asking here.. The xml format to import table is a bit underdocumented but i was able to find how to assign style using "aid:pstyle" or "aid:cstyle"... wich

  • My vidoes won't play

    i just downloaded the new itunes 7, and as soon as i did all of my video will not play. The window opens but all i here is sound and a green static appears. Sometimes there's no sound at all. not even the videos i bought on itunes will play. please h

  • Can't connect to itunes, need fast help

    hi guys. sometimes i when i buy stuff on itunes it works 100% but 3 weeks ago i had en error. i always chance my information for a second to my father in law cause he has mastercard and i don't and 1 time after i changed and wanted to buy something,

  • Can a iTunes card be used to pay for purchases with a family share?

    Can you use a iTunes card instead of a credit card or debit card with family share? Or can that balance be depleted before charging the credit or debit card?