05-04-2006 10:31 AM
Hello,
I've a little problem using MATERIAL_MAINTAIN_DARK to modify some materials.
I have to update fields in two append structures (one in mara, one in marm)
when I use this function module, the update is ok on marm but not on mara
if anyone have an idea ??
Thanks in advance
05-04-2006 10:40 AM
Hai Fabrice
check the following Code
DATA: h_anzfehler LIKE tbist-numerror.
DATA: BEGIN OF t_mara_ueb OCCURS 1.
INCLUDE STRUCTURE mara_ueb.
DATA: END OF t_mara_ueb.
DATA: BEGIN OF t_mbew_ueb OCCURS 1.
INCLUDE STRUCTURE mbew_ueb.
DATA: END OF t_mbew_ueb.
DATA: t_merrdat TYPE merrdat OCCURS 0 WITH HEADER LINE.
aufbauen T_MARA_UEB
CLEAR: t_mara_ueb.
REFRESH: t_mara_ueb.
t_mara_ueb-mandt = sy-mandt.
t_mara_ueb-matnr = t_mbew-matnr.
t_mara_ueb-tcode = 'MM02'.
t_mara_ueb-tranc = h_tranc. "Transaktionszähler
APPEND t_mara_ueb.
aufbauen T_MBEW_UEB
CLEAR: t_mbew_ueb.
REFRESH: t_mbew_ueb.
t_mbew_ueb-mandt = sy-mandt.
t_mbew_ueb-matnr = t_mbew-matnr.
t_mbew_ueb-bwkey = t_mbew-bwkey.
t_mbew_ueb-bwtar = t_mbew-bwtar.
t_mbew_ueb-tranc = h_tranc. "Transaktionszähler
Änderung der Preissteuerung in der lfd. Periode
IF t_mbew-vprsv NE p_vprsvn.
t_mbew_ueb-vprsv = p_vprsvn. "neue Preissteuerung->lfd.Per.
ENDIF.
Änderung der Preissteuerung in der Vorperiode
IF t_mbew-vmvpr NE p_vprsvn.
t_mbew_ueb-vmvpr = p_vprsvn. "neue Preissteuerung-> Vorper.
ENDIF.
Änderung der Preissteuerung in der letzten Periode des Vorjahres
IF flag_vm_eq_vj = 'X'. "Vorperiode = Vorjahr
IF t_mbew-vjvpr NE p_vprsvn.
t_mbew_ueb-vjvpr = p_vprsvn. "neue Preissteuerung-> Vorjahr
ENDIF.
ENDIF.
APPEND t_mbew_ueb.
CLEAR: t_merrdat.
REFRESH: t_merrdat.
CLEAR: h_anzfehler.
CALL FUNCTION 'MATERIAL_MAINTAIN_DARK'
EXPORTING
FLAG_MUSS_PRUEFEN = 'X'
SPERRMODUS = 'E'
MAX_ERRORS = 0
p_kz_no_warn = 'N'
kz_prf = 'E'
kz_aend = 'X'
kz_dispo = ' '
IMPORTING
number_errors_transaction = h_anzfehler
TABLES
amara_ueb = t_mara_ueb
ambew_ueb = t_mbew_ueb
amerrdat = t_merrdat
EXCEPTIONS
kstatus_empty = 1
tkstatus_empty = 2
t130m_error = 3
internal_error = 4
too_many_errors = 5
update_error = 6
OTHERS = 7.
IF NOT h_anzfehler IS INITIAL.
PERFORM build_message.
EXIT. "Abbruch Form-Verarbeitung
ELSE.
flag_vprsv_upd = 'X'.
ENDIF.
Thanks & Regards
Sreenivasulu P
05-04-2006 10:38 AM
05-04-2006 10:40 AM
Hai Fabrice
check the following Code
DATA: h_anzfehler LIKE tbist-numerror.
DATA: BEGIN OF t_mara_ueb OCCURS 1.
INCLUDE STRUCTURE mara_ueb.
DATA: END OF t_mara_ueb.
DATA: BEGIN OF t_mbew_ueb OCCURS 1.
INCLUDE STRUCTURE mbew_ueb.
DATA: END OF t_mbew_ueb.
DATA: t_merrdat TYPE merrdat OCCURS 0 WITH HEADER LINE.
aufbauen T_MARA_UEB
CLEAR: t_mara_ueb.
REFRESH: t_mara_ueb.
t_mara_ueb-mandt = sy-mandt.
t_mara_ueb-matnr = t_mbew-matnr.
t_mara_ueb-tcode = 'MM02'.
t_mara_ueb-tranc = h_tranc. "Transaktionszähler
APPEND t_mara_ueb.
aufbauen T_MBEW_UEB
CLEAR: t_mbew_ueb.
REFRESH: t_mbew_ueb.
t_mbew_ueb-mandt = sy-mandt.
t_mbew_ueb-matnr = t_mbew-matnr.
t_mbew_ueb-bwkey = t_mbew-bwkey.
t_mbew_ueb-bwtar = t_mbew-bwtar.
t_mbew_ueb-tranc = h_tranc. "Transaktionszähler
Änderung der Preissteuerung in der lfd. Periode
IF t_mbew-vprsv NE p_vprsvn.
t_mbew_ueb-vprsv = p_vprsvn. "neue Preissteuerung->lfd.Per.
ENDIF.
Änderung der Preissteuerung in der Vorperiode
IF t_mbew-vmvpr NE p_vprsvn.
t_mbew_ueb-vmvpr = p_vprsvn. "neue Preissteuerung-> Vorper.
ENDIF.
Änderung der Preissteuerung in der letzten Periode des Vorjahres
IF flag_vm_eq_vj = 'X'. "Vorperiode = Vorjahr
IF t_mbew-vjvpr NE p_vprsvn.
t_mbew_ueb-vjvpr = p_vprsvn. "neue Preissteuerung-> Vorjahr
ENDIF.
ENDIF.
APPEND t_mbew_ueb.
CLEAR: t_merrdat.
REFRESH: t_merrdat.
CLEAR: h_anzfehler.
CALL FUNCTION 'MATERIAL_MAINTAIN_DARK'
EXPORTING
FLAG_MUSS_PRUEFEN = 'X'
SPERRMODUS = 'E'
MAX_ERRORS = 0
p_kz_no_warn = 'N'
kz_prf = 'E'
kz_aend = 'X'
kz_dispo = ' '
IMPORTING
number_errors_transaction = h_anzfehler
TABLES
amara_ueb = t_mara_ueb
ambew_ueb = t_mbew_ueb
amerrdat = t_merrdat
EXCEPTIONS
kstatus_empty = 1
tkstatus_empty = 2
t130m_error = 3
internal_error = 4
too_many_errors = 5
update_error = 6
OTHERS = 7.
IF NOT h_anzfehler IS INITIAL.
PERFORM build_message.
EXIT. "Abbruch Form-Verarbeitung
ELSE.
flag_vprsv_upd = 'X'.
ENDIF.
Thanks & Regards
Sreenivasulu P
05-04-2006 10:54 AM
Thanks for your help, I filled the transaction code ,
here's the code :
DATA: t_amara_ueb LIKE mara_ueb OCCURS 0 WITH HEADER LINE.
DATA: t_amarm_ueb LIKE marm_ueb OCCURS 0 WITH HEADER LINE.
t_amara_ueb-matnr = 'T20204'.
t_amara_ueb-tcode = 'MM02'.
t_amara_ueb-zznomix = 'X'.
t_amara_ueb-zzheavy = 'X'.
t_amara_ueb-zzscan_mat = 'X'.
w_count = w_count + 1.
t_amara_ueb-tranc = w_count.
APPEND t_amara_ueb.
CLEAR t_amara_ueb.
t_amarm_ueb-matnr = 'T20204'.
t_amarm_ueb-meinh = 'KAR'.
t_amarm_ueb-zzhiepos = 2.
t_amarm_ueb-zzvrkme = 'X'.
t_amarm_ueb-zzpacked = ' '.
t_amarm_ueb-zzmatnr_e = ' '.
APPEND t_amarm_ueb.
CLEAR t_amarm_ueb.
CALL FUNCTION 'MATERIAL_MAINTAIN_DARK'
EXPORTING
sperrmodus = ' '
kz_prf = 'W'
max_errors = ' '
p_kz_no_warn = 'X'
kz_verw = 'X'
kz_aend = 'X'
kz_dispo = 'X'
kz_test = ' '
flag_muss_pruefen = ' '
call_mode = 'ACT'
IMPORTING
matnr_last = w_matnr_last
number_errors_transaction = w_nb_errors
TABLES
amara_ueb = t_amara_ueb
amarm_ueb = t_amarm_ueb
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.
ENDIF.
05-04-2006 11:09 AM
Hello Fabrice,
u also need to have t_amarm_ueb-tranc filled with w_count. I am assuming that the z fields are also appended in mara_ueb and marm_ueb.
05-04-2006 11:22 AM
Sorry, it's a simplified copy and I ommit this part but it's done in the real program.
Yes z fields are appended in mara and marm
Thanks
05-04-2006 12:50 PM
Standard material master data from mara are ok too.
the problem only concerns my mara append table
no idea ?
05-04-2006 1:03 PM
As this function is used by the Direct Input program RMDATIND, have you checked the documentation for that, (or even the code).
When I looked at that (3.0b/d) you had to run a generate program to use the new 'z' input structure (ZMMH1?) for the append fields.
MattG.
05-05-2006 8:17 AM
Thanks matthew, I'am going to check this.
Rmdatind is using structures which are not including my append structures but the function module MATERIAL_MAINTAIN_DARK uses mara and marm structures so, it includes my appends;
05-05-2006 8:28 AM
05-05-2006 8:32 AM
Hello, MARA_UEB includes MARA then it includes my mara append table too.
05-05-2006 9:04 AM
Hi Fabrice,
There are a couple of things:
1. In your append structure if you are trying to clear any fields then you must ensure that the table parameter "AMFIELDRES" is also populated with the field that needs to be cleared.
2. Also in my experience I think you need to populate the D_IND field of all the tables as well.
Urmila
05-05-2006 10:07 AM
Thanks Urmila,
AMFIELDRES help me to clear the fields in my MARM append structure.
I populated D_IND in my 2 tables but my append fields in table mara are not maintained !!!!
05-05-2006 10:08 AM
I populated d_ind with the same thing as tranc (with a counter) is it ok ?
06-19-2006 9:19 PM
Hi Fabrice.
When you add custom fields to MARA, in order to
update them with MATERIAL_MAINTAIN_DARK you (or more
precisely MM application consultant) shoud maintain assignment of these fields to 'field group'. this should be done in customization :
LogisticGeneral->MaterialMaster->Field Selection->Assign fields to field selection group.
Cheers,
Yan
10-27-2006 2:48 AM
Hi,
I have some z-fields in MARA table and they already have values. I want to clear all those fields. I could clear date and time fields but i am not able to clear flag fields. I am able to add a 'X' to a empty field but I cant do the reverse i.e am not able to clear the fields which already have X. I am also unable to clear some fields with numbers. PLEASE GUIDE. Iam using MATERIAL_MAINTAIN_DARK.
11-25-2009 4:14 PM
Hi Fabrice Petetin ,
I am facing the same problem with 'MATERIAL_MAINTAIN_DARK ' FM. i have extended the mara structure with custom fields and i am trying to create/change material through MATMAS05 IDOC, this is using the FM IDOC_INPUT_MATMAS01. My entire data of custom fields are getting passed to the 'MATERIAL_MAINTAIN_DARK' FM which is being called inside the FM IDOC_INPUT_MATMAS01.
Its creating the material but the custom fields are not getting updated with any data. Could you please help me if you have any solution for this.
Thanks in advance.
SK.
Edited by: s k on Nov 25, 2009 5:15 PM
02-22-2012 10:49 AM
11-25-2009 4:18 PM
Hi all,
Please dont give me any sdn links. i have searched all the links and tried.
Thanks in advance.
SK.
Edited by: s k on Nov 25, 2009 5:19 PM
Edited by: s k on Nov 25, 2009 5:20 PM
Edited by: s k on Nov 25, 2009 5:21 PM