ALV SAVE BUTTON IN CHANGE LAYOUT
HALLOW I USE A ALV AND I WONT TO HAVE A BUTTON OF SAVE IN TOOL BAR IN THE <b>butten cange layout</b> HOW CAN I DO THAT?THANKES
THIS IS MY ALV CODE
dATA: ok_code LIKE sy-ucomm,
g_container TYPE scrfname VALUE 'BCALV_GRID_DEMO_0100_CONT1',
grid1 TYPE REF TO cl_gui_alv_grid,
g_custom_container TYPE REF TO cl_gui_custom_container.
DATA:
gt_fieldcatalog TYPE lvc_t_fcat WITH HEADER LINE ,
is_stable TYPE lvc_s_stbl VALUE 'XX' ,
fcat TYPE lvc_t_fcat,
wa_fcat LIKE LINE OF fcat,
ct_fieldcat TYPE slis_t_fieldcat_alv,
wa_fieldcat TYPE LINE OF slis_t_fieldcat_alv,
g_save(1) TYPE c,
seltab TYPE TABLE OF rsparams WITH HEADER LINE,
table_header(23) TYPE c.
DATA: fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE,
gd_tab_group TYPE slis_t_sp_group_alv,
gd_layout TYPE slis_layout_alv,
gd_repid LIKE sy-repid.
& Module PBO OUTPUT
text
MODULE pbo OUTPUT.
SET PF-STATUS 'MAIN100'.
IF g_custom_container IS INITIAL.
CREATE OBJECT g_custom_container
EXPORTING container_name = g_container.
CREATE OBJECT grid1
EXPORTING i_parent = g_custom_container.
CALL METHOD grid1->set_table_for_first_display
EXPORTING
i_structure_name = 'YHR_Q4_STR'
CHANGING
it_outtab = itab
it_fieldcatalog = fcat. " FOR FIELD CATALOG
ENDIF.
Hi,
i hope this will help..
Make sure that you pass the variant also.
data: variant type disvariant.
variant-report = sy-repid.
variant-username = sy-uname.
CALL METHOD GR_ALVGRID->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
IT_TOOLBAR_EXCLUDING = GT_EXCLUDE
IS_LAYOUT = GS_LAYOUT
is_variant = variant
I_SAVE = 'A'
CHANGING
IT_FIELDCATALOG = GT_FIELDCAT
IT_OUTTAB = ITAB.
Regards,
Srini
Similar Messages
-
ALV OO: how to change layout more than once using custom pushbuttons?
Hello,
I'm developing a report using ALV Class CL_GUI_ALV_GRID.
It's nearly complete. but I need to add some little feature.
I create pushbuttons on GUI Status in order to show/hide totals and to group/ungroup fields according.
I have already created and I added them into PAI of corresponding dynpro, as follows.
GROUP/UNGROUP FIELDS:
DATA: g_editable_alv1 TYPE REF TO cl_gui_alv_grid.
DATA: tb_fieldcat_1 TYPE lvc_t_fcat.
DATA: tb_sort_1 TYPE lvc_t_sort.
FIELD-SYMBOLS: <fs_fieldcat> TYPE lvc_s_fcat.
CALL METHOD g_editable_alv1->set_sort_criteria
EXPORTING
it_sort = tb_sort_1
EXCEPTIONS
no_fieldcatalog_available = 1
OTHERS = 2.
CALL METHOD g_editable_alv1->refresh_table_display
EXPORTING
i_soft_refresh = 'X'
EXCEPTIONS
finished = 1
OTHERS = 2.
When I wanto to sort and group using fields CID and PSPID_VDATU, table TB_SORT_1 is filled as follows:
SPOS FIELDNAME UP DOWN GROUP SUBTOT COMP EXPA SELTEXT
01 |CID |X | | |X | |X |
02 |PSPID_VDATU |X | | |X | |X |
SHOW/HIDE TOTALS:
I have to show/hide totals for all fields with domain name ARBEIT. In this sample I copy code to be run when I want to show totals:
LOOP AT tb_fieldcat_1 ASSIGNING <fs_fieldcat>
WHERE domname = 'ARBEIT'.
<fs_fieldcat>-do_sum = 'X'.
ENDLOOP.
CALL METHOD g_editable_alv1->set_frontend_fieldcatalog
EXPORTING
it_fieldcatalog = tb_fieldcat_1.
CALL METHOD g_editable_alv1->refresh_table_display
EXPORTING
i_soft_refresh = 'X'
EXCEPTIONS
finished = 1
OTHERS = 2.
OK, both features (and their opposite ones) works *only once*.
I mean: first time ALV is displayed according standard layout. Then I click on one of my new pusbutton and it works (ALV layouts is changed). If I click again one of my pushbutton, nothng happens.
Edit: I tried also to use CALL METHOD g_editable_alv1->refresh_table_display. (without any parameter), but nothing changed.
What should I modify in order to be able to use my pushbuttons as many times as I want?
Thank you and best regards
GuidoYour approach is ok. I think you are missing MODIFY statement when setting new fieldcatalog. Please follow my code, it works fine.
DATA: r_cust TYPE REF TO cl_gui_custom_container,
r_alv TYPE REF TO cl_gui_alv_grid.
DATA: it_fcat TYPE lvc_t_fcat WITH HEADER LINE.
DATA: it_sflight TYPE TABLE OF sflight.
DATA: it_sort TYPE lvc_t_sort WITH HEADER LINE.
"event handler class
CLASS lcl_handler DEFINITION.
PUBLIC SECTION.
CLASS-METHODS:
handle_toolbar FOR EVENT toolbar OF cl_gui_alv_grid
IMPORTING e_object e_interactive,
handle_user_command FOR EVENT user_command OF cl_gui_alv_grid
IMPORTING e_ucomm sender.
ENDCLASS. "lcl DEFINITION
CLASS lcl_handler IMPLEMENTATION.
METHOD handle_toolbar.
DATA: ls_toolbar TYPE stb_button.
MOVE:
0 TO ls_toolbar-butn_type,
'FC_BTN' TO ls_toolbar-function,
'Show/hide totals' TO ls_toolbar-text.
APPEND ls_toolbar TO e_object->mt_toolbar.
ENDMETHOD . "handle_toolbar
METHOD handle_user_command.
DATA it_fcat TYPE lvc_t_fcat.
DATA wa_fcat TYPE lvc_s_fcat.
IF e_ucomm = 'FC_BTN'.
sender->get_frontend_fieldcatalog( IMPORTING et_fieldcatalog = it_fcat ).
LOOP AT it_fcat INTO wa_fcat WHERE fieldname = 'PRICE' .
IF wa_fcat-do_sum = 'X'.
wa_fcat-do_sum = space.
ELSE.
wa_fcat-do_sum = 'X'.
ENDIF.
MODIFY it_fcat FROM wa_fcat.
ENDLOOP.
sender->set_frontend_fieldcatalog( it_fcat ).
CALL METHOD sender->refresh_table_display
EXPORTING
i_soft_refresh = 'X'.
ENDIF.
ENDMETHOD. "handle_user_command
ENDCLASS. "lcl IMPLEMENTATION
INITIALIZATION.
SELECT * FROM sflight INTO TABLE it_sflight UP TO 20 ROWS.
START-OF-SELECTION.
CALL SCREEN 100.
MODULE pbo OUTPUT.
IF r_cust IS NOT BOUND.
CREATE OBJECT r_cust
EXPORTING
container_name = 'CUSTOM_CONTAINER' .
CREATE OBJECT r_alv
EXPORTING
i_parent = r_cust.
it_sort-fieldname = 'CONNID'.
it_sort-up = 'X'.
APPEND it_sort.
CALL METHOD r_alv->set_table_for_first_display
EXPORTING
i_structure_name = 'SFLIGHT'
CHANGING
it_outtab = it_sflight.
SET HANDLER: lcl_handler=>handle_user_command FOR r_alv,
lcl_handler=>handle_toolbar FOR r_alv.
CALL METHOD r_alv->set_toolbar_interactive.
ENDIF.
ENDMODULE. "pbo OUTPUT
Regards
Marcin -
Display Subtotals on ALV Report W/O changing Layout
Hi ,
I need to display subtotals of quantity fields in my output of report ,with corresponding production order by using ALV container,Layout default seetings won't work here because user has to do many operations such as sorting filtering etc ,after displaying the reportCheck these threads out
http://www.sap-basis-abap.com/sapalv.htm
http://help.sap.com/saphelp_nw04/helpdata/en/ee/b99d37e188a049e10000009b38f8cf/content.htm
http://www.sapfans.com/forums/viewtopic.php?t=20386
http://www.sapfans.com/forums/viewtopic.php?t=85191
http://www.sapfans.com/forums/viewtopic.php?t=88401
http://www.sapfans.com/forums/viewtopic.php?t=17335
DATA SORTING AND SUBTOTAL
DATA: GS_SORT TYPE SLIS_SORTINFO_ALV.
CLEAR GS_SORT.
GS_SORT-FIELDNAME = 'FIELD1'.
GS_SORT-SPOS = 1.
GS_SORT-UP = 'X'.
GS_SORT-SUBTOT = 'X'.
APPEND GS_SORT TO GT_SORT.
CLEAR GS_SORT.
GS_SORT-FIELDNAME = 'FIELD2'.
GS_SORT-SPOS = 2.
GS_SORT-UP = 'X'.
*GS_SORT-SUBTOT = 'X'.
APPEND GS_SORT TO GT_SORT.
Regards -
Regarding editable alv save button
Hi Friends,
I have an ALV report in which one of the Column is in editable mode.
i want to edit that column field with new value and press save .
Friends , i want to know what should i write to get things done.
regards,
RajeshHi Friends,
I have an ALV report in which one of the Column is in editable mode.
i want to edit that column field with new value and press save .
Friends , i want to know what should i write to get things done.
regards,
Rajesh -
Window 7 Home Edition, Firefox 4
Instead GarageBand recognize my keyboard and i can play normally, also, if it can help, those are the Audio and Midi Logic Preferences and the Controller Surfaces Setup with the keyboard connected :
-
ALV change layout button in toolbar
Hi,
I have an ALV,which has a change layout option in its toolbar.I want to save layouts which r user specific.Please help me with this isse.
ThanksThe following is where a user can enter a display variant
the no display can be used if the grid output is not to
be controlled by the users variant.
PARAMETERS p_layout LIKE disvariant-variant.
w_layout-grid_title = sy-title.
w_layout-zebra = 'X'
w_layout-sel_mode = 'B'.
w_layout-cwidth_opt = 'X'
w_variant-handle = p_layout.
w_variant-report = sy-repid.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = gd_repid
i_callback_top_of_page = 'TOP-OF-PAGE' "see FORM
i_callback_user_command = 'USER_COMMAND'
* i_grid_title = outtext
is_layout = gd_layout
it_fieldcat = fieldcatalog[]
* it_special_groups = gd_tabgroup
it_events = gt_events
is_print = gd_prntparams
i_save = 'X'
is_variant = w_variant
tables
t_outtab = it_ekko
exceptions
program_error = 1
others = 2.
if sy-subrc <> 0.
Reward if this helps. -
Changing layout of ALV to excel and displaying the data there
Dear All,
My requirement is that I have to develop an ALV report, and also plot the graphs for the same.
I need different types of graphs, so I have searched on SDN, and I found out a blg:-
"Report with a Graph.. An Approach!"
Here is what the person has done:-
I developed a simple ABAP report using ALV and just dumped all my data on it.
After this I downloaded the Standard Excel template available in the ALV.
Defined my own worksheets in this template, wrote some macros to pick up the data from the RawHeader sheet, which is available by default and will contain the ALV data.
I inserted 1 chart in this Excel template. In this chart I used the same chart type as was being used by the user for his graph. Just right clicked on the Graph area and made the changes in the source data and made it point to the sheet containing the final data.
Thats it my job is almost done.
After this uploaded this template back into the report output through
the layout settings->Change Layout Tab.
Save it as a variant and made it a default. (Do not default it if you have more than 1 user and more than 1 template . Select the appropriate variant for the appropriate user and then display)
Well, this also was not that easy as I had thought. I landed up into 1 trouble.
In my report the number of columns displayed was not constant and kept changing based on the input. This fact was taken care by designing a variable field catalogue. But now I had gone past the simple ALV display and was giving the output in an Excel sheet using a pre-defined template. Well, I immediately found a solution to this with the set_frontend_fieldcatalogue method of CL_GUI_ALV_GRID class and fixed the field catalogue every time after calling the set_table_for_first_display method. This solved most of my problems, which were not many though.
Now here are my issues:-
I have developed the ALV report, and I have also changed the layout to excel.
But, I am unable to get the ALV Report data in the RawHeader Sheet, which is available by default.
Could anyone please guide me through this method??
It is urgent.
Points are assured for helpful answers.
Thanks and regards,
PrernaHi Satya Priya,
Do I have to create my own template, or the Standard ones available will do?
HEre is what I do:-
Once I get my ALV output, I goto Change LAyout->View tab.->Prefered view->Microsoft Excel.
Here I get a list of available excel templates There are 2:-
sap_mm.xls, and sap_om.xls
I select one of these, and the excel spreadsheet is displayed on the ALV screen.
But the re is another button, "Upload Document to BDS".
Do I have to upload one of the above templated to BDS?
And please tell me in detail, what is BDS???
Thanks for your help, and waiting for reply,
Prerna -
Hello All,
I am using the class 'cl_salv_table' to create an ALV. In the application toolbar I have the option to change the layout displayed in tha ALV but I am not able to save my changed layout. Please suggest how do I enable the save layout button in the toolbar.
Thanks,
AnjuThis demo example creates a PF status for displaying the buttons, Can I not get the buttons using the standard functions available with the ALV. I am getting the change layout on its own I am not reqd to create a PF status for it. Can I not enable the button save layout also. Also if I create the PF status I would have to add all the buttons reqd in the ALV in the PF status manually
thanks,
Anju -
Hide Change Layout Button in ALV report o/p for MB52 Tcode
Hi,
Is it possible to Hide Change Layout Button in ALV output for Report MB52 using authoriztaion.
We have created a layout in which we are hiding some coloumns which the user should not see.
But if the change layout button is active then the user can add those coloumns to output.
Is this possible through authorizations. I want to avoid doing any chnages to the std sap program.
Thanks & Regards,
FawazCheck the object S_ALV_LAYO
-
How to get save button for saving the layout in OO ALV
Hi all,
When I execute my report an OO ALV, I want to save the layout and make it default.Please tell me how to do it.
I am using the below code.
*Call ALV
CALL METHOD c_alvgd->set_table_for_first_display
EXPORTING
is_layout = gd_layout
i_save = 'X'
CHANGING
it_outtab = it_ekko
it_fieldcatalog = it_fieldcat
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
even after passing i_save eq 'X', it is not showing save option in the layout.
please help.
thanks,
Siddhartha PrakashHi,
You need to pass the call back program name also.
CLEAR wa_variant.
MOVE sy-repid TO wa_variant-report.
CALL METHOD wcl_alvgrid1->set_table_for_first_display
EXPORTING
I_BUFFER_ACTIVE = space
I_BYPASSING_BUFFER = c_x
* I_CONSISTENCY_CHECK =
* I_STRUCTURE_NAME =
IS_VARIANT = wa_variant "variant options
i_save = c_x
I_DEFAULT = c_X
is_layout = wa_layout
Thanks,
Vinod. -
How to add Change Layout, savelayout, select layout Button to ALV Toolba
How to add Change Layout, savelayout, select layout Button to ALV Toolbar?
Moderator message: please (re)search yourself before asking.
[Asking Good Questions in the Forums to get Good Answers|/people/rob.burbank/blog/2010/05/12/asking-good-questions-in-the-forums-to-get-good-answers]
locked by: Thomas Zloch on Sep 10, 2010 10:57 AMVariant
CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
EXPORTING
is_variant = gs_variant
i_save = c_save
it_default_fieldcat =
IMPORTING
e_exit = gf_exit
es_variant = gs_variant
EXCEPTIONS
not_found = 2.
IF sy-subrc = 2.
MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
IF gf_exit = space.
cf_varia = gs_variant-variant.
ENDIF.
ENDIF.
CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
EXPORTING
i_save = c_save
CHANGING
cs_variant = gs_variant
EXCEPTIONS
wrong_input = 1
not_found = 2
program_error = 3
OTHERS = 4.
IF sy-subrc NE 0.
cf_subrc = sy-subrc.
ENDIF.
Change Layout, savelayout, select layout Button pass the value which is in BOLD
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = gd_repid
i_callback_user_command = 'U_COMMAND'
i_callback_top_of_page = 'TOP-OF-PAGE'
is_layout = fld_lay
it_fieldcat = fieldcatalog[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT = it_sort[]
i_default = 'X'
i_save = 'A'
is_variant = gs_variant
it_events = it_event[]
TABLES
t_outtab = it_sales
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
Annasaheb -
How to add Change Layout Button to ALV Toolbar?
Hi All,
I am using a SAP GUI STATUS 'STANDARD' that has almost all the funcationality needed except for the change layout button.
I have tried changing the GUI STATUS to 'STANDARD_FULLSCREEN' which has the button I am looking for but it does not show up.
What am I missing to have the 'Change Layout' Button show on the toolbar?
thank youI am using Classes.
I did not specify any type of table of 'exclude' buttons.
here is my code that display the ALV
DATA gr_alv TYPE REF TO cl_salv_table.
DATA gr_functions TYPE REF TO cl_salv_functions_list.
DATA gr_selections TYPE REF TO cl_salv_selections.
DATA gr_events TYPE REF TO cl_salv_events_table.
DATA gr_settings TYPE REF TO cl_salv_display_settings.
DATA gr_layout TYPE REF TO cl_salv_layout.
TRY.
cl_salv_table=>factory(
IMPORTING r_salv_table = gr_alv
CHANGING t_table = gt_rpt_details ).
PERFORM f_display_settings.
gr_alv->set_screen_status(
"pfstatus = 'Z_STANDARD'
pfstatus = 'ZSTANDARD_FULLSCREEN'
report = sy-repid
"i_save = 'A'
set_functions = gr_alv->c_functions_all ).
gr_events = gr_alv->get_event( ).
"create layout object
CREATE OBJECT gr_layout.
gr_layout->get_current_layout( ).
CREATE OBJECT event_handler.
SET HANDLER event_handler->on_user_command FOR gr_events.
gr_functions = gr_alv->get_functions( ).
gr_functions->set_all('X').
gr_functions->set_group_filter( value = if_salv_c_bool_sap=>false ).
* Set print preview
gr_functions->set_print_preview( ).
gr_alv->get_display_settings( ).
gr_alv->display( ). -
Save Layout and change Layout button.
Hi Guys,
Im calling the below method of class: cl_gui_alv_grid.
gs_variant_lic-report = sy-repid.
gs_variant_lic-username = sy-uname.
CALL METHOD gi_alv_lic->set_table_for_first_display
EXPORTING
i_structure_name = 'Z_STRUC'
is_variant = gs_variant_lic
i_save = 'A'
is_layout = ls_layout
However, the Select layout and Save Layout button dont appear.
Instead i get the button 'Choose Layout'.
If i dont pass gs_variant, i get single button 'Change Layout'.
My requirement is to get 3 buttons: 'Change Layout', 'Select Layout' and 'Save Layout'.
How can i achieve that?
Thanks,
Rohit.Please share how did u solved it?
-
Hide 'Change Layout' button from alv toolbar
Hello All,
can anyone let me know how can we hide the change layout button or exclude the change layout button from the ALV tool bar using OOPS . what's the fcode for it.
Thank You !
RaviHi Ravi,
Please refer to this [Program|http://www.saptechies.com/disable-some-standard-buttons-from-alv-display/].
Hope this helps.
Regards,
Chandravadan -
What is the constant name for Change layout Button in ALV Grid ABAP Objects
Dear All,
I have one query please help me.
what is the constant name for Change layout Button in ALV Grid ABAP Objects.
With Rgds,
BabuHalo Vinod,
The consant name is cl_gui_alv_grid=>mc_fc_current_variant.
Regards
Arshad
Maybe you are looking for
-
Setting adapter Ldap in Oracle Virtual Directory
I'm setting up a new adapter in Oracle Virtual Directory for a OpenLDAP, something curious happens does not enable me finish the button, another detail is when I click on SSL I get the following message: could not load certificate chain: java.lang.ex
-
I added a textarea to vrgoup container and added that vgroup as popup to the application. while i am trying to focus into the textarea , it always throwing me null object reference. to see that you need to have debugger version of flash player instal
-
what do you suppose is wrong with my macbook pro seeing as the apple store have just replaced a MLB at $945aus because of a failed graphic card. the new one they replaced lasted 4 weeks and again a blank screen.
-
Report for Partnership hierarchy
Hi, I would like to know if there is a way to show the partners of a partner into a report. I'm able to show for each Account name which are the names of the partners for that account, I'm interested to reiterate such information in order to have the
-
What's the usage of package interface?
Hi Experts: Who knows what the usage of package interface is? How to use it in ABAP development?