Skip to Content
0
Former Member
May 31, 2007 at 06:13 AM

Pls correct this code

29 Views

Hi Friends,

How are you all doing??

Is there any Function Module or BAPI or Method available for revaluating CCR(Central Cost Registration) in Easy Cost Planning transaction (CJ20N/CJ9ECP).

I am trying to use this Function Module 'CK_ECP_CHANGE_WITHOUT_DIALOG' hoping it does job. If not pls provide the correct one which revaluates unit cost in ECP transaction.

The code which i written to test Function Module 'CK_ECP_CHANGE_WITHOUT_DIALOG' is below giving some problem.

Can you correct this code. It is giving short dump saying 'COSTING_DATA_NOT_FOUND'. Is this due to the data not found for one of the parameter 'im_object_key' inside methods referring to structure cktc_kalnr_key which need to provide data from table cktc_kalnr. If so there is no entries in table cktc_kalnr and can any provide sample data for this table.

( CALL METHOD lr_ce_hierarchy->create_cost_estimates.

CALL METHOD lr_ce_hierarchy->get_cost_estimate_list

IMPORTING

ex_cost_estimates = lt_cost_estimate.)

Pls try to solve this problem friends.

Thanks and regards,

Chitupolu Srikanth,

chitupolusrikanth@gmail.com

chitupolusrikanth@yahoo.com

Mobile : 9910608696

*()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()

type-pools : KEIY,

KEIW.

DATA:

L_i_description_cp TYPE CK_ADHOC_EXTTX,

**************************************************

L_costing_variant type CK_KLVAR,

L_object_of_costing type ref to IF_OBJECT_OF_COSTING,

lr_cp TYPE REF TO cl_wrap_gen_cp_ck.

DATA: lr_ce_hierarchy TYPE REF TO cl_ce_hierarchy_ck,

lt_cost_estimate type ckf_t_cost_estimate,

lt_msg type ckf_error_message_table,

ls_msg type ckf_error_message,

ls_ecpdata type keiy_ts_ecpdata,

it_ecpdata type hashed table of keiy_ts_ecpdata with unique key objnr del_old_items,

mc_off type c,

ls_calculation TYPE keiw_ts_calculation,

temp_CE_NODE_CK type ref to CL_CE_NODE_CK,

lr_cost_estimate like line of lt_cost_estimate,

ls_mesg TYPE keiy_ts_mesg,

et_mesg TYPE standard table of keiy_ts_mesg.

L_costing_variant = WS_PRPS-KLVAR.

L_i_description_cp = WS_PRPS-POSKI.

ls_ecpdata-objnr = 'PR00000199'.

ls_ecpdata-del_old_items = 'X'.

*append ls_ecpdata to it_ecpdata key objnr del_old_items.

CREATE OBJECT lr_cp

EXPORTING

i_kokrs = WS_PRPS-PKOKR

i_bukrs = WS_PRPS-PBUKR

i_werks = WS_PRPS-WERKS

i_prctr = WS_PRPS-PRCTR

I_GSBER = WS_PRPS-PGSBR

I_KALSM = WS_PRPS-KALSM

I_ZSCHL = WS_PRPS-ZSCHL

I_KALNR = WS_PRPS-KALNR

i_klvar = WS_PRPS-KLVAR

I_OBJNR = WS_PRPS-OBJNR

i_date_of_rates = WS_CKHS-KRSDT

i_valuation_date = WS_KEKO-BWDAT

i_date_from = WS_KEKO-KADAM

i_date_to = WS_KEKO-BIDAT

I_REVENUES_ALLOWED = 'X'

i_revenue_det_type = 'R'

i_sd_doc_for_rev = XVBAP-VBELN

i_posnr_sd_doc_for_rev = XVBAP-POSNR

i_execution_profile = '0001'

i_description_cp = L_i_description_cp.

L_object_of_costing = lr_cp.

CREATE OBJECT temp_CE_NODE_CK

EXPORTING

im_object_of_costing = L_object_of_costing.

ls_calculation-node = temp_CE_NODE_CK.

CALL METHOD cl_ce_hierarchy_ck=>create

EXPORTING

im_costing_variant = 'PS06'

im_costing_version = '01'

im_top_object = L_object_of_costing

im_valuation_date = '20070530'

im_date_from = '20070530'

im_date_to = '20070530'

im_ce_allowed = mc_off

im_change_mode = 'X'

IMPORTING

ex_top_node = ls_calculation-node

ex_ce_hierarchy = lr_ce_hierarchy.

  • get all cost estimates

CALL METHOD lr_ce_hierarchy->create_cost_estimates.

CALL METHOD lr_ce_hierarchy->get_cost_estimate_list

IMPORTING

ex_cost_estimates = lt_cost_estimate.

LOOP AT lt_cost_estimate INTO lr_cost_estimate.

  • READ TABLE it_ecpdata INTO ls_ecpdata

  • WITH TABLE KEY objnr =

  • lr_cost_estimate->header-object_number.

IF sy-subrc IS INITIAL.

*call ECP with given data

CALL FUNCTION 'CK_ECP_CHANGE_WITHOUT_DIALOG'

EXPORTING

it_items = ls_ecpdata-items

i_del_old_items = ls_ecpdata-del_old_items

i_modelname = ls_ecpdata-modelname

it_model_chara_value = ls_ecpdata-model_chara_value

i_del_old_model_val = ls_ecpdata-del_old_model_val

ir_ce = l_cl_cOST_ESTIMATE

i_rowtype = ls_ecpdata-rowtype

IMPORTING

et_msg = lt_msg[]

EXCEPTIONS

processing_error = 1

OTHERS = 2.

IF NOT sy-subrc IS INITIAL OR

NOT lt_msg[] IS INITIAL.

  • if there are messages, we will write them to the log

  • and proceed

LOOP AT lt_msg INTO ls_msg.

CLEAR ls_mesg.

ls_mesg-arbgb = ls_msg-msgid.

ls_mesg-msgty = ls_msg-msgty.

ls_mesg-txtnr = ls_msg-msgno.

ls_mesg-msgv1 = ls_msg-msgv1.

ls_mesg-msgv2 = ls_msg-msgv2.

ls_mesg-msgv3 = ls_msg-msgv3.

ls_mesg-msgv4 = ls_msg-msgv4.

APPEND ls_mesg TO et_mesg.

ENDLOOP.

ENDIF.

ENDIF.

ENDLOOP.

*()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()