08-06-2009 2:53 PM
This issue is not yet solved . Please give me a clue to solve the same.
(MM02) When the material level hierarchy (MARA-PRDHA) is updated on the Basic Data 1 view of the material master, upon saving the system should find all the sales organisations (sales org 2 TAB)n material and update the product hierarchy (MVKE-PRODH).
For this I wrote a piece of code in the exit u2026zxmg0u02 which is in FM : EXIT_SAPLMGMU_001
select single PRDHA from mara into v_PRDHA where matnr = wmara-matnr.
if v_PRDHA NE wmara-PRDHA.
t_mara-MANDT = wmara-MANDT.
t_mara-matnr = wmara-matnr.
t_mara-PRDHA = wmara-PRDHA.
t_mara-tcode = 'MM02'.
append t_mara.
SELECT matnr VKORG VTWEG
FROM mvke into CORRESPONDING fields of table t_mvke
WHERE matnr = wmara-matnr.
IF sy-subrc = 0.
loop at t_mvke.
t_mvke-PRODH = t_mara-PRDHA.
modify t_mvke from t_mvke index sy-tabix.
endloop.
IMPORT V_FLAG FROM MEMORY ID 'Z_FLAG'.
IF V_FLAG IS INITIAL.
CALL FUNCTION 'MATERIAL_MAINTAIN_DARK'
EXPORTING
P_KZ_NO_WARN = 'W'
KZ_PRF = 'E'
IMPORTING
MATNR_LAST =
NUMBER_ERRORS_TRANSACTION =
TABLES
AMARA_UEB = t_mara
AMVKE_UEB = t_mvke
EXCEPTIONS
KSTATUS_EMPTY = 1
TKSTATUS_EMPTY = 2
T130M_ERROR = 3
INTERNAL_ERROR = 4
TOO_MANY_ERRORS = 5
UPDATE_ERROR = 6
OTHERS = 7
.
IF SY-SUBRC 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
*ELSE .
*COMMIT WORK AND WAIT.
ENDIF.
V_FLAG = 'X'.
EXPORT V_FLAG TO MEMORY ID 'Z_FLAG'.
ELSE.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
But the Function Module -MATERIAL_MAINTAIN_DARK is recessively calling the exit .
Please correct if this is not the right way to solve the requirement.
suggest the best.
08-06-2009 6:38 PM
Not sure if it's the right way to do this or not, but to avoid that recessive call oo the exit you can call the function SYSTEM_CALLSTACK inside your exit and check the callstack if you came in from the standard MM02 change or from 'MATERIAL_MAINTAIN_DARK' (or you your exit appears twice on the callback).
If you came in from MATERIAL_MAINTAIN_DARK you just get out of your exit and do nothing.
Regards,
Sergio
08-06-2009 9:00 PM
Hi ,
Can you please explain in simple terms. I Tried reading your suggestion/answer but i couldnot understand what exactly your point is..
Regards,
Mayank
11-24-2014 4:04 PM
Hi Roshan,
I have similar requirement, did you get the solutions? if yes please share with me
Thanks,
Vinod.