Skip to Content
-1
Feb 11 at 09:40 AM

Back Button not working for MM02

553 Views Last edit Feb 11 at 10:30 AM 3 rev

Hi Everyone ,

I have created one custom ALV report for some material master fields . User can select all the materials and using a custom button they can go to the MM02 screen and change the material and save it. It is working fine. Problem is - user wants to use the back button to come back to the ALV output screen say from MM02 after editing 1 material or maybe few material . This back button is not working . Could anyone please suggest how we can achieve that .
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
CASE r_ucomm.
WHEN '&IC1'. "standard Function code for double click
IF rs_selfield-fieldname EQ 'MATNR'.
READ TABLE gt_data INTO gs_data INDEX rs_selfield-tabindex.
IF sy-subrc = 0.
SET PARAMETER ID 'MAT' FIELD gs_data-matnr.
SET PARAMETER ID 'MXX' FIELD 'K'.
CALL TRANSACTION 'MM02' AND SKIP FIRST SCREEN.
ENDIF.
ELSEIF rs_selfield-fieldname EQ 'WERKS'.
READ TABLE gt_data INTO gs_data INDEX rs_selfield-tabindex.
IF sy-subrc = 0.
SET PARAMETER ID 'MAT' FIELD gs_data-matnr.
SET PARAMETER ID 'WRK' FIELD gs_data-werks .
SET PARAMETER ID 'MXX' FIELD 'D' .
CALL TRANSACTION 'MM02' AND SKIP FIRST SCREEN.
ENDIF.
ENDIF.
WHEN '&BUT1'.
LOOP AT gt_data INTO gs_data WHERE sel = 'X'.
SET PARAMETER ID 'MAT' FIELD gs_data-matnr.
SET PARAMETER ID 'MXX' FIELD 'K'.
CALL TRANSACTION 'MM02' AND SKIP FIRST SCREEN.
CLEAR : gs_data.
ENDLOOP.
WHEN '&BUT2'.
LOOP AT gt_data INTO gs_data WHERE sel = 'X'.
SET PARAMETER ID 'MAT' FIELD gs_data-matnr.
SET PARAMETER ID 'WRK' FIELD gs_data-werks .
SET PARAMETER ID 'MXX' FIELD 'D' .
CALL TRANSACTION 'MM02' AND SKIP FIRST SCREEN.
CLEAR : gs_data.
ENDLOOP.