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: 0BWAPPLNM Componente de aplicação.
BWAPPLNM TYPE /BI0/OIBWAPPLNM,
* InfoObject: 0CPPVLC BW: valor de compra em moeda interna.
CPPVLC TYPE /BI0/OICPPVLC,
* InfoObject: 0PROCESSKEY BW: chave de operação.
PROCESSKEY TYPE /BI0/OIPROCESSKEY,
* InfoObject: 0LOC_CURRCY Local currency.
LOC_CURRCY TYPE /BI0/OILOC_CURRCY,
* Field: RECORD.
RECORD TYPE RSARECORD,
END OF _ty_s_SC_1.
TYPES:
BEGIN OF _ty_s_TG_1,
* InfoObject: 0ISSVS_VAL (1) Valor da saída do estoque avaliado.
ISSVS_VAL TYPE /BI0/OIISSVS_VAL,
END OF _ty_s_TG_1.
*$*$ 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_0ISSVS_VAL
IMPORTING
request type rsrequest
datapackid type rsdatapid
SOURCE_FIELDS type _ty_s_SC_1
EXPORTING
RESULT type _ty_s_TG_1-ISSVS_VAL
monitor type rstr_ty_t_monitor
RAISING
cx_rsrout_abort
cx_rsrout_skip_record
cx_rsrout_skip_val.
METHODS
invert_0ISSVS_VAL
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 *
*$*$ begin of version
*-- migration tool version 19.02.2009
*$*$ end of version
TYPES:
BEGIN OF _ty_s_sc_1_full,
* InfoObject: 0STORNO Stornokennzeichen.
storno TYPE /bi0/oistorno,
* InfoObject: 0RT_PROMO Aktion.
rt_promo TYPE /bi0/oirt_promo,
* InfoObject: 0VAL_CLASS Bewertungsklasse.
val_class TYPE /bi0/oival_class,
* InfoObject: 0DOC_DATE Belegdatum.
doc_date TYPE /bi0/oidoc_date,
* InfoObject: 0COMP_CODE Buchungskreis.
comp_code TYPE /bi0/oicomp_code,
* InfoObject: 0BWAPPLNM Anwendungskomponente.
bwapplnm TYPE /bi0/oibwapplnm,
* InfoObject: 0MOVETYPE Bewegungsart (Bestandsführung).
movetype TYPE /bi0/oimovetype,
* InfoObject: 0CPPVLC BW: Einkaufswert in Hauswährung.
cppvlc TYPE /bi0/oicppvlc,
* InfoObject: 0CPQUABU BW: Menge in Basismengeneinheit.
cpquabu TYPE /bi0/oicpquabu,
* InfoObject: 0PROCESSKEY BW:Vorgangsschlüssel.
processkey TYPE /bi0/oiprocesskey,
* InfoObject: 0FISCYEAR Geschäftsjahr.
fiscyear TYPE /bi0/oifiscyear,
* InfoObject: 0BUS_AREA Geschäftsbereich.
bus_area TYPE /bi0/oibus_area,
* InfoObject: 0SOLD_TO Auftraggeber.
sold_to TYPE /bi0/oisold_to,
* InfoObject: 0DCINDIC Soll-/Haben-Kennzeichen.
dcindic TYPE /bi0/oidcindic,
* InfoObject: 0FISCVARNT Geschäftsjahresvariante.
fiscvarnt TYPE /bi0/oifiscvarnt,
* InfoObject: 0CPNOITEMS BW: Anzahl Vorgänge.
cpnoitems TYPE /bi0/oicpnoitems,
* InfoObject: 0LOC_CURRCY Hauswährung.
loc_currcy TYPE /bi0/oiloc_currcy,
* InfoObject: 0BASE_UOM Basismengeneinheit.
base_uom TYPE /bi0/oibase_uom,
* InfoObject: 0COSTCENTER Kostenstelle.
costcenter TYPE /bi0/oicostcenter,
* InfoObject: 0CO_AREA Kostenrechnungskreis.
co_area TYPE /bi0/oico_area,
* InfoObject: 0DOC_NUM BW: Belegnummer.
doc_num TYPE /bi0/oidoc_num,
* InfoObject: 0MATERIAL Material.
material TYPE /bi0/oimaterial,
* InfoObject: 0PSTNG_DATE Buchungsdatum im Beleg.
pstng_date TYPE /bi0/oipstng_date,
* InfoObject: 0VENDOR Lieferant.
vendor TYPE /bi0/oivendor,
* InfoObject: 0PLANT Werk.
plant TYPE /bi0/oiplant,
* InfoObject: 0QUANT_B Menge in Basismengeneinheiten.
quant_b TYPE /bi0/oiquant_b,
* InfoObject: 0VALUE_LC Betrag in Hauswährung.
value_lc TYPE /bi0/oivalue_lc,
* InfoObject: 0RECORDMODE BW Deltaverfahren: Recordmode.
recordmode TYPE rodmupdmod,
* InfoObject: 0STOCKCAT Bestandstypen.
stockcat TYPE /bi0/oistockcat,
* InfoObject: 0STOCKTYPE Bestandsausprägung.
stocktype TYPE /bi0/oistocktype,
* InfoObject: 0INDSPECSTK Kennzeichen Bewertung Sonderbestand.
indspecstk TYPE /bi0/oiindspecstk,
* Field: RECNO Nummer des Datensatzes.
recno TYPE rsarecord,
END OF _ty_s_sc_1_full.
TYPES:
_ty_t_sc_1_full TYPE STANDARD TABLE OF _ty_s_sc_1_full
WITH NON-UNIQUE DEFAULT KEY.
TYPES:
BEGIN OF _ty_s_tg_1_full,
* InfoObject: 0CHNGID Änderungslauf ID.
chngid TYPE /bi0/oichngid,
* InfoObject: 0RECORDTP Satztyp.
recordtp TYPE /bi0/oirecordtp,
* InfoObject: 0REQUID Request ID.
requid TYPE /bi0/oirequid,
* InfoObject: 0CALDAY Kalendertag.
calday TYPE /bi0/oicalday,
* InfoObject: 0CALMONTH Kalenderjahr / Monat.
calmonth TYPE /bi0/oicalmonth,
* InfoObject: 0CALWEEK Kalenderjahr / Woche.
calweek TYPE /bi0/oicalweek,
* InfoObject: 0CALYEAR Kalenderjahr.
calyear TYPE /bi0/oicalyear,
* InfoObject: 0MATERIAL Material.
material TYPE /bi0/oimaterial,
* InfoObject: 0PLANT Werk.
plant TYPE /bi0/oiplant,
* InfoObject: 0STOR_LOC Lagerort.
stor_loc TYPE /bi0/oistor_loc,
* InfoObject: 0BATCH Chargennummer.
batch TYPE /bi0/oibatch,
* InfoObject: 0STOCKTYPE Bestandsausprägung.
stocktype TYPE /bi0/oistocktype,
* InfoObject: 0STOCKCAT Bestandstypen.
stockcat TYPE /bi0/oistockcat,
* InfoObject: 0GN_VENDOR Lieferant.
gn_vendor TYPE /bi0/oign_vendor,
* InfoObject: 0RECVS_VAL Zugangswert Bewerteter Bestand.
recvs_val TYPE /bi0/oirecvs_val,
* InfoObject: 0ISSVS_VAL Abgangswert Bewerteter Bestand.
issvs_val TYPE /bi0/oiissvs_val,
* InfoObject: 0ISSBLOSTCK Abgangsmenge Gesperrter Bestand.
issblostck TYPE /bi0/oiissblostck,
* InfoObject: 0ISSCNSSTCK Abgangsmenge Konsignationsbestand.
isscnsstck TYPE /bi0/oiisscnsstck,
* InfoObject: 0ISSQMSTCK Abgangsmenge Qualitätsbestand.
issqmstck TYPE /bi0/oiissqmstck,
* InfoObject: 0ISSTRANSST Abgangsmenge Transitbestand.
isstransst TYPE /bi0/oiisstransst,
* InfoObject: 0RECBLOSTCK Zugangsmenge Gesperrter Bestand.
recblostck TYPE /bi0/oirecblostck,
* InfoObject: 0RECCNSSTCK Zugangsmenge Konsignationsbestand.
reccnsstck TYPE /bi0/oireccnsstck,
* InfoObject: 0RECQMSTCK Zugangsmenge Qualitätsbestand.
recqmstck TYPE /bi0/oirecqmstck,
* InfoObject: 0RECTRANSST Zugangsmenge Transitbestand.
rectransst TYPE /bi0/oirectransst,
* InfoObject: 0ISSSCRP Abgangsmenge Ausschuss.
issscrp TYPE /bi0/oiissscrp,
* InfoObject: 0ISSVALSCRP Abgangswert Ausschuss.
issvalscrp TYPE /bi0/oiissvalscrp,
* InfoObject: 0RECTOTSTCK Zugangsmenge Gesamt Bestand.
rectotstck TYPE /bi0/oirectotstck,
* InfoObject: 0ISSTOTSTCK Abgangsmenge Gesamtbestand.
isstotstck TYPE /bi0/oiisstotstck,
* InfoObject: 0ISSVALSTCK Abgangsmenge Bewerteter Bestand.
issvalstck TYPE /bi0/oiissvalstck,
* InfoObject: 0RECVALSTCK Zugangsmenge Bewerteter Bestand.
recvalstck TYPE /bi0/oirecvalstck,
* InfoObject: 0VENCONCON Verbrauchswerte Lieferantenkonsignationsbe
*stand.
venconcon TYPE /bi0/oivenconcon,
* InfoObject: 0LOC_CURRCY Hauswährung.
loc_currcy TYPE /bi0/oiloc_currcy,
* InfoObject: 0BASE_UOM Basismengeneinheit.
base_uom TYPE /bi0/oibase_uom,
* Field: RECORD Nummer des Datensatzes.
record TYPE rsarecord,
END OF _ty_s_tg_1_full.
* Additional types for start routine interface
TYPES:
data_package_structure TYPE _ty_s_sc_1_full.
* Additional declaration for update rule interface
DATA:
MONITOR TYPE STANDARD TABLE OF rsmonitor WITH HEADER LINE,
MONITOR_RECNO TYPE STANDARD TABLE OF rsmonitors WITH HEADER LINE,
RECORD_NO LIKE sy-tabix,
RECORD_ALL LIKE sy-tabix,
SOURCE_SYSTEM LIKE rsupdsimulh-logsys.
* global definitions from update rules
* TABLES: ...
* DATA: ...
FORM routine_9998
TABLES DATA_PACKAGE TYPE _ty_t_sc_1_full
p_monitor STRUCTURE rsmonitor
p_monitor_recno STRUCTURE rsmonitors
CHANGING
ABORT LIKE sy-subrc
RAISING
cx_sy_arithmetic_error
cx_sy_conversion_error.
* init variables
* fill the internal table "MONITOR", to make monitor entries
* see OSS note 571669
LOOP AT DATA_PACKAGE.
IF DATA_PACKAGE-stockcat EQ 'V' OR
DATA_PACKAGE-stocktype EQ 'V'.
DELETE DATA_PACKAGE.
ENDIF.
ENDLOOP.
* if abort is not equal zero, the update process will be canceled
ABORT = 0.
p_monitor[] = MONITOR[].
p_monitor_recno[] = MONITOR_RECNO[].
CLEAR: MONITOR[],
MONITOR_RECNO[].
ENDFORM. "routine_9998
*&---------------------------------------------------------------------*
*& Form routine_0001
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->COMM_STRUCTURE text
* -->RESULT text
* -->RETURNCODE text
* -->ABORT text
* -->RAISING text
* -->CX_SY_ARITHMETIC_ERROR text
* -->CX_SY_CONVERSION_ERROR text
*----------------------------------------------------------------------*
FORM routine_0001
TABLES
p_monitor STRUCTURE rsmonitor
USING
COMM_STRUCTURE TYPE _ty_s_sc_1_full
CHANGING
RESULT TYPE _ty_s_tg_1_full-recvs_val
RETURNCODE LIKE sy-subrc
ABORT LIKE sy-subrc
RAISING
cx_sy_arithmetic_error
cx_sy_conversion_error.
* init variables
* fill the internal table "MONITOR", to make monitor entries
* value of goods receipts into valuated stock
IF ( COMM_STRUCTURE-processkey EQ '050' "Other revaluation +
OR COMM_STRUCTURE-processkey EQ '051' "Revaluation/ price change +
OR COMM_STRUCTURE-processkey EQ '052' ) "Revaluation/inv. verif. +
AND COMM_STRUCTURE-bwapplnm EQ 'MM'
AND COMM_STRUCTURE-cppvlc <> 0.
RESULT = COMM_STRUCTURE-cppvlc.
* if the returncode is not equal zero, the result will not be updated
RETURNCODE = 0.
ELSE.
* if the returncode is not equal zero, the result will not be updated
RETURNCODE = 4.
ENDIF.
* if abort is not equal zero, the update process will be canceled
ABORT = 0.
p_monitor[] = MONITOR[].
CLEAR MONITOR[].
ENDFORM. "routine_0001
*&---------------------------------------------------------------------*
*& Form routine_0002
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->COMM_STRUCTURE text
* -->RESULT text
* -->RETURNCODE text
* -->ABORT text
* -->RAISING text
* -->CX_SY_ARITHMETIC_ERROR text
* -->CX_SY_CONVERSION_ERROR text
*----------------------------------------------------------------------*
FORM routine_0002
TABLES
p_monitor STRUCTURE rsmonitor
USING
COMM_STRUCTURE TYPE _ty_s_sc_1_full
CHANGING
RESULT TYPE _ty_s_tg_1_full-issvs_val
RETURNCODE LIKE sy-subrc
ABORT LIKE sy-subrc
RAISING
cx_sy_arithmetic_error
cx_sy_conversion_error.
* init variables
* fill the internal table "MONITOR", to make monitor entries
* value of goods issue into valuated stock
IF ( COMM_STRUCTURE-processkey EQ '150' "Other revaluation -
OR COMM_STRUCTURE-processkey EQ '151' "Revaluation/price change -
OR COMM_STRUCTURE-processkey EQ '152' )"Revaluation/ invoice verif.-
AND COMM_STRUCTURE-bwapplnm EQ 'MM'
AND COMM_STRUCTURE-cppvlc <> 0.
* result value of the routine
RESULT = COMM_STRUCTURE-cppvlc.
* if the returncode is not equal zero, the result will not be updated
RETURNCODE = 0.
ELSE.
* if the returncode is not equal zero, the result will not be updated
RETURNCODE = 4.
ENDIF.
* if abort is not equal zero, the update process will be canceled
ABORT = 0.
p_monitor[] = MONITOR[].
CLEAR MONITOR[].
ENDFORM. "routine_0002
*$*$ end of 2nd part global - insert your code only before this line *
*---------------------------------------------------------------------*
* CLASS routine IMPLEMENTATION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
CLASS lcl_transform IMPLEMENTATION.
METHOD compute_0ISSVS_VAL.
* IMPORTING
* request type rsrequest
* datapackid type rsdatapid
* SOURCE_FIELDS-BWAPPLNM TYPE /BI0/OIBWAPPLNM
* SOURCE_FIELDS-CPPVLC TYPE /BI0/OICPPVLC
* SOURCE_FIELDS-PROCESSKEY TYPE /BI0/OIPROCESSKEY
* SOURCE_FIELDS-LOC_CURRCY TYPE /BI0/OILOC_CURRCY
* EXPORTING
* RESULT type _ty_s_TG_1-ISSVS_VAL
DATA:
MONITOR_REC TYPE rsmonitor.
*$*$ begin of routine - insert your code only below this line *-*
Data:
l_monitor TYPE STANDARD TABLE OF rsmonitor,
*--
COMM_STRUCTURE type _ty_s_SC_1_full,
l_subrc type sy-tabix,
l_abort type sy-tabix,
Ls_monitor type rsmonitor,
ls_monitor_recno type rsmonitors.
REFRESH:
MONITOR.
MOVE-CORRESPONDING SOURCE_FIELDS to COMM_STRUCTURE.
* Migrated update rule call
Perform routine_0002
TABLES
l_monitor
USING
COMM_STRUCTURE
CHANGING
RESULT
l_subrc
l_abort.
*-- Convert Messages in Transformation format
LOOP AT l_monitor INTO ls_monitor.
move-CORRESPONDING ls_monitor to MONITOR_REC.
append monitor_rec to MONITOR.
ENDLOOP.
IF l_subrc <> 0.
RAISE EXCEPTION TYPE cx_rsrout_skip_val.
ENDIF.
IF l_abort <> 0.
RAISE EXCEPTION TYPE CX_RSROUT_ABORT.
ENDIF.
*$*$ end of routine - insert your code only before this line *-*
ENDMETHOD. "compute_0ISSVS_VAL
*----------------------------------------------------------------------*
* Method invert_0ISSVS_VAL
*----------------------------------------------------------------------*
*
* 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_0ISSVS_VAL.
*$*$ 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_0ISSVS_VAL
ENDCLASS. "routine IMPLEMENTATION
No hay comentarios:
Publicar un comentario