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: 

How to add Change Layout Button to ALV Toolbar?

Former Member
0 Kudos

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 you

13 REPLIES 13

Former Member
0 Kudos

Hi,

did you use:


FORM set_pf_status USING rt_extab TYPE slis_t_extab
SET PF-STATUS 'STANDARD' EXCLUDING rt_extab.
ENDFORM.

if yes, try remove unnecessary:


FORM set_pf_status USING rt_extab TYPE slis_t_extab
SET PF-STATUS 'STANDARD'. "remove excluding
ENDFORM.

or


FORM set_pf_status USING rt_extab TYPE slis_t_extab.
delete rt_extab where fcode = '&OAD'.
SET PF-STATUS 'STANDARD' EXCLUDING rt_extab.
ENDFORM.

kind regards,

Former Member
0 Kudos

Are you using FMs or classes?

Rob

0 Kudos

I 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( ).

0 Kudos

Have you set both IS_VARIANT (to sy-repid) and I_SAVE (to 'A') when calling method set_table_for_first_display?

I had the same problem and this was the solution.

Rob

0 Kudos

I am trying to set I_SAVE to 'A' by using


      gr_layout->set_save_restriction( if_salv_c_layout=>restrict_none ).

Is this not the right way?

I am not sure how I am to set IS_VRIANT and I_SAVE when using these classes.

0 Kudos

Try something like:

CLEAR gs_layout.                                 
  gs_layout = sy-repid.                            
    CALL METHOD grid1->set_table_for_first_display 
      EXPORTING                                    
        i_structure_name = 'ZZSTRUCTURE'          
        is_variant       = gs_layout               
        i_save           = 'A'                     
        i_default        = 'X'                     
      CHANGING                                     
        it_outtab        = alv_int.

Rob

0 Kudos

Rob,

What type is your grid1?

I am using


DATA gr_alv TYPE REF TO cl_salv_table.

    ls_layout = sy-repid.
    CALL METHOD gr_alv->set_table_for_first_display
      EXPORTING
        i_structure_name = 'ZMM_YIELD_DETAIL'
        is_variant       = ls_layout
        i_save           = 'A'
        i_default        = 'X'
      CHANGING
        it_outtab        = gt_rpt_details.

Which is giving me the error of 'Method set_table_for_first_display is unknown or PROTECTED or PRIVATE'

thank you

0 Kudos

Was gr_alv instantiated?

Rob

0 Kudos

When I try to do a CREATE OBJECT on gr_alv it throws up this error?

'you cannot create an instance of the class "CL_SALV_TABLE" outside the class'

0 Kudos

I have tried this but it is still not working i get the runtime error NO_FIELDCATALOG_AVAILABLE?



     IF gr_custom_container IS INITIAL.
       CREATE OBJECT gr_custom_container
         EXPORTING container_name = 'ZMM_RPT_CONT'.


             CREATE OBJECT gr_alv
         EXPORTING
           i_parent = gr_custom_container.
     ENDIF.

      "CLEAR gs_layout.
      ls_layout = sy-repid.
      CALL METHOD gr_alv->set_table_for_first_display
        EXPORTING
          i_structure_name = 'ZMM_YIELD_DETAIL'
          is_variant       = ls_layout
          i_save           = 'A'
          i_default        = 'X'
        CHANGING
          it_outtab        = gt_rpt_details.

0 Kudos

I have cleaned up any errors I was having, the program now runs but no display?

is there anything that should come after set_table...?



      IF gr_custom_container IS INITIAL.
        CREATE OBJECT gr_custom_container
          EXPORTING
            container_name = 'ZMM_RPT_CONT'.


        CREATE OBJECT gr_alv
          EXPORTING
            i_parent = gr_custom_container.
      ENDIF.

      "CLEAR gs_layout.
      ls_layout = sy-repid.
      CALL METHOD gr_alv->set_table_for_first_display
        EXPORTING
          i_structure_name = 'ZSMM_YIELD_DETAIL'
          is_variant       = ls_layout
          i_save           = 'A'
          "i_default        = 'X'
        CHANGING
          it_outtab           = gt_rpt_details.


0 Kudos

I am now able to get the ALV to display however it is only with a CALL SREEN 0100...?

shouldn't set_table_for_first_display do this?

0 Kudos

Have a look at the demo programs. I think they all call screen 100.

Rob