Thursday, July 07, 2005

Lee ODS - Rutina Inicio

PROGRAM UPDATE_ROUTINE.
*$*$ begin of global - insert your declaration only below this line *-*
************************************************
* Tabla ODS a leer
************************************************
TABLES: /BIC/AODS_VYCP00.
* DATA: ...
CONSTANTS:
C_PLAN type /BI0/OIVTYPE value '020',
C_REAL type /BI0/OIVTYPE value '010'.
*$*$ end of global - insert your declaration only before this line *-*

* The follow definition is new in the BW3.x
TYPES:
BEGIN OF DATA_PACKAGE_STRUCTURE.
INCLUDE STRUCTURE /BIC/CS0EC_PCA_1.
TYPES:
RECNO LIKE sy-tabix,
END OF DATA_PACKAGE_STRUCTURE.
DATA:
DATA_PACKAGE TYPE STANDARD TABLE OF DATA_PACKAGE_STRUCTURE
WITH HEADER LINE
WITH NON-UNIQUE DEFAULT KEY INITIAL SIZE 0.

FORM startup
TABLES MONITOR STRUCTURE RSMONITOR "user defined monitoring
MONITOR_RECNO STRUCTURE RSMONITORS " monitoring with record n
DATA_PACKAGE STRUCTURE DATA_PACKAGE
USING RECORD_ALL LIKE SY-TABIX
SOURCE_SYSTEM LIKE RSUPDSIMULH-LOGSYS
CHANGING ABORT LIKE SY-SUBRC. "set ABORT <> 0 to cancel update
*
*$*$ begin of routine - insert your code only below this line *-*
* fill the internal table "MONITOR", to make monitor entries
data:
CEBEINT type /BIC/OIKCEBEINT,
TIPO_SUBREPARTO type /BIC/OIKTIPOSUB,
TABIX like SY-TABIX,
VER like DATA_PACKAGE-VERSION.

if ( SOURCE_SYSTEM = 'SL300' or SOURCE_SYSTEM = 'ZSLUA1020' ).
VER = 'P02'.
else.
VER = 'P03'.
endif.
loop at DATA_PACKAGE.
TABIX = sy-tabix.
DATA_PACKAGE-/BIC/KTIPOSUB = TIPO_SUBREPARTO.
if ( TIPO_SUBREPARTO = 'DEP' ).
************************************************
* Lectura de la ODS
************************************************
SELECT single * FROM /BIC/AODS_VYCP00
WHERE COORD_TYPE = 'XX'
AND WORKCENTER = 'YY'
AND CO_AREA = 'ZZ'
AND VERSION = 0
AND VTYPE = 10.
if ( sy-subrc = 0 ).
DATA_PACKAGE-/BIC/KTIPOSUB = 'DED'.
else.
DATA_PACKAGE-/BIC/KTIPOSUB = 'DEI'.
endif.
endif.
**********************************************************
* Actualiza DATA_PACKAGE (registros) con campos modificados
**********************************************************
modify DATA_PACKAGE INDEX TABIX.
endloop.
* if abort is not equal zero, the update process will be canceled
ABORT = 0.

*$*$ end of routine - insert your code only before this line *-*
*
ENDFORM.

0 Comments:

Post a Comment

<< Home