2009 Mar 26 11:46 AM
I have a ALV Gris on the screen. I don't wan't to have a toolbar on the screen, but I still wan't to be able to download the ALV as HTML. (hide using layout-no_toobar = 'X')
This is done by using standard functioncode &HTML. But How do i trigger this code from my own button ?
2009 Mar 26 7:11 PM
You have to call the method EXECUTE_FCODE to execute the same function what ALV grid buttons can do.
Since EXECUTE_FCODE is private method, we can't call it from outside.
There is one method FCODE_BOUNCER (Internal, Temporary, Do not Use!) which can be used to achieve this functionality.
Try like this in your PAI.
CASE OK_CODE.
WHEN 'EXIT'.
PERFORM EXIT_PROGRAM.
when 'HTML'.
break-point.
sy-ucomm = '&HTML'.
grid1->FCODE_BOUNCER( ).
WHEN OTHERS.
* do nothing
ENDCASE.
Regards,
Naimesh Patel
I have a ALV Gris on the screen. I don't wan't to have a toolbar on the screen, but I still wan't to be able to download the ALV as HTML. (hide using layout-no_toobar = 'X')
This is done by using standard functioncode &HTML. But How do i trigger this code from my own button ?
2009 Mar 26 11:54 AM
Hi,
Create a pf-status for your report program.
Goto SE41 --> create a new pf-status for your program --> on next screen click menu EXTRAS --> select ADJUST TEMPLATE radiobutton --> click done.
You will a get a pf-status will all standard buttons.
Delete the unwanted buttons from pf-status and keep the one you need.
To have standard functionality rather than coding by your side.
Hope this helps you.
Regards,
Tarun
2009 Mar 26 12:00 PM
I allready have a toolbar on my screen. But assigning the function code &HTML to a button does not trigger this function code in the ALV. I guees that the ALV thinks that this is a custom code rather than a standard function code that has to be handled by CL_GUI_ALV_GRID.
2009 Mar 26 12:05 PM
Hi,
As you said there already a button on alv toolbar to download alv as html.
So dont hide the toolbar.
Keep the toolbar as it is.
Rather you can just remove the other button (not the download to html one) using the technique told to you in earlier reply.
Or you can exclude the other button from alv (not the download to html one) using the code:-
*FOR EXCLUDING STANDARD BUTTON FROM ALV TOOLBAR
DATA : it_exclude TYPE slis_t_extab,
wa_exclude TYPE slis_extab.
*&---------------------------------------------------------------------*
* FOR EXCLUDING STANDARD BUTTONS FROM ALV TOOLBAR
*&---------------------------------------------------------------------*
wa_exclude-fcode = '&OUP'.
APPEND wa_exclude TO it_exclude.
CLEAR wa_exclude.
wa_exclude-fcode = '&ODN'.
APPEND wa_exclude TO it_exclude.
CLEAR wa_exclude.
wa_exclude-fcode = '&OAD'.
APPEND wa_exclude TO it_exclude.
CLEAR wa_exclude.
wa_exclude-fcode = '&INFO'.
APPEND wa_exclude TO it_exclude.
CLEAR wa_exclude.
"similarly append more function codes for standard buttons that needs to be excluded
"you can get to know the func code for the button by enabling debugging at run time
"and check valus for sy-ucomm and append it to it_exclude
"dont pass &HTML i.e., for download to html button
*&---------------------------------------------------------------------*
* DISPLAY RECORDS IN ALV GRID
*&---------------------------------------------------------------------*
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
it_fieldcat = it_field
it_excluding = it_exclude "<--exclude buttons from toolbar
TABLES
t_outtab = it_final
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
ENDIF.
Using the above code you will have only one button i.e, for download alv as html.
Use this standard button to perform as per your requirement.
Hope you get it.
Regards,
Tarun
2009 Mar 26 12:09 PM
There is no room on the screen to display the "standard" ALV Grid toolbar.
I have 2 ALV Grids on the screen and the button - on my own toolbar - shold trigger download of both grid to HTML.
2009 Mar 26 12:12 PM
You need to Register Class & Set handlers and Set the tool bar active to make it work
*-- Register Class & Set handlers -------------------------------------*
SET HANDLER W_RECIVER->HANDLE_TOOLBAR FOR W_GRID.
*-- Set the tool bar active -------------------------------------------*
CALL METHOD W_GRID->SET_TOOLBAR_INTERACTIVE.Also refer Program BCALV_TEST_GRID_TOOLBAR
2009 Mar 26 12:17 PM
Hi,
If you use the first reply from me.
And you create a pf-status with the standard button for ALV to HTML and delete all the other buttons and then add other buttons that you are already using on your toolbar currently.
It would seem like your own toolbar, and not like the standard one.
Why to code unnecessarily, if standard functionality is given to you.
Else if you want to code on your own button, then you need to use the same concept as in standard code, which can be referred using debugging.
Hope this helps you.
Regards,
Tarun
2009 Mar 26 12:28 PM
I have tested this, and the ALV grid does not react on any standard buttons from a standard toolbar. I guess the toolbar has to bee created in OO to the CL_GUI_ALV_GRID.
2009 Mar 26 4:46 PM
2009 Mar 26 5:45 PM
This is the other way round.
It shows how to add own buttons to the status of the ALV Grid - basicly what Karan says abow.
But I want to add a button from Standard ALV Grid to my own Status, and trigger the standard function code.
The reason I wan't to do this is to save space. The ALV grid is displayed in a container on a screen. If I enable the standard status it is displayed on the screen in the container, but the space on the screen where the "normal" status is would be displayed is blank - not compressed, and therefor it is wast of space.
I have made pictures showing what I want to do :
First picture is how I want it to look (last button should be "Download to HTML)
[http://peecee.dk/upload/view/162204]
Second pictures is how the screen looks when I enable the toolbar for the ALV Grid
[http://peecee.dk/upload/view/162205]
Last picture is how it would look if I used the abow code and added my buttons to the ALV standard toolbar - leaving the space where the "normal" toolbar is empty
[http://peecee.dk/upload/view/162206]
2009 Mar 26 5:59 PM
Hi,
Could you please let me know how you are calling the function module...
just try with this code as well and let me know if it works.
TYPE-POOLS : slis.
data :
t_event TYPE slis_t_event.
fs_event-name = 'PF_STATUS_SET'.
fs_event-form = 'PF_STAUTS'. " This is the subroutine of you program
APPEND fs_event TO t_event.
layout-no_toolbar = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
EXPORTING
i_callback_program = sy_cprog
is_layout_lvc = layout
it_fieldcat_lvc = t_field_catalog
it_events = t_event
TABLES
t_outtab = pc_table
EXCEPTIONS
program_error = 1
OTHERS = 2.
FORM PF_STATUS USING pv_rt_extab TYPE slis_t_extab.
SET PF-STATUS space IMMEDIATELY.
ENDFORM.If this doesn't work please do let me know how you are calling the function module and which FM you are using to display the grid
Regards,
Siddarth
2009 Mar 26 6:49 PM
I have created a screen in screenpainter where a custom control is placed.
In this control I'm displaying the AVL grid :
CALL METHOD grid2->set_table_for_first_display
EXPORTING
i_structure_name = 'ZAF85_3'
it_toolbar_excluding = gt_toolbar_excluding
is_layout = ls_layout
CHANGING
it_fieldcatalog = lt_fieldcat[]
it_sort = lt_sort
it_outtab = gt_output.An because I'm using screen painter the status is set as normal in PBO
2009 Mar 26 7:11 PM
You have to call the method EXECUTE_FCODE to execute the same function what ALV grid buttons can do.
Since EXECUTE_FCODE is private method, we can't call it from outside.
There is one method FCODE_BOUNCER (Internal, Temporary, Do not Use!) which can be used to achieve this functionality.
Try like this in your PAI.
CASE OK_CODE.
WHEN 'EXIT'.
PERFORM EXIT_PROGRAM.
when 'HTML'.
break-point.
sy-ucomm = '&HTML'.
grid1->FCODE_BOUNCER( ).
WHEN OTHERS.
* do nothing
ENDCASE.
Regards,
Naimesh Patel
2009 Mar 26 7:55 PM
YES !
I found out that the EXECUTE_FCODE was privat - cause I tried to call it. But this "BOUNCER" does exactly what I want.
So the big question now - is there another way (that is released) ?
2009 Mar 27 1:11 PM
There are two more methods which call the EXECUTE_FCODE.
DISPATCH - Dispatch
SET_FUNCTION_CODE - Internal Use Only!
So, I guess we don't have much luck here.
Regards,
Naimesh Patel
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |