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

Regarding simple 00ps report

Former Member
0 Likes
678

Hi friends,

I have done simple oops report . It is going dump.

The dump is Access via 'NULL' object reference not possible.

The code is below

&----


*& Report YCLASS_OOPS_SAMPLE_PROGRAM

*&

&----


*&Sample OOPS Program for ALV

*& Venkat V G Murali Mohan M

&----


REPORT yclass_oops_sample_program.

tables:sflight.

*ALV Grid instance refernce

DATA: alv TYPE REF TO cl_gui_alv_grid,

  • *Custom container instance refernce

cont TYPE REF TO cl_gui_custom_container,

  • Field catalog of table

fieldcat TYPE lvc_t_fcat,

  • Layout structure

layout TYPE REF TO lvc_s_layo.

select-options s_fl for sflight-carrid.

*Internal table Holding data

DATA:BEGIN OF i_list OCCURS 0.

INCLUDE STRUCTURE sflight.

DATA END OF i_list.

START-OF-SELECTION.

  • Fetching data to be displayed

SELECT * FROM sflight INTO TABLE i_list.

CALL SCREEN 100.

&----


*& Module DISPLAY_ALV OUTPUT

&----


  • text

----


MODULE display_alv OUTPUT.

PERFORM display_outpiut.

ENDMODULE. " DISPLAY_ALV OUTPUT

&----


*& Form display_outpiut

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form display_outpiut .

write 'hai'.

CALL METHOD alv->set_table_for_first_display

EXPORTING

  • I_BUFFER_ACTIVE =

  • I_BYPASSING_BUFFER =

  • I_CONSISTENCY_CHECK =

I_STRUCTURE_NAME = 'SFLIGHT'

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

  • IR_SALV_ADAPTER =

CHANGING

it_outtab = i_list[].

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

write 'hai'.

if alv is initial.

*create custom container instance

CREATE OBJECT cont

EXPORTING

  • PARENT =

container_name = 'ZCUSTOM'

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

endif.

endform. " display_outpiut

But i-list is having the records.

Please reply immed

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
653
*Create object for Custom container
CREATE OBJECT  cont
EXPORTING
CONTAINER_NAME = 'ZCUSTOM'
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
CREATE_ERROR = 3
LIFETIME_ERROR = 4
LIFETIME_DYNPRO_DYNPRO_LINK = 5.
*Create object for ALV grid
CREATE OBJECT alv
EXPORTING I_PARENT = cont.

Regards

Kannaiah

Hi friends,

I have done simple oops report . It is going dump.

The dump is Access via 'NULL' object reference not possible.

The code is below

&----


*& Report YCLASS_OOPS_SAMPLE_PROGRAM

*&

&----


*&Sample OOPS Program for ALV

*& Venkat V G Murali Mohan M

&----


REPORT yclass_oops_sample_program.

tables:sflight.

*ALV Grid instance refernce

DATA: alv TYPE REF TO cl_gui_alv_grid,

  • *Custom container instance refernce

cont TYPE REF TO cl_gui_custom_container,

  • Field catalog of table

fieldcat TYPE lvc_t_fcat,

  • Layout structure

layout TYPE REF TO lvc_s_layo.

select-options s_fl for sflight-carrid.

*Internal table Holding data

DATA:BEGIN OF i_list OCCURS 0.

INCLUDE STRUCTURE sflight.

DATA END OF i_list.

START-OF-SELECTION.

  • Fetching data to be displayed

SELECT * FROM sflight INTO TABLE i_list.

CALL SCREEN 100.

&----


*& Module DISPLAY_ALV OUTPUT

&----


  • text

----


MODULE display_alv OUTPUT.

PERFORM display_outpiut.

ENDMODULE. " DISPLAY_ALV OUTPUT

&----


*& Form display_outpiut

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form display_outpiut .

write 'hai'.

CALL METHOD alv->set_table_for_first_display

EXPORTING

  • I_BUFFER_ACTIVE =

  • I_BYPASSING_BUFFER =

  • I_CONSISTENCY_CHECK =

I_STRUCTURE_NAME = 'SFLIGHT'

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

  • IR_SALV_ADAPTER =

CHANGING

it_outtab = i_list[].

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

write 'hai'.

if alv is initial.

*create custom container instance

CREATE OBJECT cont

EXPORTING

  • PARENT =

container_name = 'ZCUSTOM'

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

endif.

endform. " display_outpiut

But i-list is having the records.

Please reply immed

3 REPLIES 3
Read only

Former Member
0 Likes
653

Create the object first and later call the method for display

Read only

Former Member
0 Likes
654
*Create object for Custom container
CREATE OBJECT  cont
EXPORTING
CONTAINER_NAME = 'ZCUSTOM'
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
CREATE_ERROR = 3
LIFETIME_ERROR = 4
LIFETIME_DYNPRO_DYNPRO_LINK = 5.
*Create object for ALV grid
CREATE OBJECT alv
EXPORTING I_PARENT = cont.

Regards

Kannaiah

Read only

0 Likes
653

Thanks Kanniah.