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

REUSE_ALV_GRID_DISPLAY Drilldown problem after sorting

Former Member
0 Likes
1,037

Hi All,

I am using the FM REUSE_ALV_GRID_DISPLAY to display a ALV report and have drill down capability to show the POs. But, I am facing a peculiar problem. When the user tries to drill down to show the POs after doing a sort, the PO shown is not correct. It shows the PO of the PO number that was in the same row before the sorting was done.

Please do help me.

Thanks,

Sridhar

Hi All,

Thanks for your replies. I have done all that has been said. My problem is that when the user double clicks on the ALV without pressing the sort button in the ALV display, the index provided in the user-command subroutine is the same as the index of the record in the internal table. But, when the user sorts dynamically when the ALV is displayed and then double clicks, the index of the record provided by ALV is different from the index of that record in the internal table.

For example, when the ALV grid is shown a record is in the 1st row, and when the user double clicks now, the index of this record provided is 1 which is same as the index in the internal table.

But, after the user sorts in the display, if this record moves to the 5th row, the index provided by ALV will become 5, but, actually the index in the internal table is still 1.

Hope I have clarified my problem.

Thanks,

Sridhar

7 REPLIES 7
Read only

Former Member
0 Likes
922

hi

Try with marking the 'Save' attribute in the function module. with this the layout would be saved and may be your problem get solved.

or. If you can sort the table before displaying then it would anyway solve the problem for sure.

-

Santosh

Read only

Former Member
0 Likes
922

Hi

Please use User command in ur program.

Function code for Double click in ALV '&IC1'

Regards

Priyanka

Read only

Clemenss
Active Contributor
0 Likes
922

Sridhar,

the table displayed m u s t be defined global.

If your 'drill-down'-functionality uses routine for event user_command, read the table with index as passed in the parameter.

Regards,

Clemens

Read only

Former Member
0 Likes
922

Hi All,

Thanks for your replies. I have done all that has been said. My problem is that when the user double clicks on the ALV without pressing the sort button in the ALV display, the index provided in the user-command subroutine is the same as the index of the record in the internal table. But, when the user sorts dynamically when the ALV is displayed and then double clicks, the index of the record provided by ALV is different from the index of that record in the internal table.

For example, when the ALV grid is shown a record is in the 1st row, and when the user double clicks now, the index of this record provided is 1 which is same as the index in the internal table.

But, after the user sorts in the display, if this record moves to the 5th row, the index provided by ALV will become 5, but, actually the index in the internal table is still 1.

Hope I have clarified my problem.

Thanks,

Sridhar

Read only

0 Likes
922

Hi Sridhar,

let me repeat: The table displayed must be declared as global data.

It is passed by reference to the ALV function module. It get's sorted as soon as the sort is done in ALV. Otherwise we are talking about different tables.

Please post:

1. Declaration of internal table

2. Call of ALV function

3. USER_COMMAND routine

Regards,

Clemens

Read only

Former Member
0 Likes
922

Hi All,

If my earlier post was very confusing, one simple question would be, how can I know on which field(s) was the grid sorted by the user?

Thanks,

Sridhar

Read only

0 Likes
922

Hi,

Create a subroutine:

FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM

RS_SELFIELD TYPE SLIS_SELFIELD.

CASE R_UCOMM.

WHEN '&IC1'.

READ TABLE IT_EKKO INTO WA_EKKO INDEX RS_SELFIELD-TABINDEX.

set parameter id 'BES' field wa_EKKO-EBELN.

call transaction 'ME23N' and skip first screen.

ENDCASE.

ENDFORM.

Remember you should have declared, the parameter :

I_CALLBACK_USER_COMMAND = 'USER_COMMAND'

in resue_alv_grid_display func.module.

Regards

Subramanian