Anda di halaman 1dari 3

PROGRAM trans_routine. *---------------------------------------------------------------------* * CLASS routine DEFINITION *---------------------------------------------------------------------* * *---------------------------------------------------------------------* CLASS lcl_transform DEFINITION. PUBLIC SECTION.

TYPES: BEGIN OF _ty_s_SC_1, InfoObject: 0STOCKTYPE Stock type. STOCKTYPE TYPE /BI0/OISTOCKTYPE, InfoObject: 0STOCKCAT Stock Categories. STOCKCAT TYPE /BI0/OISTOCKCAT, InfoObject: 0BWAPPLNM Application component. BWAPPLNM TYPE /BI0/OIBWAPPLNM, InfoObject: 0STOCKRELEV BW: Relevance to Stock. STOCKRELEV TYPE /BI0/OISTOCKRELEV, InfoObject: 0CPQUABU BW: Amount in base unit of measure. CPQUABU TYPE /BI0/OICPQUABU, InfoObject: 0PROCESSKEY BW: Transaction Key. PROCESSKEY TYPE /BI0/OIPROCESSKEY, InfoObject: 0BASE_UOM Base Unit of Measure. BASE_UOM TYPE /BI0/OIBASE_UOM, InfoObject: 0INDSPECSTK Indicator: Valuation of Special Stock. INDSPECSTK TYPE /BI0/OIINDSPECSTK, END OF _ty_s_SC_1. TYPES: BEGIN OF _ty_s_TG_1, InfoObject: 0RECVALSTCK Quantity Received into Valuated Stock. RECVALSTCK TYPE /BI0/OIRECVALSTCK, END OF _ty_s_TG_1. PRIVATE SECTION. TYPE-POOLS: rsd, rstr. *$*$ begin of global - insert your declaration only below this line *-* ... "insert your code here *$*$ end of global - insert your declaration only before this line *-* METHODS compute_0RECVALSTCK IMPORTING request datapackid SOURCE_FIELDS EXPORTING RESULT monitor RAISING cx_rsrout_abort cx_rsrout_skip_record cx_rsrout_skip_val. METHODS invert_0RECVALSTCK

* * * * * * * *

type rsrequest type rsdatapid type _ty_s_SC_1 type _ty_s_TG_1-RECVALSTCK type rstr_ty_t_monitor

IMPORTING i_th_fields_outbound TYPE rstran_t_field_inv i_r_selset_outbound TYPE REF TO cl_rsmds_set i_is_main_selection TYPE rs_bool i_r_selset_outbound_complete TYPE REF TO cl_rsmds_set i_r_universe_inbound TYPE REF TO cl_rsmds_universe CHANGING c_th_fields_inbound TYPE rstran_t_field_inv c_r_selset_inbound TYPE REF TO cl_rsmds_set c_exact TYPE rs_bool. ENDCLASS. "routine DEFINITION *$*$ begin of 2nd part global - insert your code only below this line * ... "insert your code here *$*$ end of 2nd part global - insert your code only before this line * *---------------------------------------------------------------------* * CLASS routine IMPLEMENTATION *---------------------------------------------------------------------* * *---------------------------------------------------------------------* CLASS lcl_transform IMPLEMENTATION. METHOD compute_0RECVALSTCK. * * * * * * * * * * * * * IMPORTING request type rsrequest datapackid type rsdatapid SOURCE_FIELDS-STOCKTYPE TYPE /BI0/OISTOCKTYPE SOURCE_FIELDS-STOCKCAT TYPE /BI0/OISTOCKCAT SOURCE_FIELDS-BWAPPLNM TYPE /BI0/OIBWAPPLNM SOURCE_FIELDS-STOCKRELEV TYPE /BI0/OISTOCKRELEV SOURCE_FIELDS-CPQUABU TYPE /BI0/OICPQUABU SOURCE_FIELDS-PROCESSKEY TYPE /BI0/OIPROCESSKEY SOURCE_FIELDS-BASE_UOM TYPE /BI0/OIBASE_UOM SOURCE_FIELDS-INDSPECSTK TYPE /BI0/OIINDSPECSTK EXPORTING RESULT type _ty_s_TG_1-RECVALSTCK DATA: MONITOR_REC TYPE rsmonitor. *-*

*$*$ begin of routine - insert your code only below this line ... "insert your code here *-- fill table "MONITOR" with values of structure "MONITOR_REC" *- to make monitor entries ... "to cancel the update process * raise exception type CX_RSROUT_ABORT. ... "to skip a record * raise exception type CX_RSROUT_SKIP_RECORD. ... "to clear target fields * raise exception type CX_RSROUT_SKIP_VAL. IF OR OR OR OR OR AND * only

( SOURCE_FIELDS-processkey EQ '000' "Other Receipts SOURCE_FIELDS-processkey EQ '001' "Goods Receipt / Vendor SOURCE_FIELDS-processkey EQ '004' "Material Transfer / Receipt SOURCE_FIELDS-processkey EQ '005' "Stock Adjustment InvD SOURCE_FIELDS-processkey EQ '006' "Stock Adjustment Other SOURCE_FIELDS-processkey EQ '010' ) "Receipt from Stock Transfer SOURCE_FIELDS-bwapplnm EQ 'MM' movements which are relevant for stock control

* additional check if orders on hand or projekt stock * and if they are valuated (A or M) AND SOURCE_FIELDS-stockrelev EQ '1' AND SOURCE_FIELDS-cpquabu <> 0 AND ( SOURCE_FIELDS-stockcat IS INITIAL OR ( SOURCE_FIELDS-stockcat CA 'EQ' AND SOURCE_FIELDS-indspecstk CA 'AM' ) ). RESULT = SOURCE_FIELDS-cpquabu. * if the returncode is zero, the result will be updated ELSE. * if the returncode is not equal zero, the result will not be updated ENDIF. *$*$ end of routine - insert your code only before this line *-* ENDMETHOD. "compute_0RECVALSTCK *----------------------------------------------------------------------* * Method invert_0RECVALSTCK *----------------------------------------------------------------------* * * This subroutine needs to be implemented only for direct access * (for better performance) and for the Report/Report Interface * (drill through). * The inverse routine should transform a projection and * a selection for the target to a projection and a selection * for the source, respectively. * If the implementation remains empty all fields are filled and * all values are selected. * *----------------------------------------------------------------------* * *----------------------------------------------------------------------* METHOD invert_0RECVALSTCK. *$*$ begin of inverse routine - insert your code only below this line*-* ... "insert your code here *$*$ end of inverse routine - insert your code only before this line *-* ENDMETHOD. ENDCLASS. "invert_0RECVALSTCK "routine IMPLEMENTATION

Anda mungkin juga menyukai