cancel
Showing results for 
Search instead for 
Did you mean: 

Back Button not working for MM02

0 Kudos

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.

abo
Active Contributor

Without seeing the code, not really.

While you're editing the question to add the relevant parts, be sure to use the CODE tag to format it properly and make it easily readable.

Sandra_Rossi
Active Contributor
0 Kudos

thanks for adding the code to the question, there's now the last missing part from Andrea comment "be sure to use the CODE tag to format it properly and make it easily readable"

Concerning "back button is not working", would you mind telling us what is the exact symptom, as "is not working" doesn't shed much light on the actual issue...

0 Kudos

Hi sandra.rossi , Say I am taking Material 1 to 10 and then using my custom button I am entering into MM02 , I edit Material 01 and 02 , then I want to get back to my ALV output screen , don't want to edit 03 to 10 anymore . I am trying to use the Back button ( F3 ) but instead of coming back to ALV output screen it is going to Material 03 , then Material 04 like that , when I have reached to to Material 10 / last material . Then it is coming back to ALV output screen.

vijay_hariharan
Contributor
0 Kudos

The problem seems to be related to the CALL TRANSACTION within the loop.. you'll need to check which button is giving you problems.. It looks like all records in GT_DATA have sel = 'X'.. you'll want to take a look at this portion..

Sandra_Rossi
Active Contributor
0 Kudos

Thanks for clarifying. So, it's not an ABAP problem.

As a user, how do you want it to be handled? An easy solution is to edit only the first selected material. When you come back from MM02, the program should deselect that first material, and when user presses again the custom button, it will start MM02 for the next selected material. Of course, it means that the multiple selection is a little bit non-sense. If you think of another solution, please tell us.

Accepted Solutions (0)

Answers (0)