2007 Aug 03 11:50 AM
Hi all,
i'm trying to create a new material copy from the template material using FM. i have written an FM to implement this function, and it does work, the plant and storage location data is correct, but sale data is missing.
this FM's main idea:
first, read the template material record from mara, marc, makt, mvke, etc.
second, using MOVE-CORRESPONDING pass data to mara_ueb, marc_ueb, makt_ueb, mvke_ueb, etc.
finally, call FM:MATERIAL_MAINTAIN_DARK to create the new material.
everything is OK, except the sale data, the template material have one sale org, after executing FM, when open the new material sale view, the system prompt that: Sales organizations/distribution channels do not exist for this material.
WHERE iam doing the mistake.
am i missing something while create the sales view?.
Thanks in advance.
Joe
PS.
CALL FUNCTION 'MATERIAL_MAINTAIN_DARK'
EXPORTING
FLAG_MUSS_PRUEFEN = ' '
P_KZ_NO_WARN = 'E'
KZ_PRF = 'I'
IMPORTING
MATNR_LAST = matnr
NUMBER_ERRORS_TRANSACTION = materr
TABLES
AMARA_UEB = tmara
AMAKT_UEB = tmakt
AMARC_UEB = tmarc
AMARD_UEB = tmard
AMBEW_UEB = tmbew
ASTEU_UEB = tsteu
AMLGN_UEB = tmlgn
AMLGT_UEB = tmlgt
AMPGD_UEB = tmpgd
AMPOP_UEB = tmpop
AMVKE_UEB = tmvke
AMERRDAT = terror
EXCEPTIONS
KSTATUS_EMPTY = 1
TKSTATUS_EMPTY = 2
T130M_ERROR = 3
INTERNAL_ERROR = 4
TOO_MANY_ERRORS = 5
UPDATE_ERROR = 6
OTHERS = 7
Hi all,
i'm trying to create a new material copy from the template material using FM. i have written an FM to implement this function, and it does work, the plant and storage location data is correct, but sale data is missing.
this FM's main idea:
first, read the template material record from mara, marc, makt, mvke, etc.
second, using MOVE-CORRESPONDING pass data to mara_ueb, marc_ueb, makt_ueb, mvke_ueb, etc.
finally, call FM:MATERIAL_MAINTAIN_DARK to create the new material.
everything is OK, except the sale data, the template material have one sale org, after executing FM, when open the new material sale view, the system prompt that: Sales organizations/distribution channels do not exist for this material.
WHERE iam doing the mistake.
am i missing something while create the sales view?.
Thanks in advance.
Joe
PS.
CALL FUNCTION 'MATERIAL_MAINTAIN_DARK'
EXPORTING
FLAG_MUSS_PRUEFEN = ' '
P_KZ_NO_WARN = 'E'
KZ_PRF = 'I'
IMPORTING
MATNR_LAST = matnr
NUMBER_ERRORS_TRANSACTION = materr
TABLES
AMARA_UEB = tmara
AMAKT_UEB = tmakt
AMARC_UEB = tmarc
AMARD_UEB = tmard
AMBEW_UEB = tmbew
ASTEU_UEB = tsteu
AMLGN_UEB = tmlgn
AMLGT_UEB = tmlgt
AMPGD_UEB = tmpgd
AMPOP_UEB = tmpop
AMVKE_UEB = tmvke
AMERRDAT = terror
EXCEPTIONS
KSTATUS_EMPTY = 1
TKSTATUS_EMPTY = 2
T130M_ERROR = 3
INTERNAL_ERROR = 4
TOO_MANY_ERRORS = 5
UPDATE_ERROR = 6
OTHERS = 7
2007 Aug 03 12:05 PM
2007 Sep 06 7:02 AM
Hi,
For passing the values into any particular field you can also use 'field-symbols', which can be the most effective tool, which in turn directly points to the memory and substitues the values. For your MVKE update, have a look at the table tmvke while debugging, i.e., after passing it through the function module. If you happen to see any entries which have not been passed into the function module, check for field 'TRANC' in 'AMFIELDRES' int table. The tranc value must be unique for each entry, if you have gone wrong in assigning unique values for TRANC field then that particular field will not get updated.
Reward points if helpful.
Archana.