cancel
Showing results for 
Search instead for 
Did you mean: 

webdynpro ALV

Former Member
0 Kudos

Hello All,

I want to highlight a perticular line on click of button.

Like if a pernr already exist suppose in the 6th position

and im adding a new pernr in 11th possition. then the 6th line should be high lighted as that is the position where the perne is already there.

Help needed.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

ok

uday_gubbala2
Active Contributor
0 Kudos

Hi Madhvi,

I guess that you have implemented an editable ALV. And now when the user is inputting a value for PERNR in 1 row then you want to make sure that no other entry already exists in the ALV.

Hi Rene,

You need to create an event handler method (say for example CHECK_DATA_CHANGE) for the event ON_DATA_CHECK of the ALV. For this you would have to first:

1) Determine if the data has changed in the ALV.

2) If yes then use the obtained data to compare with the values of PERNR in the ALV.

3) If value already exists then highlight the earlier entry.

In order to realize the first part you would have to first call the DATA_CHECK method of the ALV component. This method checks if any data has changed in the ALV and then triggers the ON_DATA_CHECK event if it finds that something has changed in the ALV. Create an eventhandler method for the ON_DATA_CHECK method. Call this DATA_CHECK method from WDDOAFTERACTION so that whenever any action is performed the system would check if any data has changed in the ALV & then also automatically check if any other matching PERNR values already exist in the ALV. Hope that this is clear for you now.

method WDDOAFTERACTION .
  DATA lo_interfacecontroller TYPE REF TO iwci_salv_wd_table .
  lo_interfacecontroller =   wd_this->wd_cpifc_alv( ).
 
  lo_interfacecontroller->data_check( ).
endmethod.

Now in order to realize the 2nd part of your requirement within this method write the code for reading the table for a matching PERNR value. So you would do something like:

read table lt_data with key pernr = lv_pernr binary search.
if sy-subrc EQ 0.
" Then the value already exists so raise an error message. Else you dont have to do anything.
endif.

To realize the 3rd and final part of the requirement you can use report_attribute_error_message

to highlight the earlier entry.

ex:

CALL METHOD lo_message_manager->report_attribute_error_message
          EXPORTING
            message_text   = 'Sample message text'
            element        = lr_element
            attribute_name = ls_modified_cells-attribute.

Regards,

Uday

Former Member
0 Kudos

Hello Uday,

Thanks for the quick reply. Yes you are correct in stating that. I already have the position at which the repeted pernr is there. Now I want to put my curssor at that position so that the user can see it. Like suppose im in the 200th line , when im adding my pernr adn the repeated pernr is in 10th line then he has to drag it to that position to see it. So the requirement is that the cursour should be moved at that position.

Help will be appriciated.

Former Member
0 Kudos

Hi Madhavi,

You can use one trick here.

For example.

You pernr at 200 and you are going to add the pernr addn which is already at 11th one position.

You can hold up cursor postion in memory area or local varaible.

suppose all list u have in memory then each time of changing/adding/inserting u have to check from memory area and get cursor postion and at same time you have to export your current cursor postion to memory .

I think this will help you.

Rick

Former Member
0 Kudos

Hi Ricky,

Thanks for your reply. Can you please tell me which is the variable which holds the cursor position in the ALV.

Please reply.

Former Member
0 Kudos

Hi Madhvi,

Which of fieldcat sre you using?

I f you using LVC_S_FCAT then just check the fields ROW_POS COL_POS FIELDNAME

I hope you are using

call method gr_grid->register_edit_event

exporting

i_event_id = cl_gui_alv_grid=>mc_evt_enter.

create object gr_event_receiver.

set handler gr_event_receiver->handle_data_changed for gr_grid.

under code of this handler method you can used the fieldcatlog value to export or import.

-Rick

Former Member
0 Kudos

Ricky im not using any field cat. Its a web dynpro ALV im talking about. Can we use a fieldcat even here. If yes pls let me know how can I use it.

Former Member
0 Kudos

Hi Madhavi,

I think you can used fields-sumbols type of fieldcatlog in Method

WDDOBEFOREACTION.

-Rick.

Former Member
0 Kudos

Hi Madhavi ,

Did you get a solution for the change of cursor position in Webdynpro ALV . I have got the same requirement in my project . If yes , Could you tell me how to do that .

Regards ,

Kalpana A .

arjun_thakur
Active Contributor
0 Kudos