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: 

ALV Grid not getting displayed

Former Member
0 Kudos
3,130

Hi All,

i am new to OOPS ABAP.i have written a simple ALV prog but it is not displaying the List.please have a look into it and suggest me the solution.

data : t_itab type table of ZRAK ."with header line.

data :wa_itab type zrak.

DATA : grid type ref to cl_gui_alv_grid,

g_custom_container type ref to cl_gui_custom_container.

wa_itab-name = 'rakesh'.

wa_itab-city = 'bangalore'.

append wa_itab to t_itab.

wa_itab-name = 'raghu'.

wa_itab-city = 'bang'.

append wa_itab to t_itab.

wa_itab-name = 'vijay'.

wa_itab-city = 'california'.

append wa_itab to t_itab.

IF g_custom_container is initial.

CREATE OBJECT g_custom_container

EXPORTING

  • PARENT =

container_name = 'ccontainer'

  • STYLE =

  • LIFETIME = lifetime_default

  • REPID =

  • DYNNR =

  • NO_AUTODEF_PROGID_DYNNR =

  • EXCEPTIONS

  • CNTL_ERROR = 1

  • CNTL_SYSTEM_ERROR = 2

  • CREATE_ERROR = 3

  • LIFETIME_ERROR = 4

  • LIFETIME_DYNPRO_DYNPRO_LINK = 5

  • others = 6

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

CREATE OBJECT grid

EXPORTING

  • I_SHELLSTYLE = 0

  • I_LIFETIME =

i_parent = g_custom_container

  • I_APPL_EVENTS = space

  • I_PARENTDBG =

  • I_APPLOGPARENT =

  • I_GRAPHICSPARENT =

  • I_NAME =

  • EXCEPTIONS

  • ERROR_CNTL_CREATE = 1

  • ERROR_CNTL_INIT = 2

  • ERROR_CNTL_LINK = 3

  • ERROR_DP_CREATE = 4

  • others = 5

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ENDIF.

CALL METHOD grid->set_table_for_first_display

EXPORTING

  • I_BUFFER_ACTIVE =

  • I_BYPASSING_BUFFER =

  • I_CONSISTENCY_CHECK =

I_STRUCTURE_NAME = 'ZRAK'

  • IS_VARIANT =

  • I_SAVE =

  • I_DEFAULT = 'X'

  • IS_LAYOUT =

  • IS_PRINT =

  • IT_SPECIAL_GROUPS =

  • IT_TOOLBAR_EXCLUDING =

  • IT_HYPERLINK =

  • IT_ALV_GRAPHICS =

  • IT_EXCEPT_QINFO =

CHANGING

it_outtab = t_itab

  • IT_FIELDCATALOG =

  • IT_SORT =

  • IT_FILTER =

  • 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.

1 ACCEPTED SOLUTION

Former Member
0 Kudos
671

in se41 you can create/copy and activate the tool bar.

10 REPLIES 10

Former Member
0 Kudos
671

Hi Rakesh,

You will have to pass IT_FIELDCATALOG parameter.

This can be populated through reuse_alv_fieldcatalog_merge function modules.

Regards

Kapadia

Former Member
0 Kudos
671

Hi Rakesh,

In the call to method set_table_for_first_display,

you are passing structure 'ZRAK' for fieldcatalog, ensure that this is not a local structure, this has to be available thru SE11, else you have to create a fieldcatalog & pass it to the method instead of passing the structure name.

Regards,

Raghavendra

Former Member
0 Kudos
671

Give the container name in upper case

IF g_custom_container is initial.

CREATE OBJECT g_custom_container

EXPORTING

  • PARENT =

container_name = '<b>CCONTAINER'</b>

  • STYLE =

  • LIFETIME = lifetime_default

Former Member
0 Kudos
671
  w_layout-grid_title = ptitle.
  w_layout-zebra      = pzebra.
  w_layout-sel_mode   = pmode.
  w_layout-cwidth_opt = pwidth.
  w_variant-handle    = pvariant.
  w_variant-report    = sy-repid.

  FIELD-SYMBOLS: <lfs_fieldcat> TYPE lvc_s_fcat.

  LOOP AT p_fieldcat ASSIGNING <lfs_fieldcat>.
    CASE <lfs_fieldcat>-fieldname.
      WHEN 'MATNR'.
        <lfs_fieldcat>-hotspot  = c_x.
        <lfs_fieldcat>-key      = c_x.
      WHEN 'NTGEW'.
        <lfs_fieldcat>-do_sum      = c_x.
      WHEN OTHERS.

    ENDCASE.

  ENDLOOP.
 
 CALL METHOD o_alvgrid->set_table_for_first_display
     EXPORTING
*    I_BYPASSING_BUFFER            =
*    I_BUFFER_ACTIVE               =
*    I_CONSISTENCY_CHECK           =
*    I_STRUCTURE_NAME              =
       is_variant                    = w_variant
       i_save                        = c_a
*    I_DEFAULT                     = 'X'
       is_layout                     = p_layout
*    IS_PRINT                      =
*       it_special_groups             = 
 *      it_toolbar_excluding          = 
*    IT_HYPERLINK                  =
*    IT_ALV_GRAPHICS               =
*    IT_EXCEPT_QINFO               =
    CHANGING
       it_outtab                     = p_output[]
       it_fieldcatalog               = p_fieldcat[]
*    IT_SORT                       =
*    IT_FILTER                     =
    EXCEPTIONS
       invalid_parameter_combination = 1
       program_error                 = 2
       too_many_lines                = 3
       OTHERS                        = 4.

  IF sy-subrc <> 0.
    MESSAGE i278.
    LEAVE LIST-PROCESSING.
  ENDIF.

Specify all these details, also specify 'CCONTAINER' in caps.

Former Member
0 Kudos
671

Hello Rakesh,

Is this your entire code or only a part of it?

You have to create a screen and then in the screen layout,make a custom container.Name it as CCONTAINER.

After data declaration and appending data to your internal table t_itab,call screen 100.

Write the code for creating the container,creating the grid and the method SET_TABLE_FOR_FIRST_DISPLAY in the PBO (status module) of the flow logic of the screen.

Also,in the create container instance,write the container name CCONTAINER in capitals.

Regards,

Beejal

**Reward if this helps

0 Kudos
671

Hi Beejal,

The list is displaying now but the standard tool bar is not activated.plz suggest me on this.

Thanks,

Rakesh.

0 Kudos
671

Hello Rakesh,

Standard tool bar of the ALV??It ideally comes unless if you have programatically excluded the tool bar in SET_TABLE_FOR_FIRST_DISPLAY by passing a parameter ie.

CALL METHOD ALV->SET_TABLE_FOR_FIRST_DISPLAY

EXPORTING

I_STRUCTURE_NAME = 'SPFLI'

  • IT_TOOLBAR_EXCLUDING = itab_ui.

Make sure you have commented this line :

  • IT_TOOLBAR_EXCLUDING = itab_ui.

Also,have a look at this link:

<b>http://fuller.mit.edu/tech/controls_technology.htm</b>

Regards,

Beejal

**Reward if this helps

Former Member
0 Kudos
672

in se41 you can create/copy and activate the tool bar.

0 Kudos
671

Hi Sadiqulla,

can u plz explain in detail?

Former Member
0 Kudos
671

Hi,

Actually standard toolbar is displayed automatically when u use

set_table_for_first_display.

The toolbar will not be displayed if u have populated the layout parameter with no_toolbar = 'X'.

In the below case i have populated the layout with no_toolbar = 'x' so i will not get the standard toolbar.

DATA: tool_layout TYPE lvc_s_layo,

tool_layout-no_toolbar = 'X'.

CALL METHOD grid1->set_table_for_first_display

EXPORTING

  • i_bypassing_buffer = 'X'

  • I_BUFFER_ACTIVE =

  • I_CONSISTENCY_CHECK =

  • I_STRUCTURE_NAME =

  • IS_VARIANT =

  • I_SAVE =

  • I_DEFAULT = 'X'

is_layout = tool_layout

  • IS_PRINT =

  • IT_SPECIAL_GROUPS =

  • IT_TOOLBAR_EXCLUDING =

  • IT_HYPERLINK =

  • IT_ALV_GRAPHICS =

CHANGING

it_outtab = it_TABLE

it_fieldcatalog = t_fcat

  • IT_SORT =

  • IT_FILTER =

  • EXCEPTIONS

  • INVALID_PARAMETER_COMBINATION = 1

  • PROGRAM_ERROR = 2

  • TOO_MANY_LINES = 3

  • others = 4

Standard toolbar will also not be diaplayed if u have not commented IT_TOOLBAR_EXCLUDING in the function module

set_table_for_first_display

If it_toolbar_excluding is commented and u have not populated the layout with

no_ toolbar the toolbar comes automatically.

Regards,

Sruthi

Message was edited by:

sruthi vangala