0% found this document useful (0 votes)
156 views4 pages

Start Routine

This document contains the definition and implementation of a transformation routine class in ABAP. The routine class contains methods for the start routine and inverse start routine. The start routine method loops through the data package, looks up additional data from a source structure, performs calculations, and saves the results back to the data package. The inverse start routine is left empty. Various data structures and variables are declared to support the transformation.

Uploaded by

Biswabrata Das
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
156 views4 pages

Start Routine

This document contains the definition and implementation of a transformation routine class in ABAP. The routine class contains methods for the start routine and inverse start routine. The start routine method loops through the data package, looks up additional data from a source structure, performs calculations, and saves the results back to the data package. The inverse start routine is left empty. Various data structures and variables are declared to support the transformation.

Uploaded by

Biswabrata Das
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 4

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.
*
*
*
*
*
*
*
*
*
*
*e
*
*
*
*

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
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:
<SOURCE_FIELDS>
DATA:
MONITOR_REC

TYPE _ty_s_SC_1.
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
DATA : e_i_result
DATA : e_r_result
DATA : e_t_result
DATA : f_year
DATA : f_period
DATA : fy_period
DATA : no_revenue
DATA : revenue
DATA : pre_fyperiod
DATA : i TYPE i VALUE

TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
1.

_ty_s_sc_1.
_ty_s_sc_1.
_ty_t_sc_1.
_ty_t_sc_1.
/bi0/oifiscyear.
/bi0/oifiscper3.
/bi0/oifiscper.
/bi0/oig_aerlos.
/bi0/oig_aerlos.
/bi0/oifiscper.

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.
ENDCLASS.

"inverse_start_routine
"routine IMPLEMENTATION

You might also like