Skip to Content
0
Former Member
Dec 18, 2012 at 07:46 AM

Trouble With ALV Grid Control

34 Views

Hi guys.

I have the following problem with ALV Grid Controls.

I was following the SAP Documentation online at: http://help.sap.com/saphelp_nw70ehp3/helpdata/en/4e/ba23f5250f568be10000000a421937/frameset.htm

Hence, I derived a program as shown below. But the problem is, the Screen loads without any data. Is it a problem of refreshing? Or am I doing something wrong? The documentation mentions to create the 'CustomControl' object within the PBO Module of Screen (which I did). And refreshing the AlvGrid doesn't seem to be helping either.

ABAP Program - Method Doesn't WOrk

REPORT ZHELLOWORLD.

TABLES: ZDBTABLE.

DATA: AlvGridRefVar TYPE REF TO CL_GUI_ALV_GRID,

CustomContainer TYPE REF TO CL_GUI_CUSTOM_CONTAINER,

itab_ZDBTABLE TYPE STANDARD TABLE OF ZDBTABLE.

START-OF-SELECTION.

CALL SCREEN 60.

SELECT ZDBTABLE~code qty

FROM ZDBTABLE

INTO CORRESPONDING FIELDS OF TABLE itab_ZDBTABLE.

CALL METHOD AlvGridRefVar->SET_TABLE_FOR_FIRST_DISPLAY

EXPORTING I_STRUCTURE_NAME = 'ZDBTABLE'

CHANGING IT_OUTTAB = itab_ZDBTABLE.

MODULE init OUTPUT. " Called By PBO Of Screen 60

SET PF-STATUS 'ZHELLOWORLD_STATUS01'.

IF CustomContainer IS INITIAL.

CREATE OBJECT CustomContainer

EXPORTING CONTAINER_NAME = 'CONTAINER'.

CREATE OBJECT AlvGridRefVar

EXPORTING I_PARENT = CustomContainer.

ENDIF.

ENDMODULE.

MODULE exit INPUT. " Called By PAI Of Screen 60

LEAVE PROGRAM.

ENDMODULE.

However, If I modify the program above so that, 'CustomContainer' object is created in the 'Start-of-selection', and call 'Screen 60' at the end, the output seems fine!

ABAP Program - This Method Works

REPORT ZHELLOWORLD.

TABLES: ZDBTABLE.

DATA: AlvGridRefVar TYPE REF TO CL_GUI_ALV_GRID,

CustomContainer TYPE REF TO CL_GUI_CUSTOM_CONTAINER,

itab_ZDBTABLE TYPE STANDARD TABLE OF ZDBTABLE.

START-OF-SELECTION.

IF CustomContainer IS INITIAL.

CREATE OBJECT CustomContainer

EXPORTING CONTAINER_NAME = 'CONTAINER'.

CREATE OBJECT AlvGridRefVar

EXPORTING I_PARENT = CustomContainer.

ENDIF.

SELECT ZDBTABLE~code qty

FROM ZDBTABLE

INTO CORRESPONDING FIELDS OF TABLE itab_ZDBTABLE.

CALL METHOD AlvGridRefVar->SET_TABLE_FOR_FIRST_DISPLAY

EXPORTING I_STRUCTURE_NAME = 'ZDBTABLE'

CHANGING IT_OUTTAB = itab_ZDBTABLE.

CALL SCREEN 60.

MODULE init OUTPUT.

SET PF-STATUS 'ZHELLOWORLD_STATUS01'.

ENDMODULE.

MODULE exit INPUT.

LEAVE PROGRAM.

ENDMODULE.


So, what is the problem with the first approach? Am I doing something wrong? Any input would be appreciated!

Thank you all for your time in advance.

Sole Developer.

PS: Using the command CALL METHOD AlvGridRefVar->REFRESH_TABLE_DISPLAY.

Attachments

pastedImage_0.png (13.8 kB)
pastedImage_1.png (18.1 kB)