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

SET_TABLE_FOR_FIRST_DISPLAY in I_CALLBACK_USER_COMMAND

former_member307359
Participant
0 Likes
2,032

Hi,


Can someone please help me with this one:

I'm doing an OOP with the use of CALL METHOD GRID1->SET_TABLE_FOR_FIRST_DISPLAY and I want to use similar functionality of 'REUSE_ALV_GRID_DISPLAY'->I_CALLBACK_USER_COMMAND. Since the CALL METHOD doesn't have I_call_back functionality. The alternative is to code it using classes, particularly SET_HANDLER.

Can someone please give me a working code for this? I'm still new with this type of class programming.


Thanks a lot.

4 REPLIES 4
Read only

rosenberg_eitan
Active Contributor
0 Likes
1,437

Hi,

- Get the book "An Easy Reference for ALV Grid Control" chapter "Event Based Additional Functionalities "  the book is here

- Package SLIS demo programs.

- The wiki .

Regards.

Read only

gouravkumar64
Active Contributor
0 Likes
1,437

Hi,

Try like this ,

Declare screen, custom container, methods etc like,

first declare data :  IT_rec_Fcat TYPE lvc_T_fcat,

   WA_rec_Fcat TYPE lvc_s_fcat,

ob_custom TYPE REF TO cl_gui_custom_container ,

   ob_grid1  TYPE REF TO cl_gui_alv_grid .

CLASS lcl_event_receiver DEFINITION.

   PUBLIC SECTION.

   METHODs : handle_double_click FOR EVENT double_click OF cl_gui_alv_grid IMPORTING e_row e_column.

   ENDCLASS.

DATA : v_event_receiver TYPE REF TO lcl_event_receiver.

perform build_fcat.

   CALL SCREEN 9000 .

within that screen's OUTPUT part>

* This will create a container

    CREATE OBJECT ob_custom

       EXPORTING

         container_name = 'CONTAINER' .

CREATE OBJECT : v_event_receiver.

     SET HANDLER v_event_receiver->handle_double_click FOR Ob_grid1.


CALL METHOD ob_grid1->set_table_for_first_display

       EXPORTING

         i_structure_name = 'IT_REC_FCAT'

       CHANGING

         it_outtab = it_OUT_REC

           IT_FIELDCATALOG  = IT_REC_FCAT[]  .

>>

CLASS lcl_event_receiver IMPLEMENTATION.

     METHOD handle_double_click.

       READ TABLE it_out_rec INTO wa_out_rec INDEX e_row-index TRANSPORTING kunnr.

SUBMIT RFITEMAR with DD_KUNNR-LOW = wa_out_rec-kunnr

                       WITH X_AISEL = 'X'

                       with SO_BUDAT in s_budat

*                      WITH %%DYN011-LOW = '1300000032'

                       AND RETURN .


ENDMETHOD.


DO NOT forget to create other part & declaration.

Hope this code will help you.


Try like that.


Thanks.



Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,437

Did you use search tool there are already some OO ALV samples at scn.

Regards,

Raymond

Read only

Former Member
0 Likes
1,437

You'll need to have a local class+object to handle a EVENT the ALV Class will trigger.

Start with the ALV OO examples you can find in SCN, but don't just Copy+Paste. Try to understand what you're doing by learning about OO concepts.

Regards!