on 2023 Apr 24 2:17 PM
Hello,
while saving material changes e.g. via MM02 but also in general, we want to update MVKE-PRDHA and MVKE-VMSTA for several sales orgs, depending on old and new MARA-PRDHA. How can this be done?
What we already tried:
Thank you, best regards.
Request clarification before answering.
Solution was to make a Z function module as a wrapper:
This Z function module has processing type:
In this Z function module just the SAP function module gets called:
CONSTANTS: lc_tcode_exit TYPE char10 VALUE '(EXIT)',
lc_kz_no_warn TYPE messagetyp VALUE 'N',
lc_call_mode_mdg TYPE mmd_c_mode VALUE 'MDG'.
CALL FUNCTION 'MATERIAL_MAINTAIN_DARK'
EXPORTING
flag_muss_pruefen = abap_false
p_kz_no_warn = lc_kz_no_warn
kz_prf = abap_false
kz_dispo = abap_false
call_mode = lc_call_mode_mdg
call_mode2 = lc_call_mode_mdg
flg_mass = abap_true
iv_change_doc_tcode = lc_tcode_exit
TABLES
amara_ueb = it_mara
amvke_ueb = it_mvke
EXCEPTIONS
kstatus_empty = 1
tkstatus_empty = 2
t130m_error = 3
internal_error = 4
too_many_errors = 5
update_error = 6
error_propagate_header = 7
OTHERS = 8.
In the userexit it was neccessary to hinder recursive calls:
DATA: lt_abap_stack TYPE abap_callstack,
lt_sys_stack TYPE sys_callst.
CALL FUNCTION 'SYSTEM_CALLSTACK'
IMPORTING
callstack = lt_abap_stack
et_callstack = lt_sys_stack.
READ TABLE lt_abap_stack WITH KEY blockname = 'Z_MATERIAL_MAINTAIN_DARK' TRANSPORTING NO FIELDS.
IF sy-subrc EQ 0.
DATA(lv_is_called_from_z_fb) = abap_true.
ENDIF.
IF lv_is_called_from_z_fb EQ abap_false.
....
ENDIF.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
100 | |
16 | |
6 | |
5 | |
5 | |
4 | |
4 | |
3 | |
3 | |
2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.