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

OO syntax problem

Former Member
0 Likes
636

Hi everyone,

from an object of the class cl_salv_table I got another object of type cl_salv_columns_table, let's name it as lo_columns.

In debug mode, when I double click this object I find in the attributes column other classes.

My question is, how do I access to those attributes from other classes?

My example:

for lo_columns object I have

CL_SALV_COLUMNS_LIST and I need the private attribute CELL_TYPE_COLUMN.

There is no method in cl_salv_columns that returns an object of this kind.

Could you help me please?

Best regards,

André Costa

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
592

in your event handler

----


CLASS LCL_HANDLE_EVENTS DEFINITION.

  • This returns row and column when a cell is double clicked

  • Other events are available but we only want this one in this application.

PUBLIC SECTION.

METHODS:

ON_DOUBLE_CLICK FOR EVENT DOUBLE_CLICK OF CL_SALV_EVENTS_TABLE

IMPORTING ROW COLUMN.

ENDCLASS. "lcl_handle_events DEFINITION

----


  • CLASS lcl_handle_events IMPLEMENTATION

----


*

----


CLASS LCL_HANDLE_EVENTS IMPLEMENTATION.

*

  • On Double click display factuur, Proforma, or Order (not batch)

METHOD ON_DOUBLE_CLICK.

PERFORM DISPLAY_DOCUMENT USING ROW COLUMN.

ENDMETHOD. "on_double_click

ENDCLASS. "lcl_handle_events IMPLEMENTATION

  • Create the Grid object and then access methods within sub / superclasses of the cl_salv_table class.

  • The Object instance is returned in variable gr_table. This is then used as the Instance reference

  • for accessing attributes and calling methods within the cl_salv_table class.

TRY.

CALL METHOD CL_SALV_TABLE=>FACTORY

EXPORTING

LIST_DISPLAY = GR_LISTORALV "ALV or classic list

IMPORTING

R_SALV_TABLE = GR_TABLE "ALV object instantiated

CHANGING

T_TABLE = TA_LIST. "Data table display (internal table)

CATCH CX_SALV_MSG. "If error in Object Instantiation

ENDTRY.

  • Set Grid Layout options

GR_FUNC = GR_TABLE->GET_FUNCTIONS( ). "Enable Grid standard functions (and user if they exist)

GR_FUNC->SET_ALL( ABAP_TRUE ). "Show and enable standard Toolbar. (ALV)

GR_DISPLAY = GR_TABLE->GET_DISPLAY_SETTINGS( ). "Enable limited programmable layout setting changes

GR_DISPLAY->SET_HORIZONTAL_LINES( VALUE = ' ' ). "Switch off Horizontal lines

GR_DISPLAY->SET_VERTICAL_LINES( VALUE = ' ' ). "Switch off Vertical lines

GR_TABLE->DISPLAY( ).

----


FORM DISPLAY_DOCUMENT USING I_ROW TYPE I

I_COLUMN TYPE LVC_FNAME.

READ TABLE TA_LIST INDEX I_ROW INTO VR_LIST.

Cheers

Jimbo

3 REPLIES 3
Read only

Former Member
0 Likes
593

in your event handler

----


CLASS LCL_HANDLE_EVENTS DEFINITION.

  • This returns row and column when a cell is double clicked

  • Other events are available but we only want this one in this application.

PUBLIC SECTION.

METHODS:

ON_DOUBLE_CLICK FOR EVENT DOUBLE_CLICK OF CL_SALV_EVENTS_TABLE

IMPORTING ROW COLUMN.

ENDCLASS. "lcl_handle_events DEFINITION

----


  • CLASS lcl_handle_events IMPLEMENTATION

----


*

----


CLASS LCL_HANDLE_EVENTS IMPLEMENTATION.

*

  • On Double click display factuur, Proforma, or Order (not batch)

METHOD ON_DOUBLE_CLICK.

PERFORM DISPLAY_DOCUMENT USING ROW COLUMN.

ENDMETHOD. "on_double_click

ENDCLASS. "lcl_handle_events IMPLEMENTATION

  • Create the Grid object and then access methods within sub / superclasses of the cl_salv_table class.

  • The Object instance is returned in variable gr_table. This is then used as the Instance reference

  • for accessing attributes and calling methods within the cl_salv_table class.

TRY.

CALL METHOD CL_SALV_TABLE=>FACTORY

EXPORTING

LIST_DISPLAY = GR_LISTORALV "ALV or classic list

IMPORTING

R_SALV_TABLE = GR_TABLE "ALV object instantiated

CHANGING

T_TABLE = TA_LIST. "Data table display (internal table)

CATCH CX_SALV_MSG. "If error in Object Instantiation

ENDTRY.

  • Set Grid Layout options

GR_FUNC = GR_TABLE->GET_FUNCTIONS( ). "Enable Grid standard functions (and user if they exist)

GR_FUNC->SET_ALL( ABAP_TRUE ). "Show and enable standard Toolbar. (ALV)

GR_DISPLAY = GR_TABLE->GET_DISPLAY_SETTINGS( ). "Enable limited programmable layout setting changes

GR_DISPLAY->SET_HORIZONTAL_LINES( VALUE = ' ' ). "Switch off Horizontal lines

GR_DISPLAY->SET_VERTICAL_LINES( VALUE = ' ' ). "Switch off Vertical lines

GR_TABLE->DISPLAY( ).

----


FORM DISPLAY_DOCUMENT USING I_ROW TYPE I

I_COLUMN TYPE LVC_FNAME.

READ TABLE TA_LIST INDEX I_ROW INTO VR_LIST.

Cheers

Jimbo

Read only

0 Likes
592

sorry Jimbo, couldn't get your point.

What's the type of vr_list? CL_SALV_COLUMN_LIST?

I want to set a column as a checkbox... Maybe I'm understanding this all wrong #-/

Thanks a lot,

André Costa

Read only

0 Likes
592

Hi your original question wasn't clear.

However to get a selection box on this type of grid look at SAP program

SALV_DEMO_TABLE_SELECTIONS.

Note in the SALV functions you don't have any editing capability although you do have event handling. You can only put your cursor on the selection boxes - single, block or multiple selections allowed.

Tthere's no INPUT capability to put an X in the box etc. however.

If you need to CHANGE data via user input to the grid you'll have to use the class cl_gui_alv_grid instead which is a bit more complex.

Cheers

jimbo