Application Development 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: 

dynpro with two alv grids

Former Member
0 Kudos

high,

the problem is: i hava dynpro with two alv grids in two containers. first grid shows overview with own fieldcat. double-click on row of first grid shows details in second grid with separate fieldcat. fieldcat of second grid doesn't show every column. when i press the detail-button on second grid i expected to see popup-list with details and all columns of marked row in second grid. but popup shows recordset of first alv-grid with reduced fieldcat (not every data).

if i press detail-button on first grid, i want to see detailed information of row in first grid. same for second grid. what do i have to do? i think that it has to do with fcode an both grids use same fcode for detail-button and system can not decide wich one to use and so it uses first.

thanks for your help!!

Harry

1 ACCEPTED SOLUTION

Former Member
0 Kudos

high all,

thank you for your replies, but they didn't really solve the problem. i think i can live with the situation to add another button to the toolbar and catch own function code. i think that main problem is: how can i copy the functionality of the left detail button. it realizes a popup window that shows all collumns of the grid with the data of the selected row. So best would be to catch the function code of detail-button (i know it could only be the one of grid2 because the detail button of grid1 is invisible) and then raise the same action as the detail-button raises. Clicking the detail-button doesn't seem to be a regular event in class cl_gui_alv_grid, must be hidden.

So this is what i want to do. But so far i think i will try the splitter-container instead of to custom containers. Maybe the splitter container can handle the functioncodes of to grids.

thanks, harry

7 REPLIES 7

Former Member
0 Kudos

Hi Harry,

Yes you are absolutely correct in this regard. The normal ABAP dynpro cannot distinguish between the Function Codes.

But, if you notice then you will see that each of the ALV has it's own function code handling mechanism and you need to play with this to achieve what you have intended to do. You need to register the methods and then populate the user defined function codes which you need to handle in the PAI of the dynpro . Ofcourse you have to take care of passing them from the Control Framework to the ABAP control for your processing.

Have a look at the demo code and samples. You can also look at the SLIS Package which is a huge repository of ALV examples.

I'm also working on writing a sample code which involves dual ALV functionality. I will put it in a Wiki once I'm through with it.

Hope this helps.

Thanks,

Samantak,

former_member1245113
Active Contributor
0 Kudos

Hi,

Check the below thread by Marcin

You might need to adjust this so that it fits your requirement, atlease this would be very helpful in exploring further

Cheerz

Ram

uwe_schieferstein
Active Contributor
0 Kudos

Hello Harald

I assume you are using two different ALV grid instances (e.g. go_grid1 and go_grid2, both CL_GUI_ALV_GRID) for your report.

The toolbar functions of each ALV grid are intrinsically linked to the "parent" grid instance. Thus, in case you are using the default functions of these toolbars they will show the details of the appropriate grid instance.

If the toolbar functions should execute custom functionality you have to add the optional IMPORTING parameter SENDER to your event handler method for USER_COMMAND:


METHOD handle_user_command.

  CASE sender.
    WHEN go_grid1.
      " execute custom function of 1st ALV grid
    WHEN go_grid2.
     " execute custom function of 2nd ALV grid
    WHEN OTHERS.
      CONTINUE.
    ENDCASE.

ENDMETHOD.

Regards

Uwe

Former Member
0 Kudos

high all,

thank you for your replies, but they didn't really solve the problem. i think i can live with the situation to add another button to the toolbar and catch own function code. i think that main problem is: how can i copy the functionality of the left detail button. it realizes a popup window that shows all collumns of the grid with the data of the selected row. So best would be to catch the function code of detail-button (i know it could only be the one of grid2 because the detail button of grid1 is invisible) and then raise the same action as the detail-button raises. Clicking the detail-button doesn't seem to be a regular event in class cl_gui_alv_grid, must be hidden.

So this is what i want to do. But so far i think i will try the splitter-container instead of to custom containers. Maybe the splitter container can handle the functioncodes of to grids.

thanks, harry

0 Kudos

Harry,

I think Guys gave you correct clues in terms of separation for two ALVs. Btw thanks Ram for refering my post:)

As for the issue. The separation should not only be made on display level, where you use separate containers for embeding ALV. There is something more about it, namely the standard functionality for options in ALV toolbar which comes with using separate toolbar for each. Of course having one toolbar convice in better look and feel but for cost of suppressing this standard handling I think it's not worth the gamble.

Anyhow if you persist on having one toolbar for both you may try using function group SAPLSLVC_SERVICES which provides this standard functionality for options in the toolbar. I think in your case you need function LVC_ITEM_DETAIL .This should bring the popup with expected details for the entry either on first or second grid depending on input parameters. Try it out and let us know if that suits your requirement.

Regards

Marcin

0 Kudos

Hello Harald

The container has absolutely nothing do do with toolbar functions.

My assumption is that when you double-click an entry in the 1st ALV grid you fill the 2nd ALV grid within the event handler method HANDLE_DOUBLE_CLICK.

This construction, namely to execute coding within any event handler method, is error-prone because you are still after PBO of your main screen but not yet in PAI.

If my assumption is correct then you should simply trigger PAI within the event handler method using:


" Save the selected record e.g. within a static attribute
" MS_SELECTED_RECORD of the event handler class
CALL METHOD cl_gui_cfw=>set_new_ok_code(ok_code = 'SHOW_DETAIL_LIST' ).


...
MODULE user_command_100.  " PAI
  CASE gd_okcode.
    WHEN 'SHOW_DETAIL_LIST'.
      " Now fill the 2nd ALV list based on the selected record
...
ENDMODULE

Using this logic the program will pass PAI of the main screen followed by PBO. And then you are back at a clearly defined starting point.

Regards

Uwe

Former Member
0 Kudos

high to all

first of all, thank you very much for your helpfull answers. Specially to Marcin Pciak. Was a very good idea to use LVC_ITEM_DETAIL. fixed this problem. i excluded the detail-button and catch the double-click event to show the correct detail-screen.

thanx, harry

Edited by: Harald Schlichte on Jul 6, 2010 5:30 PM