sábado, 8 de enero de 2011

Antiguo codigo 2lis_02_acc

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
LOOP AT DATA_PACKAGE.
IF NOT ( DATA_PACKAGE-PO_STATUS <> 'K'
* PO is not a replication from SRM System (in case of Extended Scenario
* PO is created in SRM and a copy of the PO is created in ERP with
* PO_STATUS = K)

AND ( DATA_PACKAGE-PROCESSKEY = '001' OR "Normal purchasing order
DATA_PACKAGE-PROCESSKEY = '011' OR Stock transport order
DATA_PACKAGE-PROCESSKEY = '021' OR Cross company order
* Only Purchase Orders

DATA_PACKAGE-PROCESSKEY = '004' OR " Normal scheduling agreement
DATA_PACKAGE-PROCESSKEY = '014' OR Stock transport agreement
DATA_PACKAGE-PROCESSKEY = '024') Cross company agreement -
* or Call Offs from schedule agreements

AND DATA_PACKAGE-BWAPPLNM EQ 'MM' ).
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_0004
TABLES
p_monitor STRUCTURE rsmonitor
USING
COMM_STRUCTURE type _ty_s_SC_1__RULE_51
CHANGING
RESULT TYPE _ty_s_TG_1_full-GN_CAT_PUR
RETURNCODE LIKE sy-subrc
ABORT LIKE sy-subrc
RAISING
cx_sy_arithmetic_error
cx_sy_conversion_error.

* init variables

* generate a generic key for purchase category logical system and
* material group
PERFORM generic_objects_category_r3
TABLES MONITOR
USING COMM_STRUCTURE-gn_r3_ssy
COMM_STRUCTURE-gn_r3_ssy
COMM_STRUCTURE-matl_group
RECORD_NO
RECORD_ALL
SOURCE_SYSTEM
CHANGING RESULT
ABORT .


p_monitor[] = MONITOR[].
CLEAR MONITOR[].

ENDFORM. "routine_0004

FORM routine_0001
TABLES
p_monitor STRUCTURE rsmonitor
USING
COMM_STRUCTURE type _ty_s_SC_1__RULE_52
CHANGING
RESULT TYPE _ty_s_TG_1_full-BBP_VENDOR
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

DATA: l_active_vendor LIKE RESULT.


l_hlp_chavl = COMM_STRUCTURE-vendor.
CALL FUNCTION 'RSAU_READ_MASTER_DATA'
EXPORTING
i_iobjnm = '0VENDOR'
i_chavl = l_hlp_chavl
i_attrnm = '0BPARTNER'
IMPORTING
e_attrval = l_active_vendor
EXCEPTIONS
read_error = 1
no_such_attribute = 2
wrong_import_parameters = 3
chavl_not_found = 4
OTHERS = 5.
CASE sy-subrc.
WHEN 1 OR 2 OR 3 OR 5.
* * Error during read --> Skip whole package

ABORT = 4.
* Copy error message into errorlog
MOVE-CORRESPONDING sy TO MONITOR.
APPEND MONITOR.
WHEN 0 OR 4.
* Vendor ID found successfull or not found
RESULT = l_active_vendor.

ABORT = 0.
ENDCASE.
sy-subrc = 0.


p_monitor[] = MONITOR[].
CLEAR MONITOR[].

ENDFORM. "routine_0001

FORM routine_0003
TABLES
p_monitor STRUCTURE rsmonitor
USING
COMM_STRUCTURE type _ty_s_SC_1__RULE_53
CHANGING
RESULT TYPE _ty_s_TG_1_full-PRODUCT
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

PERFORM generic_object_product_r3
TABLES MONITOR
USING COMM_STRUCTURE-log_sys_be
COMM_STRUCTURE-material
RECORD_NO
RECORD_ALL
SOURCE_SYSTEM
CHANGING RESULT
ABORT.


p_monitor[] = MONITOR[].
CLEAR MONITOR[].

ENDFORM. "routine_0003

FORM routine_0002
TABLES
p_monitor STRUCTURE rsmonitor
USING
COMM_STRUCTURE type _ty_s_SC_1__RULE_54
CHANGING
RESULT TYPE _ty_s_TG_1_full-GN_VENDOR
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

PERFORM generic_object_vendor_r3
TABLES MONITOR
USING COMM_STRUCTURE-log_sys
COMM_STRUCTURE-log_sys_be
COMM_STRUCTURE-vendor
RECORD_NO
RECORD_ALL
SOURCE_SYSTEM
CHANGING RESULT
ABORT.



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

* IMPORTING
* request type rsrequest
* datapackid type rsdatapid
* SOURCE_FIELDS-MATL_GROUP TYPE /BI0/OIMATL_GROUP
* SOURCE_FIELDS-GN_R3_SSY TYPE /BI0/OIGN_R3_SSY
* EXPORTING
* RESULT type _ty_s_TG_1-GN_CAT_PUR

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__RULE_51,
l_subrc type sy-tabix,
l_abort type sy-tabix,
ls_monitor TYPE rsmonitor,
ls_monitor_recno TYPE rsmonitors.

REFRESH:
MONITOR.

* Runtime attributs
SOURCE_SYSTEM = p_r_request->get_logsys( ).
MOVE-CORRESPONDING SOURCE_FIELDS to COMM_STRUCTURE.

* Migrated update rule call
Perform routine_0004
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_0GN_CAT_PUR
*----------------------------------------------------------------------*
* Method invert_0GN_CAT_PUR
*----------------------------------------------------------------------*
*
* 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_0GN_CAT_PUR.

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

No hay comentarios: