on 2022 Feb 21 9:37 AM
we need to create report by MCEC according to weekly period
Request clarification before answering.
Hello ptk.alborz
The MCEC transaction is tightly connected with S012 info structure, in fact S012 is hardcoded in MCEC. Therefore, the only way to change the period unit of MCEC to weeks is to make the change in OMO2. However that has profound effects on purchasing reporting, as all LIS Purchasing reports that use S012 will be switched to weeks. Also, as I've wrote earlier, such a change deletes all the data from S012 and you have to rebuild the statistical data in S012 after the change. That's the option you have in standard.
The only way I see, to implement your requirement without touching S012 is to use "ad hoc evaluation" option of MCEC:
If that is activated, then MCEC doesn't read data from S012, but it reads planning data directly with the SCENARIO_DATA_FOR_S012 function module, but it still uses the period unit as defined in OMO2 for S012. You could modify the function and calculate week number instead. The modification should be implemented in the FILL_S012 routine. The period unit is calculated by calling the PERIODE_ERMITTELN(RMCS1000) routine:
* get currency for value
PERFORM HWAER_READ USING NO_EKORG PLAF-PLWRK
CHANGING WAEHR.
ENDIF.
*
PERFORM PERIODE_ERMITTELN(RMCS1000) USING
PLAF-PEDTR
INFO_STRUCTURE "='S012'
DUMMY_BUKRS
CHANGING
*S012-SPTAG
*S012-SPWOC
*S012-SPMON
*S012-SPBUP
*S012-PERIV.
* currency conversion
IF *S012-NETWR <> 0 AND *S012-HWAER <> WAEHR.<br>
You could replace the call to PERIODE_ERMITTELN(RMCS1000) with your own logic to calculate week number. The implementation should be like:
if sy-tcode = 'MCEC'.
CALL FUNCTION 'DATE_GET_WEEK'
EXPORTING
date = plaf-pedtr
IMPORTING
week = *s012-spwoc
EXCEPTIONS
date_invalid = 01.
else.
PERFORM PERIODE_ERMITTELN(RMCS1000) USING
PLAF-PEDTR
INFO_STRUCTURE "='S012'
DUMMY_BUKRS
CHANGING
*S012-SPTAG
*S012-SPWOC
*S012-SPMON
*S012-SPBUP
*S012-PERIV.
endif.
I've not tested the implementation. It's only to give you a guidance and a rough idea of how to do it.
Best regards
Dominik Tylczynski
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
39 | |
8 | |
6 | |
3 | |
3 | |
3 | |
3 | |
2 | |
2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.