11-06-2014 1:22 AM
Hi All,
Need to build output similar to below format using cl_salv functions
Example : If particular record attribute have multiple values,the particular cell should be highlighted in color. When user clicks on the highlighted cells, then further records should be displayed.
Doc.Number Doc.Description Language Creation date Material number Created by
001 ABC EN 4/11/14 123 AAA
002 XXX EN 5/11/14 111 BBB
Now when user double clicks on the highlighted colored cells 'EN', the output should be displayed with further details like below
Doc.Number Doc.Description Language Creation date Material number Created by
001 ABC EN 4/11/14 123 AAA
FR
DE
002 XXX EN 5/11/14 111 BBB
If double click again, the records will be shown like previous format of highlighted cells.
I've searched for some of the threads , but not very clear.
Please provide your inputs to achieve this functionality.
Regards,
Keerthi
11-06-2014 6:20 AM
Hi Keerthi,
I have a cumbersome method to this:
First your original itab like this:
001 ABC EN 4/11/14 123 AAA
001 ABC FR 4/11/14 123 AAA
001 ABC DE 4/11/14 123 AAA
002 XXX EN 5/11/14 111 BBB
To add another column 'Group', if other value is same, then group it, this is itab1.
Group1 001 ABC EN 4/11/14 123 AAA
Group1 001 ABC FR 4/11/14 123 AAA
Group1 001 ABC DE 4/11/14 123 AAA
Group2 002 XXX EN 5/11/14 111 BBB
Same time you can generate another itab2 which collect group to itab2:
Group1
Group2
Group3
Remove other lines with document number is same, this is output itab, do not display group column:
Group1 001 ABC EN 4/11/14 123 AAA
Group2 002 XXX EN 5/11/14 111 BBB
I think you should know how to color a cell, then when you click a colored cell, you will get row id:
perform d0100_event_double_click using e_row e_column.
FORM d0100_event_double_click using e_row type lvc_s_row
e_column type lvc_s_col.
if gv_flag eq abap_false.
just loop itab1 where number = clicked group. append lines to output itab without the first line.
gv_flag = abap_ture.
else.
remove those related lines belong current group id.
gv_flag = abap_false.
endif.
sort output itab by group.
call grid refresh method.
ENDFORM.
regards,
Archer
11-06-2014 6:20 AM
Hi Keerthi,
I have a cumbersome method to this:
First your original itab like this:
001 ABC EN 4/11/14 123 AAA
001 ABC FR 4/11/14 123 AAA
001 ABC DE 4/11/14 123 AAA
002 XXX EN 5/11/14 111 BBB
To add another column 'Group', if other value is same, then group it, this is itab1.
Group1 001 ABC EN 4/11/14 123 AAA
Group1 001 ABC FR 4/11/14 123 AAA
Group1 001 ABC DE 4/11/14 123 AAA
Group2 002 XXX EN 5/11/14 111 BBB
Same time you can generate another itab2 which collect group to itab2:
Group1
Group2
Group3
Remove other lines with document number is same, this is output itab, do not display group column:
Group1 001 ABC EN 4/11/14 123 AAA
Group2 002 XXX EN 5/11/14 111 BBB
I think you should know how to color a cell, then when you click a colored cell, you will get row id:
perform d0100_event_double_click using e_row e_column.
FORM d0100_event_double_click using e_row type lvc_s_row
e_column type lvc_s_col.
if gv_flag eq abap_false.
just loop itab1 where number = clicked group. append lines to output itab without the first line.
gv_flag = abap_ture.
else.
remove those related lines belong current group id.
gv_flag = abap_false.
endif.
sort output itab by group.
call grid refresh method.
ENDFORM.
regards,
Archer