Sei sulla pagina 1di 5

Real time Characteristic Value Combination (APO DP)

Validation with ECC


March 27, 2012 | 613 Views |

Pankaj Singh
more by this author
SAP Advanced Planning and Optimization
characteristic value combinationcvcsap advanced planning & optimization

share 0

share 0

tweet

share 0

Follow
A. What is CVC?
CVC, Characteristic Value Combination is a master data of APO Demand Planning. It is
group of characteristic values (hence known as combination) which is used in
forecasting process. In CVC, we define, with what characteristics (values) forecasting
can be done. To learn more about CVC please check http://goo.gl/qjkwB
B. Steps to create CVC
CVCs can be created in transaction /n/SAPAPO/MC62 using following different options:-

Create Single Characteristic Combination

Create Characteristic Combination > Create Manually

Create Characteristic Combination > Load to Worklist w/ data source Planning


object Structure

Create Characteristic Combination > Load to Worklist w/ data source


InfoProvider

Create Characteristic Combination > Load to Worklist w/ data source File

Create Characteristic Combination > Load to Worklist w/ data source Business


Add-In

Create Characteristic Combination > Generate Immediately w/ data source


Planning object Structure
Create Characteristic Combination > Generate Immediately w/ data source
InfoProvider

Create Characteristic Combination > Generate Immediately w/ data source File

Create Characteristic Combination > Generate Immediately w/ data source


Business Add-In

Create Characteristic Combination > Generate in Background w/ data source


Planning object Structure

Create Characteristic Combination > Generate in Background w/ data source


InfoProvider

Create Characteristic Combination > Generate in Background w/ data source File

Create Characteristic Combination > Generate in Background w/ data source


Business Add-In

C. Problem faced by our client?

APO Demand Planning will not worry about the real integration with ECC. So
irrespective of whether CVC value is valid or invalid, it will anyway create CVC
combination. Our client wanted to do real time check with R/3 and that CVC
should be created only if valid characteristic values are used to create CVCs.

Also, this check should be done irrespective of the method used for creating CVC.

D. What options we tried

Whenever it comes to CVC validation, BAdi /SAPAPO/SDP_MASTER Method


CHECK_MANUAL_INPUT is the first option which comes to mind. But the issue with
this option was that this method was getting called only for Create Single
Characteristic Combination method of creating CVC. So we had to rule this
out.

Next after some analysis, we thought creating an implicit enhancement at start


of class method /SAPAPO/CL_SCMB_PSTRU_PLOB=>CREATE_PLOBS may be
helpful. After some debugging we were able to confirm that this point gets called
in all the methods of creating CVC and thus may be best point to add validation.
But later we found that, class didnt allow CVC table parameter to be modified.
Hence we were not able to remove invalid CVC combination from CVC internal
table to prevent it from creation. Hence even this option was out.

E. Final solution!!
Some more (actually lot more) analysis and debugging took us back to BAdi
/SAPAPO/SDP_MASTER but this time method COMBI_ENRICH. Documentation of this BAdi
method suggests that this can be use to enhance CVC values just before creation. So
this is the place where we can modify CVC values as required. This method also gets
called in all the above ways of creating CVCs. Thus we decided to use BAdi
/SAPAPO/SDP_MASTER~COMBI_ENRICH. Technical pseudo logic is discussed in section
below and gives clear picture on how we used this BAdi method for our validation
scenario.
F. Technical Pseudo Logic

1. Create implementation for BAdi /SAPAPO/SDP_MASTER method COMBI_ENRICH.

2. To log error message for invalid CVC to application log, we will need application
log handle. When control comes to this point use function module
/SAPAPO/TS_GENER_CODING by passing planning object and program class
PSTRU_PLOB_CREATE to get internal generated program name for respective
planning object. Variable (Generated program name)GV_LOGHANDLE from ABAP
memory will give handle of application log currently being used.

3. All CVCs are available in table parameter CT_PLOB_VALUES_TAB of this Badi


method. Pass this CVC to RFC function module in R/3 for real time validation and
get back the error message.

4. If error message is returned for respective CVC, log this error message in
application log using handle reteived from ABAP memory, as explained in point 2
above. Also delete respective CVCs from table parameter CT_PLOB_VALUES_TAB
so that same is not created.

5. From performance point of view, it is advisable to pass all CVCs in single RFC call
to R/3, get the validation done there and let error message be send back to APO.

6. We also store the CVC context when logging error message to application log.
This helps in understanding which CVC lead to respective error. Check below
screen shot to get an idea how error message will appear in application log.
G. Conclusion
I hope this helps anyone who have similar requirement on CVCs validation with ECC.
Alert Moderator
5 Comments
Hi Pankaj,

Can you explain the 2nd point To log error message for invalid CVC to application log in
detail? How do we get the application log handle from generated program name?

Thanks in advance.

Madhura

Please use code below:-

*-Get generated program name for planning object

CALL FUNCTION /SAPAPO/TS_GENER_CODING

EXPORTING
i_plobid = iv_bas_plobid

i_progclass = c_pstru_plob_create PSTRU_PLOB_CREATE

IMPORTING

e_gen_repid = gv_gen_prog_name

EXCEPTIONS

generation_failed = 1

OTHERS = 2.

*-Get handle to log :

CONCATENATE ( gv_gen_prog_name )GV_LOGHANDLE INTO lv_handle.

ASSIGN (lv_handle) TO <fs_loghandle>.

In code above, gv_gen_prog_name will be some internal generated report id like


GP4NT2JPHDRSPH7AI0X9ZYCVY3A and GV_LOGHANDLE is a variable available in global
memory.

Potrebbero piacerti anche