2012 Dec 05 7:35 AM
hi All,
i have written below code to execute at user_command event , when i click on MATNR field it is not going to 'MM02 ' screen .
can anybody tell me what is fault in my code ?
form USER_COMMAND using ucomm like sy-ucomm selfield type slis_selfield
data : ok_code type sy-ucomm.
ok_code = ucomm.
case ok_code.
when 'MY_SELECTION'.
if selfield-fieldname = 'MATNR'.
read table it_final into wa_final index selfield-tabindex.
if not wa_final-matnr is initial.
set parameter id 'MAT' field wa_final-matnr.
call transaction 'MM02' and skip first screen.
endif.
endif.
endcase.
endform.
2012 Dec 05 8:45 AM
hi
form USER_COMMAND using ucomm like sy-ucomm selfield type slis_selfield
case ucomm.
when 'MY_SELECTION'.
if selfield-fieldname = 'MATNR'.
read table it_final into wa_final index selfield-tabindex.
if not wa_final-matnr is initial.
set parameter id 'MAT' field wa_final-matnr.
call transaction 'MM02' and skip first screen.
endif.
endif.
endcase.
endform.
this will work...
hi All,
i have written below code to execute at user_command event , when i click on MATNR field it is not going to 'MM02 ' screen .
can anybody tell me what is fault in my code ?
form USER_COMMAND using ucomm like sy-ucomm selfield type slis_selfield
data : ok_code type sy-ucomm.
ok_code = ucomm.
case ok_code.
when 'MY_SELECTION'.
if selfield-fieldname = 'MATNR'.
read table it_final into wa_final index selfield-tabindex.
if not wa_final-matnr is initial.
set parameter id 'MAT' field wa_final-matnr.
call transaction 'MM02' and skip first screen.
endif.
endif.
endcase.
endform.
2012 Dec 05 7:45 AM
OK_CODE = UCOMM. (Incorrect)
OK_CODE = SY-UCOMM.. (Correct)
Avirat
2012 Dec 07 6:50 PM
2012 Dec 05 7:47 AM
Hi,
Just check whether the cursor comes into the
when 'MY_SELECTION'. in debugging mode.
i did not see any problem in ur code.
just declare the variables in the top include.
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
CASE r_ucomm.
WHEN '&IC1'.
IF rs_selfield-fieldname = 'VBELN'.
* Read data table, using index of row user clicked on
READ TABLE it_final INTO wa_final INDEX rs_selfield-tabindex.
* Set parameter ID for transaction screen field
SET PARAMETER ID 'AUN' FIELD wa_final-vbeln.
CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
ENDIF.
ENDCASE.ENDFORM. " DETAILED
regards
Ram
2012 Dec 05 7:48 AM
Hi Smitha,
In fieldcatalog, set hotspot for MATNR field.
if fieldcatalog-fieldname = 'MATNR'.
fieldcat-hotspot = 'X'.
endif.
and add double click event at user_command
form USER_COMMAND using ucomm like sy-ucomm selfield type slis_selfield
case ucomm.
when '&IC1'.
if selfield-fieldname = 'MATNR'.
read table it_final into wa_final index selfield-tabindex.
if not wa_final-matnr is initial.
set parameter id 'MAT' field wa_final-matnr.
call transaction 'MM02' and skip first screen.
endif.
endif.
endcase.
endform.
2012 Dec 05 8:32 AM
Hai Samitha,
First of all you debug it and check whether the system triggering the form or not.
If it is not triggering, means a possible reason is in your display function module you are passing the user command in small letter like 'user_command' it should be in Caps 'USER_COMMAND'.
or try the code as below:
form USER_COMMAND using zucomm like sy-ucomm
selfield type slis_selfield
data : ok_code type sy-ucomm.
ok_code = zucomm.
case ok_code.
when 'MY_SELECTION'.
if selfield-fieldname = 'MATNR'.
read table it_final into wa_final index selfield-tabindex.
if not wa_final-matnr is initial.
set parameter id 'MAT' field wa_final-matnr.
call transaction 'MM02' and skip first screen.
endif.
endif.
endcase.
endform.
Thanks,
Anoop S
2012 Dec 05 8:45 AM
hi
form USER_COMMAND using ucomm like sy-ucomm selfield type slis_selfield
case ucomm.
when 'MY_SELECTION'.
if selfield-fieldname = 'MATNR'.
read table it_final into wa_final index selfield-tabindex.
if not wa_final-matnr is initial.
set parameter id 'MAT' field wa_final-matnr.
call transaction 'MM02' and skip first screen.
endif.
endif.
endcase.
endform.
this will work...
2012 Dec 05 9:27 AM
hi All,
Thank you all for the replies ....
i tried all which is mentioned in the replies, still not working
When i'm trying to debug form is not triggering . please suggest on this .
Regards
Smitha
2012 Dec 05 9:32 AM
Hi,
Check in the FM 'REUSE_ALV_GRID_DISPLAY' whether u given
like this or not
i_callback_user_command = 'USER_COMMAND'
for eg:
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = i_repid
is_layout = gs_layout
i_callback_user_command = 'USER_COMMAND'
it_fieldcat = fieldcatalog[]
i_save = 'X'
TABLES
t_outtab = it_final[]
EXCEPTIONS
program_error = 1
OTHERS = 2.
2012 Dec 05 9:39 AM
hi,
if
i_callback_user_command = 'USER_COMMAND' is given this should work.
form USER_COMMAND using ucomm like sy-ucomm selfield type slis_selfield
case ucomm.
when 'MY_SELECTION'.
if selfield-fieldname = 'MATNR'.
read table it_final into wa_final index selfield-tabindex.
if not wa_final-matnr is initial.
set parameter id 'MAT' field wa_final-matnr.
call transaction 'MM02' and skip first screen.
endif.
endif.
endcase.
endform.
2012 Dec 05 9:48 AM
Hi,
I think you are trying to use single click only and expecting to trigger the event but it will not. either use double click or make the matnr field hotspot (for single click).
thanks.
2012 Dec 05 10:00 AM
Hi Smitha,
did you try double click("&IC1") event with hotspot?
if yes, please send your REUSE_ALV call statement and USER_COMMAND method completly.
2012 Dec 05 11:05 AM
hi
Below is my ALV grid and User_command code , i'm using hotspot
FORM DISPLAY_ALV_REPORT .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = v_repid
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
I_CALLBACK_TOP_OF_PAGE = 'TOP-OF-PAGE'
IS_LAYOUT = fs_layout
IT_FIELDCAT = i_fcat[]
I_DEFAULT = 'X'
I_SAVE = 'A'
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. " DISPLAY_ALV_REPORT
data : ok_code type sy-ucomm.
form USER_COMMAND using ucomm like sy-ucomm selfield type slis_selfield .
ok_code = ucomm.
case ok_code.
when '&IC1'.
if selfield-fieldname = 'MATNR'.
read table it_final into wa_final index selfield-tabindex.
* if not wa_final-matnr is initial.
set parameter id 'MAT' field wa_final-matnr.
call transaction 'MM02' and skip first screen.
* endif.
endif.
endcase.
endform.
2012 Dec 05 11:15 AM
DATA: v_events TYPE slis_t_event,
wa_event TYPE slis_alv_event.
in initialization event.
call these two performs.
PERFORM populate_event.
define these form calls in your code
FORM event_call.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = v_events.
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. "EVENT_CALL
*&--------------------------------------------------------------------*
*& Form POPULATE_EVENT
*&--------------------------------------------------------------------*
* Events populated for TOP OF PAGE & USER COMAND
*---------------------------------------------------------------------*
FORM populate_event.
READ TABLE v_events INTO wa_event WITH KEY name = 'TOP_OF_PAGE'.
IF sy-subrc EQ 0.
wa_event-form = 'TOP_OF_PAGE'.
MODIFY v_events FROM wa_event TRANSPORTING form WHERE name =
wa_event-form.
ENDIF.
READ TABLE v_events INTO wa_event WITH KEY name = 'USER_COMMAND'.
IF sy-subrc EQ 0.
wa_event-form = 'USER_COMMAND'.
MODIFY v_events FROM wa_event TRANSPORTING form WHERE name =
wa_event-name.
ENDIF.
ENDFORM.
and pass this events table in your ALV display call.. it_events parameters..
2012 Dec 05 11:44 AM
2012 Dec 05 11:50 AM
2012 Dec 05 11:55 AM
and also pass v_repid = sy-repid. before passing it to your ALV ....
2012 Dec 05 11:55 AM
Hi Smitha,
Are you sure to set v_repid with value of sy-repid before REUSE_ALV call.
DATA: v_repid like sy-repid.
v_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = v_repid
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
I_CALLBACK_TOP_OF_PAGE = 'TOP-OF-PAGE'
IS_LAYOUT = fs_layout
IT_FIELDCAT = i_fcat[]
I_DEFAULT = 'X'
I_SAVE = 'A'
TABLES
T_OUTTAB = it_final[]
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
.
2012 Dec 05 11:55 AM
Hi,
is double click also not working with &IC1 command?
thanks.
2012 Dec 06 4:05 AM
Do you activating the code before run or not ?
check all objects are activated or not.
2012 Dec 06 4:05 AM
2012 Dec 06 4:07 AM
hi
ya i have passed v_repid = sy-repid. still not working .
FORM DISPLAY_ALV_REPORT .
v_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = v_repid
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
I_CALLBACK_TOP_OF_PAGE = 'TOP-OF-PAGE'
IS_LAYOUT = fs_layout
IT_FIELDCAT = i_fcat[]
I_DEFAULT = 'X'
I_SAVE = 'A'
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. " DISPLAY_ALV_REPORT
data : ok_code type sy-ucomm.
form USER_COMMAND using ucomm like sy-ucomm selfield type slis_selfield .
ok_code = sy-ucomm.
case ok_code.
when '&IC1'.
if selfield-fieldname = 'MATNR'.
read table it_final into wa_final index selfield-tabindex.
* if not wa_final-matnr is initial.
set parameter id 'MAT' field wa_final-matnr.
call transaction 'MM02' and skip first screen.
* endif.
endif.
endcase.
endform.
2012 Dec 06 4:26 AM
I think the problem lies in the definition of 'MY_SELECTION'. Where are you declaring this ?
means you assigning one OK-Code, but how you are assigning?
2012 Dec 06 4:32 AM
hi Ritwik ,
below is my code
data : ok_code type sy-ucomm.
form USER_COMMAND using ucomm like sy-ucomm selfield type slis_selfield .
ok_code = sy-ucomm.
case ok_code.
when '&IC1'.
if selfield-fieldname = 'MATNR'.
read table it_final into wa_final index selfield-tabindex.
* if not wa_final-matnr is initial.
set parameter id 'MAT' field wa_final-matnr.
call transaction 'MM02' and skip first screen.
* endif.
endif.
endcase.
endform.
2012 Dec 06 4:41 AM
Hey you are using ucomm write as formal parameter and you should use the same instead of using sy-ucomm here.
ok_code = sy-ucomm. Because at this point the value of sy-ucomm might have changed.
2012 Dec 06 8:09 AM
2012 Dec 06 9:22 AM
Thnk u all for the replies.
Issue has been rectified . I commented ok_code = sy-ucomm and it is working fine .
form USER_COMMAND using ucomm like sy-ucomm selfield type slis_selfield .
* ok_code = sy-ucomm.
case ucomm.
when '&IC1'.
if selfield-fieldname = 'MATNR'.
read table it_final into wa_final index selfield-tabindex.
* if not wa_final-matnr is initial.
set parameter id 'MAT' field wa_final-matnr.
call transaction 'MM03' and skip first screen.
* endif.
endif.
endcase.
endform.
2012 Dec 06 8:38 AM
If you have resolved the issue please mark question as answered and close the thread.
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |