cancel
Showing results for 
Search instead for 
Did you mean: 

ALV Grid with rows sticked together

MichiFr
Participant
0 Kudos

Hi,

Is there any chance to get two <b>rows</b> of an ALV grid sticked together.

This means if the user selects the first row, the second one is automatically selected too. On the other hand, selecting the second row should select the first too.

This also applies if the users deletes one of the two rows.

Using FM REUSE_ALV_GRID_DISPLAY btw. and grouping is not useful in this case.

Thanks,

Michael

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello,

I am not sure if that could be done dynamically however what can be done is when he selects some row and tries to process an event you can check whether the other row is ticked and then pop up a message asking the user the other row will also be selected does he want to proceed with his event of deletion.

So for eg..

*Function Call for ALV List Display

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

i_callback_program = v_repid

i_callback_pf_status_set = 'F_PF_ALV_100'

i_callback_user_command = 'F_USER_COMMAND_2A'

it_fieldcat = i_fieldcat[]

i_save = 'A'

TABLES

t_outtab = i_inci

EXCEPTIONS

program_error = 1

OTHERS = 2.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

and then in the call back user command routine

FORM f_user_command_2a USING wa_ucomm TYPE sy-ucomm

wa_selfield TYPE slis_selfield.

CASE wa_ucomm.

WHEN 'DELETE'.

pop up a dialog box and notify this line will also be selected and delete do you want to proceed... yes delete both lines no... deselect the earlier line... i hope you are using a checkbox in alv...

Regards,

Shekhar Kulkarni

Answers (4)

Answers (4)

MichiFr
Participant
0 Kudos

@all thanks for suggestions and replies.

At the end I will use two internal tables. One holds rows paired and a second one a copy of the first which holds only every second record.

Thanks,

Michael

Former Member
0 Kudos

Michael,

the API for the ALV Grid Control is the class CL_GUI_ALV_GRID. In this class, the method GET_SELECTED_ROWS gives the rows that are selected, and the method SET_SELECTED_ROWS selects rows. Could you program the "sticking together" of the two rows with these two methods?

Michael

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

In the alv grid with, lets say 10 records, say the user selects the 5th record, how would you know which record to make stick to the 5th record, the 4th or the 6th? Do you see what I mean? Or is there only ever two records in the ALV grid?

Regards,

Rich HEilman

MichiFr
Participant
0 Kudos

@Rich,

rows, which should stick together are supposed to be ordered in pairs.

This means row 1 + 2 is a pair, row 3 + 4 is a pair an so on.

Anyway, I understand that there is no solution available in standard ABAP and the used FM so I've to find a manually solution.

Is it possible to hide every second row? E.g. row 2, 4... are hidden inside the ALV. Of course a possible solution is to use a second, internal table, which holds both rows and the primary table which is used for ALV display.

cu,

Michael

Former Member
0 Kudos

Hi michael,

1. For hiding every 2, 4 , 6 row,

i don't think there is any standard functionality

in alv using fm.

2. Anyway, why do u want to do that ?

3. However, u can use another internal table,

and piopulate it with only 1,3,5 etc,

in a loop and show that new internal table.

regards,

amit m.

Former Member
0 Kudos

Hi Michael,

1. The problem is that

using FM, we cannot trap the event

of SELECTING the ROW.

Hence, i don't think anything is possible.

2. Probably, with oo concept, this may be possible.

regards,

amit m.

Former Member
0 Kudos

Hi,

There are no standard functions available for this scenario.

What you can do is that you can handle this in user command. Then by using the sy-ucomm check for the function code whether it is delete/add/etc., then you can play around with the internal table accordingly.

Thanks & Regards,

Message was edited by: Venkat Ramanan Natarajan