Application Development and Automation 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: 
Read only

ALV Grid control

Former Member
0 Likes
479

Dear Friends,

I am creating a report with the ALV grid control, where I created and displayed along with its respective container - I however am facing a dump when I am running this program.

ps: I am following the create / display of ALV grid steps of the SAP documentation while performing this program

this is my program - would appreciate your inputs

REPORT ZALV_CREATE .

DATA: X_SAVE, "for Parameter I_SAVE

GS_variant TYPE DISVARIANT. "for parameter IS_VARIANT

X_SAVE = 'U'.

DATA: grid TYPE REF TO cl_gui_alv_grid,

g_custom_container TYPE REF TO cl_gui_custom_container,

gt_sflight TYPE TABLE OF sflight.

SELECT * FROM sflight INTO TABLE gt_sflight.

CALL METHOD GRID->SET_TABLE_FOR_FIRST_DISPLAY

EXPORTING

I_STRUCTURE_NAME = 'SFLIGHT'

IS_VARIANT = GS_variant

I_SAVE = X_SAVE

CHANGING

IT_OUTTAB = GT_SFLIGHT.

thank you in advance.

1 ACCEPTED SOLUTION
Read only

naimesh_patel
Active Contributor
0 Likes
440

You haven't created the GRID object before using its method.

Like:


    CREATE OBJECT G_CUSTOM_CONTAINER
           EXPORTING CONTAINER_NAME = G_CONTAINER.
    CREATE OBJECT GRID1
           EXPORTING I_PARENT = G_CUSTOM_CONTAINER.

Check report BCALV_GRID_DEMO.

Regards,

Naimesh Patel

Dear Friends,

I am creating a report with the ALV grid control, where I created and displayed along with its respective container - I however am facing a dump when I am running this program.

ps: I am following the create / display of ALV grid steps of the SAP documentation while performing this program

this is my program - would appreciate your inputs

REPORT ZALV_CREATE .

DATA: X_SAVE, "for Parameter I_SAVE

GS_variant TYPE DISVARIANT. "for parameter IS_VARIANT

X_SAVE = 'U'.

DATA: grid TYPE REF TO cl_gui_alv_grid,

g_custom_container TYPE REF TO cl_gui_custom_container,

gt_sflight TYPE TABLE OF sflight.

SELECT * FROM sflight INTO TABLE gt_sflight.

CALL METHOD GRID->SET_TABLE_FOR_FIRST_DISPLAY

EXPORTING

I_STRUCTURE_NAME = 'SFLIGHT'

IS_VARIANT = GS_variant

I_SAVE = X_SAVE

CHANGING

IT_OUTTAB = GT_SFLIGHT.

thank you in advance.

2 REPLIES 2
Read only

naimesh_patel
Active Contributor
0 Likes
441

You haven't created the GRID object before using its method.

Like:


    CREATE OBJECT G_CUSTOM_CONTAINER
           EXPORTING CONTAINER_NAME = G_CONTAINER.
    CREATE OBJECT GRID1
           EXPORTING I_PARENT = G_CUSTOM_CONTAINER.

Check report BCALV_GRID_DEMO.

Regards,

Naimesh Patel

Read only

0 Likes
440

Mr Naimesh,

Thank you very much - and appreciate the demo program that you referred.

Regards