Skip to Content

Display ALV on container on screen.

Hello All,

I am trying to display an internal table in an ALV in a container on screen.

Here is what I am trying to do.

DATA: salv_ref TYPE REF TO cl_salv_table.

DATA: lr_columns TYPE REF TO cl_salv_columns_table.

DATA: data_container TYPE REF TO CL_GUI_CONTAINER.

select stmt in internal table.

call screen 100.  //  a custom container is placed on the screen name = TAB_CONTAINER

---------------------

PBO 100.

CREATE OBJECT data_container

  EXPORTING

    clsid                          =     SPACE " Class ID of This Container

    container_name                 =     'TAB_CONTAINER'

  EXCEPTIONS

    cntl_error                     = 1

    cntl_system_error              = 2

    create_error                   = 3

    lifetime_error                 = 4

    lifetime_dynpro_dynpro_link    = 5

    lifetime_dynpro_illegal_parent = 6

    others                         = 7

  .

IF sy-subrc <> 0.

* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

*            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

cl_salv_table=>factory(

  EXPORTING

    r_container    =  data_container

  IMPORTING

    r_salv_table   =  salv_ref

  CHANGING

    t_table        = lt_tab_form

).

salv_ref->display( ).

But I am not seeing anything on the screen.

Could you please suggest where I am doing it wrong.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • avatar image
    Former Member
    Jan 14, 2015 at 09:01 AM

    Hi,

    try to add parameter "container_name"

    cl_salv_table=>factory(

      EXPORTING

        r_container    =  data_container

       container_name = ' TAB_CONTAINER''

      IMPORTING

        r_salv_table   =  salv_ref

      CHANGING

        t_table        = lt_tab_form

    ).

    Best regards,
    Serge M

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jan 14, 2015 at 09:02 AM

    Hi,

    try to pass container name also to factory method.

    cl_salv_table=>factory(

      EXPORTING

        r_container    =  data_container

        CONTAINER_NAME =  'TAB_CONTAINER'

      IMPORTING

        r_salv_table   =  salv_ref

      CHANGING

        t_table        = lt_tab_form

    ).

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 14, 2015 at 09:12 AM

    It still does not help.

    I pass the container name , but there is nothing appears on screen.

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Praveer,

      This will display the data on the complete screen. whereas I want to display it in a container.

      So there is no way I use CL_SALV_table class and display data in a container on screen.

      Best Regards,

      Nandan

  • avatar image
    Former Member
    Jan 14, 2015 at 09:47 AM

    you need to create a container on the screen and then pass the container name while calling the factory method like below:

    'CONT' is the name of the custom container on the screen.

    DATA lx_msg TYPE REF TO cx_salv_msg.

         TRY.

             CALL METHOD cl_salv_table=>factory

               EXPORTING

                 container_name = 'CONT'

               IMPORTING

                 r_salv_table   = o_alv

               CHANGING

                 t_table        = it_sflight.

           CATCH cx_salv_msg INTO lx_msg.

         ENDTRY.

         CALL METHOD o_alv->display.


    This code works for me. I think no need to create the container as you are doing in


    CREATE OBJECT data_container

      EXPORTING

        clsid                          =     SPACE " Class ID of This Container

        container_name                 =     'TAB_CONTAINER'

      EXCEPTIONS

        cntl_error                     = 1

        cntl_system_error              = 2

        create_error                   = 3

        lifetime_error                 = 4

        lifetime_dynpro_dynpro_link    = 5

        lifetime_dynpro_illegal_parent = 6

        others                         = 7

      .

    IF sy-subrc <> 0.

    * MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

    *            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

    ENDIF.

    Add comment
    10|10000 characters needed characters exceeded