Anda di halaman 1dari 7

EG OF A START ROUTINE

PROGRAM trans_routine.

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

TYPES:
BEGIN OF _ty_s_SC_1,
* Field: PSPNR WBS Element.
PSPNR TYPE N LENGTH 8,
* Field: PSPHI Current proj no.
PSPHI TYPE N LENGTH 8,
* Field: BANFN Purchase Req..
BANFN TYPE C LENGTH 10,
* Field: BNFPO Requisn Item.
BNFPO TYPE N LENGTH 5,
* Field: FRGDT Release Date.
FRGDT TYPE D,
* Field: MENGE Quantity.
MENGE TYPE P LENGTH 7 DECIMALS 3,
* Field: MEINS Unit of Measure.
MEINS TYPE C LENGTH 3,
* Field: EBELN Purchase Order.
EBELN TYPE C LENGTH 10,
* Field: BEDAT PO Date.
BEDAT TYPE D,
* Field: BSMNG PO Quantity.
BSMNG TYPE P LENGTH 7 DECIMALS 3,
* Field: WERKS Plant.
WERKS TYPE C LENGTH 4,
* Field: MATNR Material.
MATNR TYPE C LENGTH 18,
* Field: TEXT Short Text.
TEXT TYPE C LENGTH 40,
* Field: RECORD Record Number.
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.
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
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> 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.

*$*$ 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_routine
ENDCLASS. "routine IMPLEMENTATION

EG OF AN END ROUTINE

PROGRAM trans_routine.

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

TYPES:
BEGIN OF _ty_s_TG_1,
* InfoObject: ZPOPR popr details.
/BIC/ZPOPR TYPE /BIC/OIZPOPR,
* InfoObject: PSPHI Current number of the appropriate project.
/BIC/PSPHI TYPE /BIC/OIPSPHI,
* InfoObject: BANFN Purchase Requisition Number.
/BIC/BANFN TYPE /BIC/OIBANFN,
* InfoObject: BNFPO Item Number of Purchase Requisition.
/BIC/BNFPO TYPE /BIC/OIBNFPO,
* InfoObject: FRGDT Purchase Requisition Release Date.
/BIC/FRGDT TYPE /BIC/OIFRGDT,
* InfoObject: EBELN Purchase Order No.
/BIC/EBELN TYPE /BIC/OIEBELN,
* InfoObject: BEDAT Purchase Order Date.
/BIC/BEDAT TYPE /BIC/OIBEDAT,
* InfoObject: WERKS WERKS.
/BIC/WERKS TYPE /BIC/OIWERKS,
* Field: RECORD.
RECORD TYPE RSARECORD,
END OF _ty_s_TG_1.
TYPES:
_ty_t_TG_1 TYPE STANDARD TABLE OF _ty_s_TG_1
WITH NON-UNIQUE DEFAULT KEY.
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
end_routine
IMPORTING
request type rsrequest
datapackid type rsdatapid
EXPORTING
monitor type rstr_ty_t_monitors
CHANGING
RESULT_PACKAGE type _ty_t_TG_1
RAISING
cx_rsrout_abort.
METHODS
inverse_end_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 end_routine
*----------------------------------------------------------------------*
* Calculation of result package via end routine
* Note: All not overwritten field values within the routine
* are transferred from the corresponding source fields. This
* means, all fields not supplied by the transformation source
* are send with initial values to the transformation target.
*----------------------------------------------------------------------*
* <-> result package
*----------------------------------------------------------------------*
METHOD end_routine.
*=== Segments ===

FIELD-SYMBOLS:
<RESULT_FIELDS> TYPE _ty_s_TG_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.

*$*$ end of routine - insert your code only before this line *-*
ENDMETHOD. "end_routine
*----------------------------------------------------------------------*
* Method inverse_end_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_end_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_end_routine
ENDCLASS. "routine IMPLEMENTATION

EG OF KEY FIG CHAR ROUTINE

PROGRAM trans_routine.

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

TYPES:
BEGIN OF _ty_s_SC_1,
* Field: PSPHI Current proj no.
PSPHI TYPE N LENGTH 8,
* Field: BANFN Purchase Req..
BANFN TYPE C LENGTH 10,
* Field: BNFPO Requisn Item.
BNFPO TYPE N LENGTH 5,
END OF _ty_s_SC_1.
TYPES:
BEGIN OF _ty_s_TG_1,
* InfoObject: ZPOPR popr details.
/BIC/ZPOPR TYPE /BIC/OIZPOPR,
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_ZPOPR
IMPORTING
request type rsrequest
datapackid type rsdatapid
SOURCE_FIELDS type _ty_s_SC_1
EXPORTING
RESULT type _ty_s_TG_1-/BIC/ZPOPR
monitor type rstr_ty_t_monitor
RAISING
cx_rsrout_abort
cx_rsrout_skip_record
cx_rsrout_skip_val.
METHODS
invert_ZPOPR
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_ZPOPR.

* IMPORTING
* request type rsrequest
* datapackid type rsdatapid
* SOURCE_FIELDS-PSPHI TYPE N LENGTH 000008
* SOURCE_FIELDS-BANFN TYPE C LENGTH 000010
* SOURCE_FIELDS-BNFPO TYPE N LENGTH 000005
* EXPORTING
* RESULT type _ty_s_TG_1-/BIC/ZPOPR

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.

RESULT = .

*$*$ end of routine - insert your code only before this line *-*
ENDMETHOD. "compute_ZPOPR
*----------------------------------------------------------------------*
* Method invert_ZPOPR
*----------------------------------------------------------------------*
*
* 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_ZPOPR.

*$*$ 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. "invert_ZPOPR
ENDCLASS. "routine IMPLEMENTATION