08-27-2009 12:55 PM
Hello All,
Have you used the following Function Modules?
MRTRS300_MASTER_RECIPE_INIT (Initialize internal tables of Master Recipe in C?BT
MRTRS300_MASTER_RECIPE_READ (Read Master Recipe data into internal table in C?BT )
MRTRS300_MASTER_RECIPE_SAVE (Save Master Recipe data from internal table C?BT to database )
MRTRS300_MASTER_RECIPE_WRITE (Write Master Recipe data into internal table in C?BT )
The above Function Modules are supposed to Change/Create Master Recipe (Transaction: C201, C202 and C203)
If any one of you have an idea on this, kindly share the details on the exporting parameters for each FM and the usage.
There are certain flags which needs to be set or not to be set. I am a bit confused on that part.
Any help is really appreciated.
Kind Regards
Sabu Kuriakose
09-01-2010 5:57 PM
Hi,
Can you please specify how you used this FM I also have the requiremnt to use this FM to upload Recipe.
Also i need to assign material to recipe header level operation level.
can you share you r experiance how you used the FM or send me details on my ID
07-06-2012 2:59 PM
Hello,
yes, a really bad problem.
I have seen several threads in several news groups.
Most answers were like this: "please try MRTRS300_MASTER_RECIPE_READ".
The best answer was given by a girl who creates a thread "Who can help me with this function call".
3 programmers answered they have no idea but are very interested because they also have to find a solution...
A few days later first girl wrote "ok, I have a solution." (Nothing more).
Ok, I have some results but please do not ask anything.
I do not know if some data are important or not important.
Some data I have marked on the right with some "!!!" like this: "!!!!!!!!!!
Because I know tables would not be filled if these fields are empty.
REPORT /AAG/ZANDERS123.
data:
ls_RC271 TYPE RC271,
lS_RC27M TYPE RC27M,
ls_RC27S TYPE RC27S,
lS_PLKOB TYPE PLKOB.
data:
XS_RC271 TYPE RC271,
XS_RC27M TYPE RC27M,
XS_RC27S TYPE RC27S,
ES_RC27I TYPE RC27I,
ES_PLKOB TYPE PLKOB,
ET_MKAL TYPE MRTRSTY_MKAL,
ET_OPERATION TYPE MRTRSTY_PLPO_OPR,
ET_PHASE TYPE MRTRSTY_PLPO_PH,
ET_RELATION TYPE MRTRSTY_PLAB,
ET_SEC_RESOURCE TYPE MRTRSTY_PLPO_SRES,
ET_MAPL TYPE MRTRSTY_MAPL,
ET_PLMZ TYPE MRTRSTY_PLMZ,
ET_PLFT TYPE MRTRSTY_PLFT,
ET_PLFV TYPE MRTRSTY_PLFV,
ET_PLMK TYPE MRTRSTY_PLMK,
ET_PLMW TYPE MRTRSTY_PLMW,
ET_RESCLAS TYPE MRTRSTY_RESCLAS,
ET_LTEXT TYPE MRTRSTY_LTXT,
ES_RC271 TYPE RC271,
ET_MSG TYPE MRTRSTY_CMFMSG.
CALL FUNCTION 'MRTRS300_MASTER_RECIPE_INIT'
EXPORTING
I_PLNTY = '2'
* IMPORTING
* ES_TCA01 =
* ES_TCA05 =
* ES_TCA09 =
* ES_TCA11 =
* ES_T430D =
EXCEPTIONS
NOT_FOUND = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ls_RC271-DATUV = '19800101'.
ls_RC271-DATUB = '9991212'.
ls_RC271-PLNAL = '01'.
ls_RC271-PLNTY = '2'.
ls_RC271-PLNNR = '00303089'.
ls_RC271-WERKS = '3440'.
ls_RC271-STTAG = '20120706'.
ls_RC271-PROFIDNETZ = 'PI01'. "from table TCA41 "!!!!!!!!!!
ls_RC271-VERWE = '1'. "!!!!!!!!!!
ls_rc27s-aktyp = 'V'. "!!!!!!!!!!
CALL FUNCTION 'MRTRS300_MASTER_RECIPE_READ'
EXPORTING
IS_RC271 = LS_RC271
IS_RC27M = LS_RC27M
IS_RC27S = LS_RC27S
IMPORTING
XS_RC271 = XS_RC271
XS_RC27M = XS_RC27M
XS_RC27S = XS_RC27S
ES_RC27I = ES_RC27I
ES_PLKOB = ES_PLKOB
ET_MKAL = ET_MKAL
ET_OPERATION = ET_OPERATION
ET_PHASE = ET_PHASE
ET_RELATION = ET_RELATION
ET_SEC_RESOURCE = ET_SEC_RESOURCE
ET_MAPL = ET_MAPL
ET_PLMZ = ET_PLMZ
ET_PLFT = ET_PLFT
ET_PLFV = ET_PLFV
ET_PLMK = ET_PLMK
ET_PLMW = ET_PLMW
ET_RESCLAS = ET_RESCLAS
ET_LTEXT = ET_LTEXT
EXCEPTIONS
KEY_NOT_QUALIFIED = 1
KEY_INVALID = 2
KEY_NUMBER_INVALID = 3
NOT_FOUND = 4
EXISTING = 5
INTERNAL_ERROR = 6
FOREIGN_LOCK = 7
OTHERS = 8.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Ok, in my system some tables are filled.
best regards
Norbert Zanders
01-18-2023 9:00 AM
Hi All,
I was able to add Materials to the Recipe Header->Materials Assignments section. Below is the sample code for the same.
Thanks
Ayyappan V
*&---------------------------------------------------------------------*
*& Report ZR_RECEIPE_READ
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT zr_receipe_read.
DATA:
ls_rc271 TYPE rc271,
ls_rc27m TYPE rc27m,
ls_rc27s TYPE rc27s.
* ls_plkob TYPE plkob.
DATA:
ls_rc271_o TYPE rc271,
ls_rc27m_o TYPE rc27m,
ls_rc27s_o TYPE rc27s,
ls_rc27i_o TYPE rc27i,
ls_plkob_o TYPE plkob,
ls_plkob TYPE plkob,
lt_mkal TYPE mrtrsty_mkal,
lt_mkal_o TYPE mrtrsty_mkal,
ls_mkal TYPE mkal,
ls_mkal_o TYPE mkal,
lt_operation TYPE mrtrsty_plpo_opr,
lt_operation_o TYPE mrtrsty_plpo_opr,
lt_phase TYPE mrtrsty_plpo_ph,
lt_phase_o TYPE mrtrsty_plpo_ph,
lt_relation TYPE mrtrsty_plab,
lt_relation_o TYPE mrtrsty_plab,
lt_sec_resource TYPE mrtrsty_plpo_sres,
lt_sec_resource_o TYPE mrtrsty_plpo_sres,
lt_mapl TYPE mrtrsty_mapl,
lt_mapl_o TYPE mrtrsty_mapl,
lt_plmz TYPE mrtrsty_plmz,
lt_plmz_o TYPE mrtrsty_plmz,
lt_plft TYPE mrtrsty_plft,
lt_plft_o TYPE mrtrsty_plft,
lt_plfv TYPE mrtrsty_plfv,
lt_plfv_o TYPE mrtrsty_plfv,
lt_plmk TYPE mrtrsty_plmk,
lt_plmk_o TYPE mrtrsty_plmk,
lt_plmw TYPE mrtrsty_plmw,
lt_plmw_o TYPE mrtrsty_plmw,
lt_resclas TYPE mrtrsty_resclas,
lt_resclas_o TYPE mrtrsty_resclas,
lt_ltext TYPE mrtrsty_ltxt,
lt_ltext_o TYPE mrtrsty_ltxt,
* ls_rc271 TYPE rc271,
lt_msg TYPE mrtrsty_cmfmsg,
lt_stpob TYPE mrtrsty_stpob,
ls_stkok_o TYPE stkok,
ls_stkob_o TYPE stkob.
CALL FUNCTION 'MRTRS300_MASTER_RECIPE_INIT'
EXPORTING
i_plnty = '2'
* IMPORTING
* ES_TCA01 =
* ES_TCA05 =
* ES_TCA09 =
* ES_TCA11 =
* ES_T430D =
EXCEPTIONS
not_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ls_rc271-datuv = '20230101'.
ls_rc271-datub = '99991212'.
ls_rc271-plnal = '01'.
ls_rc271-plnty = '2'.
ls_rc271-plnnr = '50000024'.
ls_rc271-werks = 'LS21'.
ls_rc271-sttag = '20230106'.
ls_rc271-profidnetz = 'PI01_XS'. "from table TCA41 "!!!!!!!!!!
ls_rc271-verwe = '1'. "!!!!!!!!!!
ls_rc27s-aktyp = 'V'. "!!!!!!!!!!
CALL FUNCTION 'MRTRS300_MASTER_RECIPE_READ'
EXPORTING
is_rc271 = ls_rc271
is_rc27m = ls_rc27m
is_rc27s = ls_rc27s
IMPORTING
xs_rc271 = ls_rc271_o
xs_rc27m = ls_rc27m_o
xs_rc27s = ls_rc27s_o
es_rc27i = ls_rc27i_o
es_plkob = ls_plkob_o
et_mkal = lt_mkal_o
et_operation = lt_operation_o
et_phase = lt_phase_o
et_relation = lt_relation_o
et_sec_resource = lt_sec_resource_o
et_mapl = lt_mapl_o
et_plmz = lt_plmz_o
et_plft = lt_plft_o
et_plfv = lt_plfv_o
et_plmk = lt_plmk_o
et_plmw = lt_plmw_o
et_resclas = lt_resclas_o
et_ltext = lt_ltext_o
EXCEPTIONS
key_not_qualified = 1
key_invalid = 2
key_number_invalid = 3
not_found = 4
existing = 5
internal_error = 6
foreign_lock = 7
OTHERS = 8.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4 INTO DATA(lv_msg).
MESSAGE lv_msg TYPE 'S'.
RETURN.
ENDIF.
APPEND VALUE #(
matnr = 'MZ-LS-CFG0019'
werks = 'LS21'
plnty = '2'
plnnr = '50000024'
plnal = '01'
zkriz = '0000006'
zaehl = '0000006'
datuv = '20230118'
andat = '20230118'
annam = sy-uname
valid_to = '99991231' ) TO lt_mapl.
ls_rc27s-aktyp = 'H'. "!!!!!!!!!!
*ok, in my system some tables a
CALL FUNCTION 'MRTRS300_MASTER_RECIPE_WRITE'
EXPORTING
is_rc271 = ls_rc271
is_rc27s = ls_rc27s
is_rc27m = ls_rc27m
is_plkob = ls_plkob
is_plkob_old = ls_plkob_o
is_mkal = ls_mkal
is_mkal_old = ls_mkal_o
it_operation = lt_operation
it_operation_old = lt_operation_o
it_phase = lt_phase
it_phase_old = lt_phase_o
it_relation = lt_relation
it_relation_old = lt_relation_o
it_sec_resource = lt_sec_resource
it_sec_resource_old = lt_sec_resource_o
it_mapl = lt_mapl
it_mapl_old = lt_mapl_o
it_plmz = lt_plmz
it_plmz_old = lt_plmz_o
it_plft = lt_plft
it_plft_old = lt_plft_o
it_plfv = lt_plfv
it_plfv_old = lt_plfv_o
it_plmk = lt_plmk
it_plmk_old = lt_plmk_o
it_plmw = lt_plmw
it_plmw_old = lt_plmw_o
it_resclas = lt_resclas_o
it_ltext = lt_ltext
it_ltext_old = lt_ltext_o
is_stkob = ls_stkob_o
is_stkok = ls_stkok_o
it_stpob = lt_stpob
* IMPORTING
* ES_PLKOB =
* ES_MKAL =
* ET_OPERATION =
* ET_PHASE =
* ET_RELATION =
* ET_SEC_RESOURCE =
* ET_MAPL =
* ET_PLMZ =
* ET_PLFT =
* ET_PLFV =
* ET_PLMK =
* ET_PLMW =
* ET_RESCLAS =
* ET_LTEXT =
* ET_PLNKN_OPR =
* ET_PLNKN_PH =
* ET_PLNKN_SOP =
* ET_PLMK_REL =
* ET_PI_KEY =
* ET_PI_CHAR_KEY =
EXCEPTIONS
not_found = 1
internal_error = 2
data_error = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4 INTO lv_msg.
MESSAGE lv_msg TYPE 'S'.
RETURN.
ELSE.
CALL FUNCTION 'MRTRS300_MASTER_RECIPE_SAVE'
EXPORTING
is_rc271 = ls_rc271_o
is_rc27m = ls_rc27m_o
is_rc27s = ls_rc27s_o
is_plkob = ls_plkob_o
IMPORTING
* ES_RC271 =
et_msg = lt_msg
EXCEPTIONS
save_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
* Implement suitable error handling here
ELSE.
COMMIT WORK AND WAIT.
ENDIF.
ENDIF.