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

call method in ALV

Former Member
0 Likes
3,406

hi,

how to get this method in the report.pls telll me the procedure

CALL METHOD gr_alvgrid->set_table_for_first_display

reward points will give

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,152

Hi Rajasekhar ,

Place the cursor where you want to call this function.

Press the Pattern icon which is near to the Pretty Printer Icon.

A dialog Box will open.

There , choose ABAP OBJECT PATTERNS, click ok.

A dialog Box will appear.

In that Select CALL METHOD.

Give the class name as CL_GUI_ALV_GRID and method as SET_TABLE_FOR_FIRST_DISPLAY.

press ok.

When the method is displayed in your screen , it will look like

CALL METHOD me ->set_table_for_first_display

Change that me with ur object name.

Reward if Useful.

Regards,

Chitra

hi,

how to get this method in the report.pls telll me the procedure

CALL METHOD gr_alvgrid->set_table_for_first_display

reward points will give

5 REPLIES 5
Read only

Former Member
0 Likes
2,152

Reddy,

Check this link .

check this thread..

Don't forget to reward if useful....

Read only

Former Member
0 Likes
2,153

Hi Rajasekhar ,

Place the cursor where you want to call this function.

Press the Pattern icon which is near to the Pretty Printer Icon.

A dialog Box will open.

There , choose ABAP OBJECT PATTERNS, click ok.

A dialog Box will appear.

In that Select CALL METHOD.

Give the class name as CL_GUI_ALV_GRID and method as SET_TABLE_FOR_FIRST_DISPLAY.

press ok.

When the method is displayed in your screen , it will look like

CALL METHOD me ->set_table_for_first_display

Change that me with ur object name.

Reward if Useful.

Regards,

Chitra

Read only

Former Member
0 Likes
2,152

hi rajshekar,

CALL METHOD gr_alvgrid1->set_table_for_first_display

EXPORTING

  • I_BUFFER_ACTIVE =

  • I_BYPASSING_BUFFER =

  • I_CONSISTENCY_CHECK =

  • I_STRUCTURE_NAME =

  • IS_VARIANT =

  • I_SAVE =

  • I_DEFAULT = 'X'

is_layout = gs_layout1

  • IS_PRINT =

  • IT_SPECIAL_GROUPS =

  • IT_TOOLBAR_EXCLUDING =

  • IT_HYPERLINK =

  • IT_ALV_GRAPHICS =

  • IT_EXCEPT_QINFO =

  • IR_SALV_ADAPTER =

CHANGING

it_outtab = gt_list1[]

it_fieldcatalog = gt_fieldcat1[]

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

Read only

mahaboob_pathan
Contributor
0 Likes
2,152

Hi;

This is where i set my grid (i have two grids but hte declarations are the same. i call according to a flag value(uzakdogu):

FORM alv_display .

if uzakdogu = 'X' .

*----Creating custom container instance

IF NOT gr_alvgrid IS INITIAL .

call method gr_alvgrid->register_edit_event

EXPORTING

i_event_id = cl_gui_alv_grid=>mc_evt_enter.

*

create object g_event_receiver type lcl_event_handler.

set handler g_event_receiver->handle_data_changed for gr_alvgrid.

set handler g_event_receiver->handle_hotspot_click for gr_alvgrid.

set handler g_event_receiver->handle_toolbar for gr_alvgrid.

set handler g_event_receiver->handle_menu_button for gr_alvgrid.

set handler g_event_receiver->handle_user_command for gr_alvgrid.

CALL METHOD gr_alvgrid->set_toolbar_interactive.

CALL METHOD gr_alvgrid->refresh_table_display.

else .

CREATE OBJECT gr_ccontainer

EXPORTING

container_name = gc_custom_control_name

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.

*--Exception handling

ENDIF.

*----Creating ALV Grid instance

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 .

IF sy-subrc 0.

*--Exception handling

ENDIF.

endif .

*----Preparing field catalog.

REFRESH gt_fieldcat.

PERFORM prepare_field_catalog CHANGING gt_fieldcat .

*----Preparing layout structure

PERFORM prepare_layout CHANGING gs_layout .

ls_variant-report = sy-repid.

ls_variant-variant = '/UZAKDOGU' .

*§3.Optionally register ENTER to raise event DATA_CHANGED.

(Per default the user may check data by using the check icon).

call method gr_alvgrid->register_edit_event

EXPORTING

i_event_id = cl_gui_alv_grid=>mc_evt_enter.

create object g_event_receiver type lcl_event_handler.

set handler g_event_receiver->handle_data_changed for gr_alvgrid.

set handler g_event_receiver->handle_hotspot_click for gr_alvgrid.

set handler g_event_receiver->handle_toolbar for gr_alvgrid.

set handler g_event_receiver->handle_menu_button for gr_alvgrid.

set handler g_event_receiver->handle_user_command for gr_alvgrid.

CALL METHOD gr_alvgrid->set_toolbar_interactive.

CALL METHOD gr_alvgrid->set_table_for_first_display

EXPORTING

i_buffer_active = 'X'

i_bypassing_buffer = 'X'

IS_VARIANT = ls_variant

I_SAVE = 'A'

CHANGING

it_outtab = itab[]

it_fieldcatalog = gt_fieldcat

EXCEPTIONS

invalid_parameter_combination = 1

program_error = 2

too_many_lines = 3

OTHERS = 4.

IF sy-subrc 0.

*--Exception handling

ENDIF.

set editable cells to ready for input

CALL METHOD gr_alvgrid->set_ready_for_input

EXPORTING

I_READY_FOR_INPUT = 1.

***

else .

........

and

this routine is called everytime i call the the relevant screen because it is inside PAI of the screen.

And here are my event handler declarations:

FORM handle_toolbar USING i_object type ref to cl_alv_event_toolbar_set

P_E_INTERACTIVE.

DATA: ls_toolbar TYPE stb_button.

CLEAR ls_toolbar.

MOVE 2 TO ls_toolbar-butn_type.

MOVE 'YAZDIR' TO ls_toolbar-function.

MOVE icon_print TO ls_toolbar-icon.

MOVE 'Belge Yazd&#305;r' TO ls_toolbar-quickinfo.

MOVE 'Yazd&#305;r' TO ls_toolbar-text.

MOVE ' ' TO ls_toolbar-disabled.

APPEND ls_toolbar TO i_object->mt_toolbar.

ENDFORM. " handle_toolbar

************

FORM handle_menu_button USING i_object type ref to cl_ctmenu

i_ucomm type sy-ucomm.

CASE i_ucomm .

WHEN 'YAZDIR' .

CALL METHOD i_object->add_function

EXPORTING

fcode = 'ORDER'

text = 'Armatör Blg'.

CALL METHOD i_object->add_function

EXPORTING

fcode = 'INVOICE'

text = 'Muhasebe Blg.'.

ENDCASE .

ENDFORM. " handle_menu_button

*****************

FORM handle_user_command USING i_ucomm type sy-ucomm.

DATA: sonuc .

DATA: kn TYPE i.

TYPES: BEGIN OF t1,

rowtype TYPE lvc_rtype,

index TYPE lvc_index,

END OF t1.

DATA: lt_rows TYPE lvc_t_row,

xrow TYPE t1.

DATA: pi_objky TYPE na_objkey,

xkappl TYPE na_kappl.

IF i_ucomm EQ 'ORDER'.

xkappl = 'V1'.

ELSE.

xkappl = 'V3'.

ENDIF.

if not uzakdogu is initial.

CALL METHOD gr_alvgrid->get_selected_rows

IMPORTING

et_index_rows = lt_rows.

else.

CALL METHOD gr_alvgrid2->get_selected_rows

IMPORTING

et_index_rows = lt_rows.

endif.

DESCRIBE TABLE lt_rows LINES kn.

IF kn GT 0.

READ TABLE lt_rows INTO xrow INDEX 1.

READ TABLE itab INDEX xrow-index .

CHECK xrow-rowtype EQ ''.

IF sy-subrc EQ 0.

IF i_ucomm EQ 'ORDER'.

MOVE itab-cnv_arm_belge TO pi_objky.

IF pi_objky EQ ''.

MESSAGE s020(zdhmsg).

RETURN.

ENDIF.

ELSE.

MOVE itab-cnv_mhs_belge TO pi_objky.

IF pi_objky EQ ''.

MESSAGE s021(zdhmsg).

RETURN.

ENDIF.

ENDIF.

IF pi_objky NE ''.

CALL FUNCTION 'RV_MESSAGE_DIALOG'

EXPORTING

pi_kappl = xkappl

pi_objky = pi_objky

EXCEPTIONS

cancel = 1

message_not_printable = 2

no_message = 3

print_error = 4

preview_error = 5

invalid_preview_mode = 6

OTHERS = 7.

ENDIF.

ENDIF.

ELSE.

MESSAGE s020(zdhmsg).

ENDIF.

ENDFORM. " handle_user_command

Read only

Former Member
0 Likes
2,152

Hi,

instance creation

data:

gr_alvfrid type ref to cl_gui_alv_grid.

create object gr_alvgrid.

Place the cursor on pattern in se38 and click on the abap object patterns and click on call methid and then give the instance and in call give cl_gui_alv_grid and in method give set_table_for_first_display

Plzz reward points if it helps.