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 get custom PF status in ALV using cl_salv_table (Using a container)

0 Kudos

I created a screen and inside that a container.I tried for an ALV display using CL_SALV_TABLE in the cvontainer. It's working. when I opted for default PF status.It's working. But when I tried for custom PF status using SET_SCREEN_STATUS method, it's throwing some exception. But it's working if I don't use a container .

In both the cases I copied PF status into my program from some standard program.Then added some functionality.

3 REPLIES 3

Former Member
0 Kudos

I f you are using Screen and container use CLass:

CL_GUI_ALV_CONTAINER

CL_GUI_ALV_GRID

METHOD-->SET_TABLE_FOR_FIRST_DISPLAY " to display Alv.

Create PF-STATUS in PBO of screen.

[Change standard PF|https://www.sdn.sap.com/irj/scn/wiki?path=/display/abap/change%252balv%252bstandard%252btoolbar%252band%252brespond%252bit]

EXCLUDE Certain buttons on standard toolbar:

DATA: lt_exclude TYPE ui_functions,

ls_exclude TYPE ui_func.

ls_exclude = cl_gui_alv_grid=>mc_fc_sum.

APPEND ls_exclude TO lt_exclude.

CLEAR ls_exclude.

ls_exclude = cl_gui_alv_grid=>mc_mb_filter.

APPEND ls_exclude TO lt_exclude.

CLEAR ls_exclude.

ls_exclude = cl_gui_alv_grid=>mc_mb_sum.

APPEND ls_exclude TO lt_exclude.

pass lt_exclude to METHOD-->SET_TABLE_FOR_FIRST_DISPLAY

Regards,

Gurpreet

naimesh_patel
Active Contributor
0 Kudos

When you use the Container, ALV will expect the Toolbar within that container, not in the PF-STATUS.

When you create an ALV without the Container, you are creating the Full Screen ALV and here you can have your custom PF Status. But when you create the ALV with the container you are creating the ALV Grid. For this Grid, you must use the method ADD_FUNCTION of class CL_SALV_FUNCTIONS to have your function added in the toolbar.

Like:


* Code snippet from the SALV_DEMO_TABLE_FUNCTIONS

*... §3.1 activate ALV generic Functions
    data: lr_functions type ref to cl_salv_functions,
          l_text       type string,
          l_icon       type string.

    lr_functions = gr_table->get_functions( ).
    lr_functions->set_all( gc_true ).

*... §3.2 include own functions
    l_text = text-b01.
    l_icon = icon_complete.
    try.
      lr_functions->add_function(
        name     = 'MYFUNCTION'
        icon     = l_icon
        text     = l_text
        tooltip  = l_text
        position = if_salv_c_function_position=>right_of_salv_functions ).
      catch cx_salv_existing cx_salv_wrong_call.
    endtry.

Check report: SALV_DEMO_TABLE_FUNCTIONS

Regards,

Naimesh Patel