Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

alv grid display

Former Member
0 Likes
676

Hi,

when iam displaying the output using ALV Grid display, in the output always the first row first column is showing yellow.

the problem with this is iam using this scree for interactive ALV so even the user doesnt select any line it will take the first line as the default one.

So when i select any push button on the ALV display without select any row it is taking the first one as default and displaying the output.

Hope iam clear in putting my problem before you experts, please help me out in resolving this issue thanks in advance.

Hi,

when iam displaying the output using ALV Grid display, in the output always the first row first column is showing yellow.

the problem with this is iam using this scree for interactive ALV so even the user doesnt select any line it will take the first line as the default one.

So when i select any push button on the ALV display without select any row it is taking the first one as default and displaying the output.

Hope iam clear in putting my problem before you experts, please help me out in resolving this issue thanks in advance.

4 REPLIES 4
Read only

Former Member
0 Likes
629

Hi,

In Your User Command routine, first you have to check whether any record is selected or not. If selected then only your logic should be executed. otherwise not.

thanks,

sksingh

Read only

0 Likes
629

Hi,

Thanks for responding i am stuck with the logic how to implement the one which you said if possible please send me the example code.

Read only

0 Likes
629

Hi Madan,

Just put it In the place where you have the code that gets executed when the button gets pushed.

Maybe something like:


form user_command_occured importing i_ucomm.

DATA:
LT_INDEX_ROWS	Type	LVC_T_ROW,
LT_ROW_NO	Type	LVC_T_ROID,
row             type    lvc_s_roid,
wa              like    line of out_tab. 
* assuming out_tab is what you passed to the ALV

if i_ucomm = <the button you want to respond to>.
*   first check a row has been selected.
  call method alv_grid->get_selected_rows
      importing
         et_index_rows = lt_index_rows
         et_row_no       = lt_row_no.
  
  if lt_index_rows is initial.
*   no rows selected, only cells.
  else.
    read table lt_row_no into row index 1. "assuming only 1 row selected
    read table out_tab into wa index row-row_id.
    perform <output_form> using wa.
  endif.

endif.

endform.

Cheers,

Phil

Message was edited by:

Phillip Manning

Read only

Former Member
0 Likes
629

Hi Madan,

You can notice that when the alv grid starts, the 1st row, 1st column is yellow.

But as soon as you click anywhere in that row, the whole row gets selected.

Therefore, if you use the method 'get_selected_rows', then this will:

1) return an empty table if there are only cells or columns selected.

2) return a non-empty table if there are rows selected

So you can determine whether a user has actually clicked on a row or not.

Hope this helps,

Phil