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

urgent need

Former Member
0 Likes
831

hi all

i had writen the following code to display the alv grid

but on execution it dosenot show anything

except the blank screen

with some screen options that to not working

please help me solve

*

----


CLASS lcl_event_handler DEFINITION.

PUBLIC SECTION.

"----


METHODS on_double_click FOR EVENT double_click OF cl_gui_alv_grid

IMPORTING es_row_no e_column.

ENDCLASS. "lcl_event_handler DEFINITION

----


  • CLASS lcl_event_handler IMPLEMENTATION

----


*

----


CLASS lcl_event_handler IMPLEMENTATION.

METHOD on_double_click.

DATA: text TYPE string, es_row_string TYPE string.

es_row_string = es_row_no-row_id.

CONCATENATE 'row:' es_row_string 'column:'

e_column-fieldname INTO text .

MESSAGE text TYPE 'I'.

ENDMETHOD. "handler_method

ENDCLASS. "lcl_event_handler IMPLEMENTATION

                            • Types and Data Definitions ************************

TYPES: ty_spfli TYPE STANDARD TABLE OF spfli

WITH KEY carrid connid.

DATA: r_handler TYPE REF TO lcl_event_handler.

DATA: r_container TYPE REF TO cl_gui_custom_container,

r_alv_grid TYPE REF TO cl_gui_alv_grid.

DATA: it_spfli TYPE ty_spfli.

START-OF-SELECTION.

*########################

CREATE OBJECT r_handler.

SELECT * FROM spfli INTO TABLE it_spfli.

      • calling the dynpro on which ALV-Grid will be shown *****

CALL SCREEN '0500'.

&----


*& Module STATUS_0100 OUTPUT

&----


  • text

----


MODULE status_0500 OUTPUT.

SET PF-STATUS 'DYNPROSTATUS'.

SET TITLEBAR 'TITLE1'.

ENDMODULE. " STATUS_0100 OUTPUT

&----


*& Module ALV_GRID OUTPUT

&----


  • text

----


MODULE alv_grid OUTPUT.

      • Create object of class CL_GUI_CUSTOM_CAONTAINER to manage data !

IF NOT r_container IS BOUND.

CREATE OBJECT r_container

EXPORTING

container_name = 'CONTAINER_1'(001)

EXCEPTIONS

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.

      • create object of class cl_gui_alv_grid to visualize data !

IF NOT r_alv_grid IS BOUND.

CREATE OBJECT r_alv_grid

EXPORTING

i_parent = r_container

EXCEPTIONS

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.

      • set handler to react on double-click *******************

SET HANDLER r_handler->on_double_click FOR r_alv_grid.

ENDIF.

      • Call method to visualize data of internal table ************

CALL METHOD r_alv_grid->set_table_for_first_display

EXPORTING

i_structure_name = 'SPFLI'

CHANGING

it_outtab = it_spfli

EXCEPTIONS

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.

ENDMODULE. " ALV_GRID

1 ACCEPTED SOLUTION
Read only

seshatalpasai_madala
Product and Topic Expert
Product and Topic Expert
0 Likes
727

Hi,

I think the problem is with CONTAINER

When you are creating the container object you are passing the container name as

CONTAINER_1(001) make sure you give the container name same as the one that you gave in the screen painter SE51.

Regards,

Sesh

hi all

i had writen the following code to display the alv grid

but on execution it dosenot show anything

except the blank screen

with some screen options that to not working

please help me solve

*

----


CLASS lcl_event_handler DEFINITION.

PUBLIC SECTION.

"----


METHODS on_double_click FOR EVENT double_click OF cl_gui_alv_grid

IMPORTING es_row_no e_column.

ENDCLASS. "lcl_event_handler DEFINITION

----


  • CLASS lcl_event_handler IMPLEMENTATION

----


*

----


CLASS lcl_event_handler IMPLEMENTATION.

METHOD on_double_click.

DATA: text TYPE string, es_row_string TYPE string.

es_row_string = es_row_no-row_id.

CONCATENATE 'row:' es_row_string 'column:'

e_column-fieldname INTO text .

MESSAGE text TYPE 'I'.

ENDMETHOD. "handler_method

ENDCLASS. "lcl_event_handler IMPLEMENTATION

                            • Types and Data Definitions ************************

TYPES: ty_spfli TYPE STANDARD TABLE OF spfli

WITH KEY carrid connid.

DATA: r_handler TYPE REF TO lcl_event_handler.

DATA: r_container TYPE REF TO cl_gui_custom_container,

r_alv_grid TYPE REF TO cl_gui_alv_grid.

DATA: it_spfli TYPE ty_spfli.

START-OF-SELECTION.

*########################

CREATE OBJECT r_handler.

SELECT * FROM spfli INTO TABLE it_spfli.

      • calling the dynpro on which ALV-Grid will be shown *****

CALL SCREEN '0500'.

&----


*& Module STATUS_0100 OUTPUT

&----


  • text

----


MODULE status_0500 OUTPUT.

SET PF-STATUS 'DYNPROSTATUS'.

SET TITLEBAR 'TITLE1'.

ENDMODULE. " STATUS_0100 OUTPUT

&----


*& Module ALV_GRID OUTPUT

&----


  • text

----


MODULE alv_grid OUTPUT.

      • Create object of class CL_GUI_CUSTOM_CAONTAINER to manage data !

IF NOT r_container IS BOUND.

CREATE OBJECT r_container

EXPORTING

container_name = 'CONTAINER_1'(001)

EXCEPTIONS

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.

      • create object of class cl_gui_alv_grid to visualize data !

IF NOT r_alv_grid IS BOUND.

CREATE OBJECT r_alv_grid

EXPORTING

i_parent = r_container

EXCEPTIONS

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.

      • set handler to react on double-click *******************

SET HANDLER r_handler->on_double_click FOR r_alv_grid.

ENDIF.

      • Call method to visualize data of internal table ************

CALL METHOD r_alv_grid->set_table_for_first_display

EXPORTING

i_structure_name = 'SPFLI'

CHANGING

it_outtab = it_spfli

EXCEPTIONS

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.

ENDMODULE. " ALV_GRID

4 REPLIES 4
Read only

seshatalpasai_madala
Product and Topic Expert
Product and Topic Expert
0 Likes
728

Hi,

I think the problem is with CONTAINER

When you are creating the container object you are passing the container name as

CONTAINER_1(001) make sure you give the container name same as the one that you gave in the screen painter SE51.

Regards,

Sesh

Read only

0 Likes
727

ok i also think thats the prob but in that transaction it is not pos to give the element container_1 it only takes the ok_code.

well how to solve that

thanks for the reply

ull get the points if ull solve

Read only

0 Likes
727

Hi Abhijeet,

The problem that the screen has gone blank is because in your screen no 500

you must have not placed a custom container with the name CONTAINER_1.

please check and activate the screen after this is done.

Regards,

Reema.

Read only

0 Likes
727

well i have placed the container now it is asking for tables n filds