☛SAP_BW (Software Component) SAP Business Warehouse ⤷BW-PLA-BPS (Application Component) Business Planning and Simulation ⤷UPC (Package) SEM-BPS: General Functions
The Exit function module offers the possibility to realize functions for derivation, which are not intended in the standard. The function module for initialization has the following parameters:
I_AREA = the planning area (type UPC_Y_AREA ).
ITO_CHA = the characteristics of planning level (type UPC_YTO_CHA ). These characteristics cannot be changed.
ITO_SOURCE = the source characteristics of the step (type UPC_YTO_CHA ).
ITO_TARGET = the target characteristics of the step (type UPC_YTO_CHA ). These characteristics should be derived in the step.
XS_CHAS = the characteristic combination, which should be changed.
FAILED = exception, which is triggered, if the derivation goes wrong.
The following example shows how the fiscal year and posting period are derived from the 7 character period and the other way round:
function z_derive_time_chas. *"---------------------------------------------------------------------- *"*"Local interface: *" IMPORTING *" REFERENCE(I_AREA) TYPE UPC_Y_AREA *" REFERENCE(ITO_CHA) TYPE UPC_YTO_CHA *" REFERENCE(ITO_SOURCE) TYPE UPC_YTO_CHA *" REFERENCE(ITO_TARGET) TYPE UPC_YTO_CHA *" CHANGING *" REFERENCE(XS_CHAS) TYPE ANY *" EXCEPTIONS *" FAILED *"---------------------------------------------------------------------- DATA: l_gjahr(4) TYPE n, l_perde(3) TYPE n, l_fiscper(7) TYPE n.
FIELD-SYMBOLS: <fiscper>, <fiscyear>, <fiscper3>.
ASSIGN COMPONENT '0FISCPER' OF STRUCTURE xs_chas TO <fiscper>. ASSIGN COMPONENT '0FISCYEAR' OF STRUCTURE xs_chas TO <fiscyear>. ASSIGN COMPONENT '0FISCPER3' OF STRUCTURE xs_chas TO <fiscper3>. READ TABLE ito_cha TRANSPORTING NO FIELDS WITH KEY chanm = '0FISCPER'. IF sy-subrc = 0. * The 7 character period is in the level l_fiscper = <fiscper>. READ TABLE ito_cha TRANSPORTING NO FIELDS WITH KEY chanm = '0FISCYEAR'. IF sy-subrc <> 0. l_gjahr = l_fiscper(4). <fiscyear> = l_gjahr. ENDIF. READ TABLE ito_cha TRANSPORTING NO FIELDS WITH KEY chanm = '0FISCPER3'. IF sy-subrc <> 0. l_perde = l_fiscper+4(3). <fiscper3> = l_perde. ENDIF. ELSE. * The 7 character period is not in the level READ TABLE ito_cha TRANSPORTING NO FIELDS WITH KEY chanm = '0FISCYEAR'. IF sy-subrc = 0. l_gjahr = <fiscyear>. READ TABLE ito_cha TRANSPORTING NO FIELDS WITH KEY chanm = '0FISCPER3'. IF sy-subrc = 0. l_perde = <fiscper3>. l_fiscper(4) = l_gjahr. l_fiscper+4(3) = l_perde. <fiscper> = l_fiscper. ENDIF. ENDIF. ENDIF. ENDFUNCTION.