on 01-22-2011 11:18 AM
Dear All,
I am trying to add raw material (with MRP type as 'PD' - "Individual requirements only") to activitity under a WBS element in a project
But it is giving me message -
Material only for individual requirements (check entry)
Message no. CN727.
Pl. help me sorting the issue.
Regards
Ratna
Hi all,
The solution for that is, to do a bit of enhancement :).
If we can manually add same component, bapi should add it too.
When code tries to read material details for bapi, because of call stack, it knows the main program in sy-cprog. So if you add a flag in main program and read it at the bottom enhancement of MATERIAL_READ function, you can change the individual /collective value according that flag.
Here is the code for you.
Prog and flag
Class
CLASS zps_cl_utils DEFINITION
PUBLIC
CREATE PUBLIC .
PUBLIC SECTION.
"Bulk upload programs should place a global variable named is_bulk and value must be true
"MRP4 Individual /collective entry
CONSTANTS: c_bulk_var_name(25) TYPE c VALUE 'is_bulk'.
CLASS-METHODS is_bulk_upload_program
IMPORTING
VALUE(progname) TYPE syst-cprog OPTIONAL
EXPORTING
state TYPE zutils_cl_defs=>gty_status
is_bulk TYPE xfeld.
"Function Module MATERIAL_READ enhancement
CLASS-METHODS material_read_fm_enhc_01
IMPORTING
VALUE(progname) TYPE syst-cprog OPTIONAL
EXPORTING
state TYPE zutils_cl_defs=>gty_status
is_bulk TYPE xfeld
CHANGING
matdaten TYPE any.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS ZPS_CL_UTILS IMPLEMENTATION.
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Static Public Method ZPS_CL_UTILS=>IS_BULK_UPLOAD_PROGRAM
* +-------------------------------------------------------------------------------------------------+
* | [--->] PROGNAME TYPE SYST-CPROG(optional)
* | [<---] STATE TYPE ZUTILS_CL_DEFS=>GTY_STATUS
* | [<---] IS_BULK TYPE XFELD
* +--------------------------------------------------------------------------------------</SIGNATURE>
METHOD is_bulk_upload_program.
"For Example : Tcode ZPS_FORECAST and ZPS_PROJECT are bulk upload programs.
DATA: exref TYPE REF TO cx_root.
TRY.
IF progname IS INITIAL.
progname = sy-cprog.
ENDIF.
DATA(mem_bulk) = '(' && progname && ')' && c_bulk_var_name.
FIELD-SYMBOLS: <is_bulk> TYPE xfeld.
ASSIGN (mem_bulk) TO <is_bulk>.
IF <is_bulk> IS ASSIGNED.
is_bulk = <is_bulk>.
ENDIF.
state-status = zutils_cl_defs=>c_stat_success.
CATCH cx_root INTO exref.
state-status = zutils_cl_defs=>c_stat_error.
state-status_text = exref->get_text( ).
ENDTRY.
ENDMETHOD.
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Static Public Method ZPS_CL_UTILS=>MATERIAL_READ_FM_ENHC_01
* +-------------------------------------------------------------------------------------------------+
* | [--->] PROGNAME TYPE SYST-CPROG(optional)
* | [<---] STATE TYPE ZUTILS_CL_DEFS=>GTY_STATUS
* | [<---] IS_BULK TYPE XFELD
* | [<-->] MATDATEN TYPE ANY
* +--------------------------------------------------------------------------------------</SIGNATURE>
METHOD material_read_fm_enhc_01.
"MRP4 Individual /collective entry
"If you are trying to add components with BAPI_NETWORK_COMP_ADD, materials MRP4 BOM Ex entry needs to be empty
"If it is 2 - collective we need to change it to empty
"If procurment type is 8 (Reservation for WBS, 1 - individual works too)
"If procurment type is 3 (Reservation for Network, that entry needs to be empty)
DATA: exref TYPE REF TO cx_root.
TRY.
is_bulk_upload_program(
EXPORTING
progname = progname
IMPORTING
state = state
is_bulk = is_bulk
).
IF is_bulk EQ abap_true.
CONSTANTS : c_both TYPE sbdkz VALUE IS INITIAL.
CONSTANTS : c_individual TYPE sbdkz VALUE '1'.
CONSTANTS : c_collective TYPE sbdkz VALUE '2'.
"Check data type of matdaten
ASSIGN COMPONENT 'sbdkz' OF STRUCTURE matdaten TO FIELD-SYMBOL(<sbdkz>).
IF <sbdkz> IS ASSIGNED.
<sbdkz> = c_both.
ENDIF.
ENDIF.
CATCH cx_root INTO exref.
state-status = zutils_cl_defs=>c_stat_error.
state-status_text = exref->get_text( ).
ENDTRY.
ENDMETHOD.
ENDCLASS.
Func and enhancement
"PS Bulk Upload Enhancement, changing mrp4 collective entry to individual
IF SCHLUESSEL-KENNG = 'MSFCV' or SCHLUESSEL-KENNG = 'MARC'.
zps_cl_utils=>material_read_fm_enhc_01(
CHANGING
matdaten = matdaten
).
ENDIF.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ratna Palit,
Please check the "Individual/collective Indiactor" parameter in MRP 4.
The reason for error while assigning the material component was that, in material master ICI indicator might have been maintained as 2 instead of 1.
Indicator 2 stands for - Plant stock and Indicator - 1 stands for either project or sales order stock.
Please ask your MM team to change those settings and try again for assignment.
Hope this will fix your issue.
Regards,
PSR
Edited by: PSR on Jan 25, 2011 2:52 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Check these notes,
Note 1174083 - Error CN 727 in BAPI_NETWORK_COMP_ADD
Note 1099070 - Error CN727 in BAPI_NETWORK_COMP_ADD
Revert if it is useful.
Regards,
Gokul
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What stg grp are you maintaining in MRP-3 ? Better still upload screenshots of MRP 1-4, along with network component view, showing the details of procurement type etc to some portal n paste link here.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
98 | |
11 | |
11 | |
6 | |
6 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.