2012 Dec 12 5:39 AM
The tried to use double clicking command on ALV. But an error stated that 'Statement is not accessible.'
Thanx.
Code:
FORM user_command USING ucomm TYPE SY-UCOMM
wa_selfield TYPE SLIS_SELFIELD.
CASE ucomm.
WHEN '&IC1'.
READ TABLE it_alv INDEX wa_selfield-tabindex INTO wa_alv .
IF NOT wa_alv-matnr IS INITIAL.
CALL TRANSACTION 'MM02'. "AND SKIP FIRST SCREEN.
ENDIF.
ENDCASE.
ENDFORM.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
IT_FIELDCAT = it_fieldcat
IS_LAYOUT = alv_layout
TABLES
T_OUTTAB = it_alv
EXCEPTIONS
PROGRAM_ERROR = 1.
Moderator message : Not enough re-search before posting, discussion un-marked as question.
Message was edited by: Vinod Kumar
The tried to use double clicking command on ALV. But an error stated that 'Statement is not accessible.'
Thanx.
Code:
FORM user_command USING ucomm TYPE SY-UCOMM
wa_selfield TYPE SLIS_SELFIELD.
CASE ucomm.
WHEN '&IC1'.
READ TABLE it_alv INDEX wa_selfield-tabindex INTO wa_alv .
IF NOT wa_alv-matnr IS INITIAL.
CALL TRANSACTION 'MM02'. "AND SKIP FIRST SCREEN.
ENDIF.
ENDCASE.
ENDFORM.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
IT_FIELDCAT = it_fieldcat
IS_LAYOUT = alv_layout
TABLES
T_OUTTAB = it_alv
EXCEPTIONS
PROGRAM_ERROR = 1.
Moderator message : Not enough re-search before posting, discussion un-marked as question.
Message was edited by: Vinod Kumar
2012 Dec 12 5:41 AM
You can modify following code.. or check the differences
FORM DISPLAY_ALV_REPORT.
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' <<<<<<< this is perform for below code
* i_grid_title = outtext
IS_LAYOUT = GD_LAYOUT
IT_FIELDCAT = FIELDCATALOG[]
* it_special_groups = gd_tabgroup
* IT_EVENTS = GT_XEVENTS
I_SAVE = 'X'
* is_variant = z_template
TABLES
T_OUTTAB = IT
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.
ENDFORM. " DISPLAY_ALV_REPORT
FORM USER_COMMAND USING UCOMM TYPE SY-UCOMM
SELFIELD TYPE SLIS_SELFIELD.
CASE UCOMM.
WHEN '&IC1'.
READ TABLE IT INDEX SELFIELD-TABINDEX INTO WA.
IF SY-SUBRC EQ 0.
IF SELFIELD-FIELDNAME = 'EBELN' ."AND NOT WA-LIFNR IS INITIAL.
SET PARAMETER ID 'BES' FIELD WA-EBELN.
CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
ENDIF.
ENDIF.
ENDCASE.
ENDFORM.
2012 Dec 12 5:51 AM
Hi,
write the call to function module above the form statement if it is a single program.
if you are using include for subroutines write the call to function module in a form and call this form in main program before the user command form. This is only if you are using the include. Otherwise just interchange the positions of form and call to function module.
thanks.
2012 Dec 14 11:38 AM
Hi,
I think ushould write like this-----
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
i_callback_program = g_repid
I_CALLBACK_PF_STATUS_SET = ' '
i_callback_user_command = 'user_command'
I_CALLBACK_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS =
IS_LAYOUT =
it_fieldcat = it_fieldcat
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT = IT_SORT
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
it_events = it_event
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
IT_ALV_GRAPHICS =
IT_ADD_FIELDCAT =
IT_HYPERLINK =
I_HTML_HEIGHT_TOP =
I_HTML_HEIGHT_END =
IT_EXCEPT_QINFO =
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.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM.
FORM event_call.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = it_event
EXCEPTIONS
list_type_wrong = 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.
ENDFORM.
---------------------------------------------------------------------*
FORM event_populate *
---------------------------------------------------------------------*
........ *
---------------------------------------------------------------------*
FORM event_populate.
READ TABLE it_event INTO wa_event WITH KEY name = 'USER_COMMAND'.
IF sy-subrc EQ 0.
wa_event-form = 'USER_COMMAND'.
MODIFY it_event FROM wa_event TRANSPORTING form WHERE name =
wa_event-name.
ENDIF.
ENDFORM.
FORM user_command USING r_ucomm LIKE sy-ucomm
re_selfield TYPE slis_selfield.
CASE r_ucomm.
WHEN '&IC1'.
IF re_selfield-fieldname = 'MATNR'.
IF re_selfield-tabindex > 0.
READ TABLE it_ekko INTO wa_ekko INDEX re_selfield-tabindex.
read table it_final into wa_final index re_selfield-tabindex.
IF NOT wa_alv-matnr IS INITIAL.
CALL TRANSACTION 'MM02'. "AND SKIP FIRST SCREEN.
ENDIF.
ENDIF.
ENDIF.
ENDCASE.
ENDFORM.
Regards,
SHYAM.