Application Development 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: 

ALV custom control,

Former Member
0 Kudos
429

I must run fast and learn as much as possible..

DATA gr_alvgrid TYPE REF TO cl_gui_alv_grid .

*--- Name of the custom control added on the screen

DATA gc_custom_control_name TYPE scrfname VALUE ‘CC_ALV’ .

Here even though I have created a custom control named 'CC_ALV', the program generates an error sayin: Field "‘CC_ALV’" is unknown. It is neither in one of the specified tables nor defined by a "DATA" statement . . . . . . . . . .

What is the problem?

Anything that I have to do with custom control on the screen, else than giving a name.

Note: The screen I want ALV grid on is a subscreen.

Thanks in advance.

Deniz.

1 ACCEPTED SOLUTION

MarcelloUrbani
Active Contributor
0 Kudos
227

Are you sure you used the quotation marks?

‘CC_ALV’ is ok

CC_ALV is not

3 REPLIES 3

MarcelloUrbani
Active Contributor
0 Kudos
228

Are you sure you used the quotation marks?

‘CC_ALV’ is ok

CC_ALV is not

Former Member
0 Kudos
227

Hi

see the sample code and correct it

*----


DATA: gi_sflight TYPE STANDARD TABLE OF sflight.

*----


  • G L O B A L D A T A

*----


DATA: ok_code LIKE sy-ucomm,

g_wa_sflight LIKE sflight.

  • Declare reference variables to the ALV grid and the container

DATA:

go_grid TYPE REF TO cl_gui_alv_grid,

go_custom_container TYPE REF TO cl_gui_custom_container.

*----


  • S T A R T - O F - S E L E C T I O N.

*----


START-OF-SELECTION.

SET SCREEN '100'.

&----


*& Module USER_COMMAND_0100 INPUT

&----


MODULE user_command_0100 INPUT.

CASE ok_code.

WHEN 'EXIT'.

LEAVE TO SCREEN 0.

ENDCASE.

ENDMODULE. " USER_COMMAND_0100 INPUT

&----


*& Module STATUS_0100 OUTPUT

&----


MODULE status_0100 OUTPUT.

  • Create objects

IF go_custom_container IS INITIAL.

CREATE OBJECT go_custom_container

EXPORTING container_name = 'ALV_CONTAINER'.

CREATE OBJECT go_grid

EXPORTING

i_parent = go_custom_container.

PERFORM load_data_into_grid.

ENDIF.

ENDMODULE. " STATUS_0100 OUTPUT

&----


*& Form load_data_into_grid

&----


FORM load_data_into_grid.

  • Read data from table SFLIGHT

SELECT *

FROM zsflight

INTO TABLE gi_sflight.

  • Load data into the grid and display them

CALL METHOD go_grid->set_table_for_first_display

EXPORTING i_structure_name = 'SFLIGHT'

CHANGING it_outtab = gi_sflight.

ENDFORM. " load_data_into_grid

Reward points if useful

Regards

Anji

Former Member
0 Kudos
227

hi,

*----Creating custom container instance

CREATE OBJECT gr_ccontainer

EXPORTING

container_name = gc_custom_control_name -->name of the custom container

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.

CREATE OBJECT gr_alvgrid

EXPORTING

i_parent = gr_ccontainer

EXCEPTIONS

error_cntl_create = 1

error_cntl_init = 2

error_cntl_link = 3

error_dp_create = 4

others = 5 .

please go through this code..

regards,