Administration > Setup > Precalculation > Calculation schema > Calculation objects > Scripting > Scripting Post calculation - robinfeng/beashelp GitHub Wiki
Per calculation object the script is executed four times. In variable <sum.typ> is is stored, which value is calculated currently mc.plan Planned costs at marginal costs mc.actual Current costs at marginal costs fc.plan Planned costs at full costs fc.actual Current costs at full costs
The following variables are available sum.typ What is calculated (see above) sum.material Material costs without surcharges, without external operations sum.labor L+M costs sum.manufacturing Cost of external operation sum.production Production costs - including all surcharges until this calculation object sum.quantity At mc.typ = mc.plan or fc.plan the planned quantity, otherwise the current quantity At projections always the projection quantity
You can set the following values cost Surcharge costs - separately for the currently calculated value (see sum.typ) description Description - transferred from the latest set value
Available basis variables Note: It is not mandatory to set these variables. If empty, default values are used. e_von Valuation considered from date e_bis Valuation considered to date e_batch J = Batch-calculation - no output on screen e_schema_id Default - Calculation schema, if empty, automatic determination e_postcalcquantity set only in case of single step calculation: Conversion to the defined quantity independent from planned or reported quantity e_receiptquantity Is set, if the calculation is called up at posting in goods. The quantity to post in is entered e_postcalcorder Determines, whether purchase orders for external operations are to be considered. True or J = consider, false or N = not to consider e_costrate Alternative resource cost rates e_onelevel Determines the extended pricing of storage related sub-assemblies in post-calculations (setup: onelevelcalc) S=Standard, V=determine prices from last pre-calculation str_parm.belnr_id Document number (BEAS_FTHAUPT.BELNR_ID) str_parm.belpos_id Document position (BEAS_FTPOS.BELPOS_ID) If 0, all document positions
Furthermore, you can access all values of dw_1. Note: For calculations running in the background ( for example, when posting in an assembly) not all fields are filled.
hmtoggle_plus1 Example
// Get Information from Item Master data and calculate this with udf1 from first resource // // Get information from item select "NumInSale","SWW" into :ll_numinsale,:ls_meterprobox from "OITM" where "ItemCode" = <dw_1.item.itemcode:1.value,dbstring>
// search for first labor position dw_1.find=art=52 setvar=ll_row= if <ll_row> n= 0 then return success end if // get udf1 from resource select UDF1 into :ls_meterpreis from BEAS_APLATZ where APLATZ_ID=<item.aplatz_id:[ll_row].value,dbstring> if <ls_meterpreis,#0.000000> n= 0 then setvar=ls_meterpreis=1 end if // udf1 is a text field. Replace comma with dot tools=globalreplace=ls_meterprobox=,=. // current calc quantity lc_qty=<sum.quantity,#0.000000> // check null if <lc_qty> n= 0 then setvar=lc_qty=0 end if // calculate and write back to variable cost (see "into cost" select <ls_meterprobox,num(6)> * <ll_numinsale,num(6)> * <ls_meterpreis,num(6)> * <lc_qty,num(6)> into cost from BEAS_DUMMY
(beas9.1-004-064-000)
返回 主页