on 2004 Mar 01 7:28 AM
Hi,
We have some complex requirement to calculate an item price based on some components of cost calculation and markup. That varies based on some criteria. We have to use a pricing formula exit to provide such indirect functionality.
Cost is provided in a condition say EK01. In va01, after costing an item cost in being saved in buffer. It is not going to be saved in tables KEKO & KEPH unless you save the order. My question is:
- How to read cost from buffer? or
- is there any function module that i can provide the item detail and it returns back cost components?
Any help is appreciated...
Thanks in advance,
Hi,
I add some code that I used to get the data from cost calculation. The code contains function modules and the import statement to get the data from memory or datebase.
Einzelkalkulation der Hauptposition lesen
CALL FUNCTION 'K_UNITCOSTING_MEMORY_ADRESS'
EXPORTING
lednr_imp = '00'
bzobj_imp = '4'
kalnr_imp = xvbap-kalnr
kalka_imp = '15'
kadky_imp = '00000000'
tvers_imp = '01'
bwvar_imp = ' '
kkzma_imp = ' '
IMPORTING
memory_adress_exp = ik_memadress
EXCEPTIONS
OTHERS = 1.
CHECK sy-subrc = 0.
CALL FUNCTION 'K_UNITCOSTING_LOCATION_DETECT'
EXPORTING
key_fully_qualified_imp = 'X'
bzobj_imp = '4'
kalnr_imp = xvbap-kalnr
kalka_imp = '15'
kadky_imp = '00000000'
tvers_imp = '01'
bwvar_imp = ' '
kkzma_imp = ' '
IMPORTING
costing_in_memory_exp = ik_mem
costing_on_database_exp = ik_db
memory_adress_exp = ik_memadress
EXCEPTIONS
klvar_not_defined = 1
OTHERS = 2.
CHECK sy-subrc = 0.
Einzelkalkulation aus Memory übernehmen
IF ik_mem = 'X'.
IMPORT sav_khs1 TO ik_khs1
t_sav_kis1 TO ik_kis1
t_sav_ckip TO ik_ckip
FROM MEMORY ID ik_memadress.
IF sy-subrc NE 0.
MESSAGE e015 RAISING import_failed.
ENDIF.
Einzelkalkulation von Datenbank lesen
ELSEIF ik_db = 'X'.
CALL FUNCTION 'K_UNITCOSTING_READ'
EXPORTING
fel_bwvar = ' '
fel_bzobj = '4'
fel_kadky = '00000000'
fel_kalka = '15'
fel_kalnr = xvbap-kalnr
fel_kkzma = ' '
fel_lednr = '00'
fel_spras = sy-langu
fel_tvers = '01'
IMPORTING
fel_khs1 = ik_khs1
TABLES
fel_tab_ckit = ik_ckit
fel_tab_kis1 = ik_kis1
EXCEPTIONS
fel_not_found = 1
OTHERS = 2.
Einzelkalkualtion ist noch nicht angelegt
ELSEIF ik_mem IS INITIAL AND
ik_db IS INITIAL.
CONTINUE.
ENDIF.
Steuerdaten aus Customizing für Einzelkalkulation
CALL FUNCTION 'KKEK_TCK_TABLES_READ'
EXPORTING
klvar_imp = ik_khs1-kkart
werks_imp = xvbap-werks
flg_set_klvar_for_valuation = '1'
IMPORTING
tck01_exp = w_tck01
tck03_exp = w_tck03
tck04_exp = w_tck04
tck05_exp = w_tck05
tck22_exp = w_tck22
tck23_exp = w_tck23
EXCEPTIONS
record_not_found_tck01 = 08
record_not_found_tck03 = 10
record_not_found_tck05 = 12
record_not_found_tck22 = 14
OTHERS = 0.
*
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
71 | |
10 | |
8 | |
7 | |
7 | |
6 | |
6 | |
6 | |
6 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.