Thursday, January 29, 2015

ABAP TIP ALV USER COMMAND

Chapter 086
ALV USER COMMAND.
Source : http://abapjoy.blogspot.com

Generally, we implement the ALV button action for the event that user push the button.
1. ALV Level : ALV Event implementation
METHOD handle_command.
    DATA : l_scroll TYPE lvc_s_stbl.

    CASE e_ucomm.
      WHEN 
‘ALV command’.
          ‘Implementation of method ~~’.
    ENDCASE.
  ENDMETHOD.                    "handle_user_command

There is another useful way to integrate all user action of ALV within SCREEN level.
 When user click the button on ALV, if you call the method SET_NEW_OK_CODE of class CL_GUI_CFW,
you can implement the same function of calling alv hander method. That is, the user command on ALV to screen PBO module.

1. ALV event
      
METHOD handle_command.
    DATA : l_scroll TYPE lvc_s_stbl.

    CASE e_ucomm.
      WHEN 
‘ALV command’.
         CALL METHOD cl_gui_cfw=>set_new_ok_code
        
EXPORTING
             new_code = ‘ALV command’.
 

    ENDCASE.
  ENDMETHOD.                    "handle_user_command

 2. screen PAI command implementation.
MODULE user_command_0100 INPUT.

  CASE sy-ucomm.
    WHEN 
‘ALV command’.
       ‘implement of alv function’
NDCASE.

ENDMODULE.                 " USER_COMMAND_0100  INPUT




No comments:

Post a Comment