start routine

Download Start Routine

If you can't read please download the document

Upload: biswabrata-das

Post on 22-Dec-2015

215 views

Category:

Documents


0 download

DESCRIPTION

start routine

TRANSCRIPT

PROGRAM trans_routine.*---------------------------------------------------------------------** CLASS routine DEFINITION*---------------------------------------------------------------------***---------------------------------------------------------------------*CLASS lcl_transform DEFINITION. PUBLIC SECTION.* Attributs DATA: p_check_master_data_exist TYPE RSODSOCHECKONLY READ-ONLY,*- Instance for getting request runtime attributs;* Available information: Refer to methods of* interface 'if_rsbk_request_admintab_view' p_r_request TYPE REF TO if_rsbk_request_admintab_view READ-ONLY. PRIVATE SECTION. TYPE-POOLS: rsd, rstr.* Rule specific types TYPES: BEGIN OF _ty_s_SC_1,* InfoObject: ZREQNUM Requistion Number. /BIC/ZREQNUM TYPE /BIC/OIZREQNUM,* InfoObject: ZREQITM Requisition Item Number. /BIC/ZREQITM TYPE /BIC/OIZREQITM,* InfoObject: ZREQUPQTY UnContracted Planned Pur. Qty. /BIC/ZREQUPQTY TYPE /BIC/OIZREQUPQTY,* InfoObject: ZCPLN_PRC Contracted Planned Purch.Price. /BIC/ZCPLN_PRC TYPE /BIC/OIZCPLN_PRC,* InfoObject: ZTOTPRCUR Contract Total Price Currency. /BIC/ZTOTPRCUR TYPE /BIC/OIZTOTPRCUR,* InfoObject: ZREQPQTY Contracted Planned Pur. Qty. /BIC/ZREQPQTY TYPE /BIC/OIZREQPQTY,* InfoObject: 0BASE_UOM Base Unit of Measure. BASE_UOM TYPE /BI0/OIBASE_UOM,* InfoObject: 0MATERIAL Material. MATERIAL TYPE /BI0/OIMATERIAL,* InfoObject: 0SCL_DELDAT Planned delivery date of document schedul*e line. SCL_DELDAT TYPE /BI0/OISCL_DELDAT,* InfoObject: 0PLANT Plant. PLANT TYPE /BI0/OIPLANT,* InfoObject: 0CONTRACT Number of Principal Purchase Agreement. CONTRACT TYPE /BI0/OICONTRACT,* InfoObject: 0RECORDMODE BW Delta Process: Update Mode. RECORDMODE TYPE RODMUPDMOD,* Field: RECORD. RECORD TYPE RSARECORD, END OF _ty_s_SC_1. TYPES: _ty_t_SC_1 TYPE STANDARD TABLE OF _ty_s_SC_1 WITH NON-UNIQUE DEFAULT KEY.*$*$ 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 start_routine IMPORTING request type rsrequest datapackid type rsdatapid EXPORTING monitor type rstr_ty_t_monitors CHANGING SOURCE_PACKAGE type _ty_t_SC_1 RAISING cx_rsrout_abort. METHODS inverse_start_routine 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 start_routine*----------------------------------------------------------------------** Calculation of source package via start routine*----------------------------------------------------------------------** source package*----------------------------------------------------------------------* METHOD start_routine.*=== Segments === FIELD-SYMBOLS: TYPE _ty_s_SC_1. DATA: MONITOR_REC TYPE rstmonitor.*$*$ 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.* ---------------------------------------------------------------------** TYPE : Start Routine - ZPUR_O06 -> ZPUR_C01 ** TWB : BWBC-020 ** ** 13/07/2008 SReddy Parms#45344 ** ? **----------------------------------------------------------------------** Structures DATA: BEGIN OF i_s_pur, doc_num TYPE /bic/azpur_o0200-doc_num, doc_item TYPE /bic/azpur_o0200-doc_item, material TYPE /bic/azpur_o0200-material, val_end TYPE /bic/azpur_o0200-val_end, val_start TYPE /bic/azpur_o0200-val_start, /bic/ztotpr TYPE /bic/azpur_o0200-/bic/ztotpr, END OF i_s_pur. DATA: i_t_pur LIKE TABLE OF i_s_pur.* Variables DATA : e_s_result TYPE _ty_s_sc_1. DATA : e_i_result TYPE _ty_s_sc_1. DATA : e_r_result TYPE _ty_t_sc_1. DATA : e_t_result TYPE _ty_t_sc_1. DATA : f_year TYPE /bi0/oifiscyear. DATA : f_period TYPE /bi0/oifiscper3. DATA : fy_period TYPE /bi0/oifiscper. DATA : no_revenue TYPE /bi0/oig_aerlos. DATA : revenue TYPE /bi0/oig_aerlos. DATA : pre_fyperiod TYPE /bi0/oifiscper. DATA : i TYPE i VALUE 1.* Read DSO ZPUR_O02 READ TABLE i_t_pur INDEX 1 TRANSPORTING NO FIELDS. IF sy-subrc = 4. SELECT doc_num doc_item material val_end val_start /bic/ztotpr FROM /bic/azpur_o0200 INTO CORRESPONDING FIELDS OF TABLE i_t_pur WHERE /bic/ztotpr NE ''. IF sy-subrc = 4. RAISE EXCEPTION TYPE CX_RSROUT_ABORT. ENDIF. SORT i_t_pur BY material. ENDIF.* Loop over the data package LOOP AT SOURCE_PACKAGE INTO e_s_result.* Look for ? READ TABLE i_t_pur INTO i_s_pur WITH KEY material = e_s_result-material doc_num = e_s_result-contract BINARY SEARCH. IF sy-subrc 0. APPEND e_s_result TO e_t_result. ELSE. e_s_result-/bic/zcpln_prc = e_s_result-/bic/zreqpqty * i_s_pur-/bic/ztotpr. APPEND e_s_result TO e_t_result. ENDIF. ENDLOOP.* Save result REFRESH SOURCE_PACKAGE. MOVE e_t_result[] TO SOURCE_PACKAGE.* ... "to cancel the update process* raise exception type CX_RSROUT_ABORT.*$*$ end of routine - insert your code only before this line *-* ENDMETHOD. "start_routine*----------------------------------------------------------------------** Method inverse_start_routine*----------------------------------------------------------------------*** 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 inverse_start_routine.*$*$ 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. "inverse_start_routineENDCLASS. "routine IMPLEMENTATION