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: 

Regarding alv output double clicking operation

Former Member
0 Kudos

Hi,

GURUS ,

i have one Report program if i execute it it is displaying proper output 

But here the issue is when ever i am double clicking on output list it goes to dump can any one suggest me solution for this .

i am wrote  the alv displaying code for u r reference.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
   EXPORTING
    I_CALLBACK_PROGRAM     = SY-REPID
    I_BACKGROUND_ID        = 'ALV_BACKGROUND'
    I_CALLBACK_TOP_OF_PAGE = 'TOP-OF-PAGE'
*   I_CALLBACK_PF_STATUS_SET = 'MYSTATUS'
*   IS_LAYOUT                         = WA_LAYOUT
*   I_SAVE                 = 'U'
*    IT_SORT                 = IT_SORT
    IT_FIELDCAT            = IT_FIELDCAT
     I_CALLBACK_USER_COMMAND = 'USERCOMMAND'
*      IT_EVENTS              = IT_ALV_EVENT
*      I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE'
   TABLES
    T_OUTTAB               = ITAB_ERRORLOG.

Thanks & Regards ,

Pramodh

1 ACCEPTED SOLUTION

nabheetscn
Active Contributor
0 Kudos

Hi


Have you created USERCOMMAND subroutine in your report to handle double click


Nabheet

10 REPLIES 10

nabheetscn
Active Contributor
0 Kudos

Hi


Have you created USERCOMMAND subroutine in your report to handle double click


Nabheet

0 Kudos

Ya it is already there in my program

the subroutine definition  will be like this



FORM USERCOMMAND

CASE SY-UCOMM.
**
  
   .

     WHEN 'BACK'.


LEAVE TO TRANSACTION 'xxxx'.

end case .

end form

0 Kudos

this is the message i got in bug

An exception occurred that is explained in detail below.

The exception, which is assigned to class 'CX_SY_DYN_CALL_ILLEGAL_TYPE', was

  not caught in

procedure "USER_COMMAND" "(FORM)", nor was it propagated by a RAISING clause.

Since the caller of the procedure could not have anticipated that the

exception would occur, the current program is terminated.

The reason for the exception is:

Call to FORM "USERCOMMAND" is incorrect:

The actual parameter no. 1 has a different data type in the

PERFORM than requested for the FORM "USERCOMMAND" in program "xxxxx".

0 Kudos

Correct syntax of usercommand..your syntax is incorrect

FORM usercommand USING r_ucomm- LIKE sy-ucomm

                  rs_selfield TYPE slis_selfield.

0 Kudos

Defining the usercommad routine is wrong. check the calling the routine in ALV and defining in program.

CEHCK THE SYNTAX OF DEFINING THE USER COMMAND IN ALV

0 Kudos

Thanks for u r replay the problem is in routine only i found that one error is cleared now

Regards ,

Pramodh.

Former Member
0 Kudos

I belive that this may be due to a missing routine.If  a routine called "USERCOMMAND" OR "

'TOP-OF-PAGE"

is not there needs to be declared as follows

form USERCOMMAND      using     p_ucomm    like sy-ucomm

                     changing    p_selfield type slis_selfield .

endform.

form top-of-page .

endform.

Ideally  post the error details so that it is easy to analyze them in the thread

Hope it helps

venkatakrishna
Active Participant
0 Kudos

Hi,

declare variable    gd_repid     like sy-repid.


1.


gd_repid = sy-repid.

   call function 'REUSE_ALV_GRID_DISPLAY'
        exporting
             i_callback_program      = gd_repid
             i_callback_top_of_page   = 'TOP-OF-PAGE'  "see FORM
             i_callback_user_command = 'USER_COMMAND'
*            i_grid_title           = outtext
             is_layout               = gd_layout
             it_fieldcat             = fieldcatalog[]
*            it_special_groups       = gd_tabgroup
             it_events               = gt_events
             is_print                = gd_prntparams
             i_save                  = 'X'
*            is_variant              = z_template
        tables
             t_outtab                = it_tab
        exceptions
             program_error           = 1
             others                  = 2.
   if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
   endif.



2.



form build_events.
   data: ls_event type slis_alv_event.

   call function 'REUSE_ALV_EVENTS_GET'
        exporting
             i_list_type = 0
        importing
             et_events   = gt_events[].
   read table gt_events with key name =  slis_ev_end_of_page
                            into ls_event.
   if sy-subrc = 0.
     move 'END_OF_PAGE' to ls_event-form.
     append ls_event to gt_events.
   endif.

     read table gt_events with key name =  slis_ev_end_of_list
                            into ls_event.
   if sy-subrc = 0.
     move 'END_OF_LIST' to ls_event-form.
     append ls_event to gt_events.
   endif.
endform. 


3.


FORM user_command USING r_ucomm LIKE sy-ucomm

                  rs_selfield TYPE slis_selfield.

* Check function code

  CASE r_ucomm.

    WHEN '&IC1'.

*   Check field clicked on within ALVgrid report

    IF rs_selfield-fieldname = 'EBELN'.

*     Read data table, using index of row user clicked on

      READ TABLE it_tab INTO wa_tab INDEX rs_selfield-tabindex.

*     Set parameter ID for transaction screen field

      SET PARAMETER ID 'BES' FIELD wa_tab-ebeln.

*     Sxecute transaction ME23N, and skip initial data entry screen

      CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.

    ENDIF.

  ENDCASE.

ENDFORM.

Check with above Code.

Regards,

Venkat

0 Kudos

Hi Pramodh,

Pl check below points :

1. Field names declared in field catalog should be in uppercase.

2. the field names of field catalog should be same as that declared in your output internal table ITAB_ERRORLOG


I think one of the above reasons may be resulting a dump.



Regards,

Ramiz

Former Member
0 Kudos

Hi Pramodh,

To use the doubleclick action in ALV Report  use the user-command as shown below

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

*   I_INTERFACE_CHECK              = ' '

*   I_BYPASSING_BUFFER             =

*   I_BUFFER_ACTIVE                = ' '

   I_CALLBACK_PROGRAM             = SY-REPID

*   I_CALLBACK_PF_STATUS_SET       = ' '

  I_CALLBACK_USER_COMMAND        = 'USER_COMMAND'

*   I_STRUCTURE_NAME               =

   IS_LAYOUT                      = LAYOUT

   IT_FIELDCAT                    = IT_FCAT

*   IT_EXCLUDING                   =

*   IT_SPECIAL_GROUPS              =

*   IT_SORT                        =

*   IT_FILTER                      =

*   IS_SEL_HIDE                    =

*   I_DEFAULT                      = 'X'

*   I_SAVE                         = ' '

*   IS_VARIANT                     =

*   IT_EVENTS                      =

*   IT_EVENT_EXIT                  =

*   IS_PRINT                       =

*   IS_REPREP_ID                   =

*   I_SCREEN_START_COLUMN          = 0

*   I_SCREEN_START_LINE            = 0

*   I_SCREEN_END_COLUMN            = 0

*   I_SCREEN_END_LINE              = 0

*   IR_SALV_LIST_ADAPTER           =

*   IT_EXCEPT_QINFO                =

*   I_SUPPRESS_EMPTY_DATA          = ABAP_FALSE

* IMPORTING

*   E_EXIT_CAUSED_BY_CALLER        =

*   ES_EXIT_CAUSED_BY_USER         =

  TABLES

    T_OUTTAB                       = IT_FINAL

* EXCEPTIONS

*   PROGRAM_ERROR                  = 1

*   OTHERS                         = 2

          .

IF SY-SUBRC <> 0.

* Implement suitable error handling here

ENDIF.

ENDFORM.                    " DISPLAY

*** CODE FOR DOUBLE CLICKING ON PERTICULAR FIELD AND LINKING THE REPORT TO RESPECTIVE TRANSACTION****

FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM RS_SELFIELD TYPE SLIS_SELFIELD.

CASE R_UCOMM.

WHEN '&IC1'.        " SAP STANDARD CODE FOR DOUBLE-CLICKING

      SET PARAMETER ID 'XXX' FIELD RS_SELFIELD-FIELDNAME."FIELDNAME.

      IF RS_SELFIELD-FIELDNAME  = 'VBELN1'."DOUBLE CLICK ON BILLING DOCUMENT NUMBER PROGRAM WILL GO TO T-CODE VF03.

CALL TRANSACTION 'VF03'.

ELSEIF RS_SELFIELD-FIELDNAME = 'VBELN'."DOUBLE CLICK ON SALES DOCUMENT NUMBER THEN THE PROGRAM WILL GO TO T-CODE VA03.

  CALL TRANSACTION 'VA03'.

ENDIF.

  ENDCASE.

ENDFORM.

Hope this will help you.

Regards

Rounak