Skip to Content
0
Former Member
Mar 23, 2009 at 12:40 PM

List output in ALV grid

32 Views

Hi all,

I need the list output of one program in my program in a grid(single column).

I am doing the below..

TYPES: BEGIN OF tp_ascitab ,

line(150),

END OF tp_ascitab.

DATA: dt_ascitab TYPE TABLE OF tp_ascitab,

ds_ascitab TYPE tp_ascitab.

SUBMIT zlist_program WITH p-gmn EQ matno

WITH p-plant EQ plant

EXPORTING LIST TO MEMORY

AND RETURN.

CALL FUNCTION 'LIST_FROM_MEMORY'

TABLES

listobject = gmn_info_tab

EXCEPTIONS

not_found = 1

OTHERS = 2.

CALL FUNCTION 'LIST_TO_ASCI'

TABLES

listobject = gmn_info_tab

listasci = dt_ascitab.

IF sy-subrc <> 0.

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

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

ENDIF.

IF dg_gridcont IS INITIAL.

  • Create controls

CREATE OBJECT dg_gridcont

EXPORTING container_name = 'GRID_CONT'.

ENDIF.

CREATE OBJECT dg_grid

EXPORTING i_parent = dg_gridcont.

ds_layout-no_hgridln = 'X'.

ds_layout-no_toolbar = 'X'.

CALL METHOD dg_grid->set_table_for_first_display

EXPORTING

is_layout = ds_layout

CHANGING

it_fieldcatalog = dt_fcat[]

it_outtab = dt_ascitab.

The table dt_ascitab has data in correct format until it is passed to grid.

After that, there is change in alignmentt. The grid output has data with

improper alignment. Could anyone help me with this.

thanks,

Keerthi.