domingo, 9 de octubre de 2011

Transacciones

/$sync --> Reiniciar la memoria interna

rsrz --> v_rsrzglobv
bd61 --> punteros ALE (check para subida delta)

Tables BW

Queries:RSRREPDIR, RSZELTDIR,RSZELTTXT
Workbooks: RSRWBINDEXT

RSTSODS
V_TBDLS
RSADMINA
RREX_VARIABLE_EXIT

ODS Request:
RSICCONT
RSMONICDP
RSODSACTUPDTYPE
RSODSACTREQ

Favoritos usuarios:
SMEN_BUFFC

Módulos de funciones

DAYS_BETWEEN_TWO_DATES
GET_TAX_PERCENTAGE
RSAP_BIW_DISCONNECT
RSAR_ODS_API_DEL
L_MM_MATERIAL_READ
MB_SELECT_SD_SCHEDULED
MB_ABD_PURCHASE_ORDER
ME_READ_HISTORY

'UMC_TODO_SEND_EMAIL'

viernes, 2 de septiembre de 2011

Bisiesto

clear: mes, year, dia, yearmes.
year = COMM_STRUCTURE-CALMONTH(4).
year = year + 1.
mes = COMM_STRUCTURE-CALMONTH+4(2).
dia = COMM_STRUCTURE-CALDAY+6(2).

if mes eq '02'.
concatenate year mes into yearmes.
PERFORM CALCULATE_ULTIMO
USING yearmes
RECORD_NO
RECORD_ALL
SOURCE_SYSTEM
CHANGING RESULT
RETURNCODE.
else.
concatenate year mes dia into RESULT.
endif.
Cuando se copia un mandante respecto a otro se pueden copiar:
 Datos
 Customizing
 Usuarios

Todo lo que es workbench es independiente de mandante.
Si machacamos los usuarios, se borran todos los usuarios no coincidentes que estaban en mandante destino y no en el mandante origen
Si los roles de los usuarios eran diferentes se pierde todo lo que tenían en el mandante destino y pasan a tener todo lo que tenían en el mandante origen.

viernes, 22 de julio de 2011

0HR_PY_1 extractor is not runnig with delta mode

Actually, there are difference when the 0HR_PY_1 extractor is run in
init/delta mode or FULL mode. Please refer to the information provided
from our developer:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In full mode, the status of this payroll records, which is maintained
for each payroll area in transaction PA03, is NOT considered at all.
This is different in init/delta runs. In this case, we the extractor
needs to decide, whether payroll results can be considered to be
final and are not being overwritten by new payroll runs for the
same period.
This means, as long as a certain payroll period is not closed for
a given payroll area, results which are already on the database
for this period are not getting extracted, as there is the
possibility, that they are getting overwritten again by
a payroll run for the same period.
Once the payroll period is closed in PA03, the results for that
period are considered to be final, and thus extraction will
extract them. You will need to check the status of the payroll
areas in PA03.

domingo, 15 de mayo de 2011

jueves, 5 de mayo de 2011

Nº de dados por dimension

No dimensions will contain 30% or more entries compared to the
number of records in the fact tables.
In order to obtain this information:
- Call transaction RSRV.
- Choose "All Elementary Tests" - "Database."
- Double-click the line "Database Information about InfoProvider Tables."
- In the window on the right, choose "Database Information about InfoProvider Tables."
- Enter the InfoCube name and choose "Execute Tests."
- After the analysis finishes, choose "Display Messages" and open the analysis tree with the correct time stamp.

martes, 19 de abril de 2011

Fechas

=FormatDate([Date];"ddth Mmm yyyy")
=FormatDate(ToDate([Date];"dd/MM/yyyy");"ddth Mmm yyyy")

miércoles, 16 de marzo de 2011

Access to BO

To be able to View, Refresh and 'Edit' reports in public folder for further analysis but at the same times they should not be able to save the report in the same public folder-->


At the FOLDER level for view/refresh without the ability to save, set the following for Web Intelligence reports:
Save as CSV
Save as PDF
Use Lists of Values
Download files associated with the object
Export the report's data
Refresh the report's data
Save as excel
Refresh List of Values

The Users who will be developing and saving should have additional rights to save to the folder, which is also granted at the FOLDER level.

To give users the ability to do analysis on webi reports, apply the following at the APPLICATION level for Web Intelligence, depending on your user requirements:
Deny the access - "Add objects to the folders" to users
Enable Java Report Panel
Data Tracking: Enable for users
Interactive: General - Edit 'My Preferences'
Interactive: General - Ability to hide / show toolbars
Interactive: Reporting - Create and edit sort
Interactive: Reporting - Insert and remove report, table, chart and cell
Interactive: Left pane - Enable available objects, tables and charts
Enable interactive HTML viewing (if license permits)
Interactive: Left pane - Enable data summary
Interactive: Reporting - Apply and remove existing alerters
Interactive: Reporting - Create and edit report filter
Interactive: Left pane - Enable document summary
Interactive: Reporting - Create and edit predefined calculation
Interactive: Formatting - Enable toolbar and menus
Enable formula and variable creation
Enable Query - HTML
Interactive: General - Enable right click menu
Enable drill mode
Web Intelligence Rich Client: Print a document
Interactive: Left pane - Enable document structure and filters
Web Intelligence Rich Client: Enable a client to use it
Data Tracking: Enable format display changes by users
Interactive: Reporting - Create and edit break

viernes, 18 de febrero de 2011

Customizing BO Infoview

Logon CMC.
Area 'Manage'
Escoger 'Aplicativos'
Escoger 'Infoview'


Opciones:
Header and Style
Hola de estilos: default.css

Logo:
Do Not Display Logo: No logo is displayed and the colors selected for the header are displayed.

Display Business Objects Logo
This is the default setting and the image can be located at /BusinessObjects Enterprise 11/Web Content/Enterprise11/InfoView/images/banner_logo.gif.

Display Custom Logo
Specify the URL where the custom logo is located. Ensure that this URL is mapped to the web server.

Use Custom Header Colors
Change the default colors on the header.

Style Sheet
Found at /BusinessObjects Enterprise 11/Web Content/Enterprise11/InfoView/default.css, this style sheet can be replaced with your own or the default can be modified. The style sheet can be used to change such items as font, color, and size. Each entry in the style sheet is documented; however, make a backup copy of the default before making changes.





Display
This section hides or displays certain features, as described in Table 24.9.

Table 24.9. Global Display Features of InfoView Option
Description

Show Preferences Button
If checked, this displays the Preferences icon. If this is not displayed, users will have no control over setting their preferences.

Show Type Drop-Down List
Removes the ability to filter the page by object type and all objects are displayed.

Show Filters Tab on the Schedule Tab
Administrators might not want users applying filters to reports. The filters section gives the user the ability to rewrite the filter or SQL WHERE clause, and this is recommended only for advanced users.

Default Navigation View
Administrator can select either Category or Folder as an initial view of the navigation section.

Maximum Number of Pages of Objects to Show
Pages of objects are created by the number of objects the user chooses to display on a page. If more objects are available than are displayed on the page, additional page numbers are shown.




SAP Note 1414285 that will give you some pointers, here are the details of the Note:

Customizing the InfoView logon screen:
- Go to folder: C:\Program Files\BusinessObjects\Tomcat55\webapps\InfoViewApp\res\schema.blue\
- Rename the file: login_banner_center.gif to login_banner_center_OLD.gif
- Save the new logo file as login_banner_center.gif
- Restart the Tomcat server and open the InfoView.
- After opening the InfoView you will find the new logo
- Customizing the InfoView top banner logo:

After login to InfoView you want to change the logo that appears above the Menu
- Go to folder: C:\Program Files\BusinessObjects\Tomcat55\webapps\InfoViewApp\res\schema.blue\
- Rename the file: IV_left_topbanner.gif to IV_left_topbanner_OLD.gif
- Save the new left logo file as IV_left_topbanner.gif
- Rename the file: IV_right_topbanner.gif to IV_ right_topbanner_OLD.gif
- Save the new right logo file as IV_ right_topbanner.gif
- Take the backup of the file default.css as default_OLD.css
- Open the file default.css and adjust the following parameters in the “/* InfoView banners */” session as appropriated
.bannerCustomLeft
.bannerCustomRight
.bannerLogo
.bannerLeft
.bannerUserName
.bannerCenter
.bannerRight

- You may want to change the background-color and the banner height and width
- Save and close the file
- Restart the Tomcat server
- Open the InfoView and log in
- Check if the logo is according with your needs.





1. Log into CMC
2. Click BusinessObjects Enterprise Applications
3. Once inside, click Infoview
4. Click properties in infoview. In the section Header and Style you can put customer logo.

Please note: you should have rights to do the view/change etc in CMC.

viernes, 4 de febrero de 2011

Transportar el contenido de una tabla

A veces tenemos que transportar el contenido de algunas tablas de un entorno a otro. Esto lo haremos con tablas Z. Las tablas estándard de SAP no es recomendable realizarlo por este método porque no sabemos las implicaciones que esto puede tener en los diferentes módulos y porque siempre es mejor realizar los cambios por parametrización.

El ejemplo que tenemos a continuación es una tabla Z utilizada en BW. Esta tabla la tenemos definida en R3 y cada actualización que realicemos sobre ella se deberá realizar en desarrollo y deberá transportarse a los diferentes entornos.

Esta es la orden de transporte que tenemos de ejemplo:









Es importante indicar el ID de programa R3TR y el tipo de objeto TABU. En el objeto pondremos el nombre de la tabla.
Para crear una nueva orden de transporte iremos al folio en blanco o por Orden/Tarea -> Crear. En ese momento el sistema nos pedirá saber de que orden se trata: Customizing o Workbench. En este caso será de Workbench.


miércoles, 2 de febrero de 2011

Ejemplo Rutina INIT

"loop at source_package assigning .

IF NOT ( -PO_STATUS NE '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 ( -PROCESSKEY = '001' OR "Normal purchasing order
-PROCESSKEY = '011' OR "Stock transport order
-PROCESSKEY = '021' OR "Cross company order
** Only Purchase Orders
*
-PROCESSKEY = '004' OR "Normal scheduling agreement
-PROCESSKEY = '014' OR "Stock transport agreement
-PROCESSKEY = '024') "Cross company agreement -
** or Call Offs from schedule agreements
*
AND -BWAPPLNM EQ 'MM' ).
DELETE source_package.
ENDIF.
ENDLOOP."




**************************
********************

  delete DATA_PACKAGE where ( CUST_MKT ne '009'    and
                             CUST_MKT ne '020' )   and
                           ( DOC_TYPE ne 'ZA11'    and
                             DOC_TYPE ne 'ZD11'    and
                             DOC_TYPE ne 'ZD21'    and
                             DOC_TYPE ne 'ZD31'    and
                             DOC_TYPE ne 'ZR11'    and
                             DOC_TYPE ne   'KE'  ) and
                           ( MATL_TYPE eq 'ZPPT'   or
                             MATERIAL  eq '000000000001200002' ).

martes, 18 de enero de 2011

Agregación Running SUM


Dos ratios:
*Ventas
*Ventas n-1

Derivado:
*Acumulado por mes... =RunningSum([Vendas]; ([L01 Período contábil]))
*Aculumado por year =RunningSum([Vendas]; ([L01 Exercício]))
*Acumulado por mes n-1... =RunningSum([Vendas n-1]; ([L01 Período contábil]))
*Aculumado por year n-1 =RunningSum([Vendas n-1]; ([L01 Exercício]))


*%Var del mes y del year
=If (((RunningSum([Vendas]; ([L01 Período contábil]))/RunningSum([Vendas n-1]; ([L01 Período contábil]))))-1)=(-1) Then "N.A." Else ((RunningSum([Vendas]; ([L01 Período contábil]))/RunningSum([Vendas n-1]; ([L01 Período contábil])))-1)

=If (((RunningSum([Vendas]; ([L01 Exercício]))/RunningSum([Vendas n-1]; ([L01 Exercício]))))-1)=(-1) Then "N.A." Else ((RunningSum([Vendas]; ([L01 Exercício]))/RunningSum([Vendas n-1]; ([L01 Exercício])))-1)

Previous Amount

Intervalo de edad

DATA: years type numc2,
months type numc2,
days type numc2.

CALL FUNCTION 'ZHRCM_TIME_PERIOD_CALCULATE'
EXPORTING
begda = TRAN_STRUCTURE-GBDAT
endda = sy-datum
IMPORTING
noyrs = years
nomns = months
nodys = days
EXCEPTIONS
invalid_dates = 1
overflow = 2
OTHERS = 3.

IF years < 20.
RESULT = 1.
ELSEIF years >= 20 AND years <= 29.
RESULT = 2.
ELSEIF years >= 30 AND years <= 39.
RESULT = 3.
ELSEIF years >= 40 AND years <= 49.
RESULT = 4.
ELSEIF years >= 50 AND years <= 59.
RESULT = 5.
ELSEIF years >= 60 AND years <= 69.
RESULT = 6.
ELSEIF years >= 70.
RESULT = 7.
Else. RESULT =

Running SUM

=If ((RunningSum([Vendas]; ([L01 Período contábil]))/RunningSum([Vendas ano n-1]; ([L01 Período contábil]))))<0 Then "N.A." Else ((RunningSum([Vendas]; ([L01 Período contábil]))/RunningSum([Vendas ano n-1]; ([L01 Período contábil])))-1)


=If (((RunningSum([Vendas]; ([L01 Exercício]))/RunningSum([Vendas ano n-1]; ([L01 Exercício]))))-1)=(-1) Then "N.A." Else ((RunningSum([Vendas]; ([L01 Exercício]))/RunningSum([Vendas ano n-1]; ([L01 Exercício])))-1)



(RunningSum([Vendas]; ([L01 Período contábil]))/RunningSum([Vendas ano n-1]; ([L01 Período contábil])))

domingo, 9 de enero de 2011

Filtro valores mayores que... / Restantes

Filtro de Ventas:(>=200) // SUM(ventas)
Ignorar el filtro: Nofilter ((>=200)) // Nofilter(SUM(sales))

Ej:
Suma de todas las ventas mayores de 200 euros: SUM((>=200))
Suma del resto: Nofilter ((>=200))
Suma de todo: SUM(ventas)

Ordem Meses y Dias --> Configuración regional de Panel Control de Windows

sábado, 8 de enero de 2011

Operadores contextuales

Tenemos:
•in
•Foreach
•Forall
•in Body
•in Block
•in Report
•currentpage

Ejemplos:
Min( In (,)) In
Min( foreach )
Min( forall )
Min( In Report

Obtener %'s sobre el resultado Total

En BEX era muy facil obtener el %sobre el resultado y el resultado total (%CT y %GT).
En BO no es tan directo.
Si tenemos el un importe en euros y quedemos ver el % que cada año supone en el total:
Importe %
2008 100 10
2009 500 50
2010 300 30
Total 1000 100%

Para obtener el %: =/Sum() ForAll
Si con esto navegaramos a otra dimensión, por ej, trimestre, o producto:
%: =/Sum() ForAll
El % se "descuajeringaria".

Lo correcto seria:
= In Body /Sum() In Report

Antiguo Código de 2lis_03_um

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

Antiguo código de 2lis_03_bx

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: 0BASE_UOM Unidade de medida básica.
BASE_UOM TYPE /BI0/OIBASE_UOM,
* InfoObject: 0CPQUABU BW: quantidade em unidade de medida básica.
CPQUABU TYPE /BI0/OICPQUABU,
* InfoObject: 0INDSPECSTK Código avaliação estoque especial.
INDSPECSTK TYPE /BI0/OIINDSPECSTK,
* InfoObject: 0STOCKCAT Tipos de valor não-cumulativo.
STOCKCAT TYPE /BI0/OISTOCKCAT,
* Field: RECORD.
RECORD TYPE RSARECORD,
END OF _ty_s_SC_1.
TYPES:
BEGIN OF _ty_s_TG_1,
* InfoObject: 0RECVALSTCK (7) Quantidade entrada no estoque avaliad
*o.
RECVALSTCK TYPE /BI0/OIRECVALSTCK,
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_0RECVALSTCK
IMPORTING
request type rsrequest
datapackid type rsdatapid
SOURCE_FIELDS type _ty_s_SC_1
EXPORTING
RESULT type _ty_s_TG_1-RECVALSTCK
monitor type rstr_ty_t_monitor
RAISING
cx_rsrout_abort
cx_rsrout_skip_record
cx_rsrout_skip_val.
METHODS
invert_0RECVALSTCK
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
*$*$ end of rule type
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.

TYPES:
BEGIN OF _ty_s_SC_1__RULE_9,
* InfoObject: 0CPQUABU BW: Menge in Basismengeneinheit.
CPQUABU TYPE /BI0/OICPQUABU,
* InfoObject: 0INDSPECSTK Kennzeichen Bewertung Sonderbestand.
INDSPECSTK TYPE /BI0/OIINDSPECSTK,
* InfoObject: 0STOCKCAT Bestandstypen.
STOCKCAT TYPE /BI0/OISTOCKCAT,
* InfoObject: 0BASE_UOM Basismengeneinheit.
BASE_UOM TYPE /BI0/OIBASE_UOM,
END OF _ty_s_SC_1__RULE_9.

TYPES:
BEGIN OF _ty_s_SC_1__RULE_10,
* InfoObject: 0GN_R3_SSY Quellsystem der R/3 Entität.
GN_R3_SSY TYPE /BI0/OIGN_R3_SSY,
* InfoObject: 0STOCKCAT Bestandstypen.
STOCKCAT TYPE /BI0/OISTOCKCAT,
* InfoObject: 0STOCKTYPE Bestandsausprägung.
STOCKTYPE TYPE /BI0/OISTOCKTYPE,
* InfoObject: 0VENDOR Lieferant.
VENDOR TYPE /BI0/OIVENDOR,
END OF _ty_s_SC_1__RULE_10.

TYPES:
BEGIN OF _ty_s_SC_1__RULE_11,
* InfoObject: 0CPQUABU BW: Menge in Basismengeneinheit.
CPQUABU TYPE /BI0/OICPQUABU,
* InfoObject: 0STOCKCAT Bestandstypen.
STOCKCAT TYPE /BI0/OISTOCKCAT,
* InfoObject: 0STOCKTYPE Bestandsausprägung.
STOCKTYPE TYPE /BI0/OISTOCKTYPE,
* InfoObject: 0BASE_UOM Basismengeneinheit.
BASE_UOM TYPE /BI0/OIBASE_UOM,
END OF _ty_s_SC_1__RULE_11.

TYPES:
BEGIN OF _ty_s_SC_1__RULE_14,
* InfoObject: 0GN_R3_SSY Quellsystem der R/3 Entität.
GN_R3_SSY TYPE /BI0/OIGN_R3_SSY,
* InfoObject: 0STOCKCAT Bestandstypen.
STOCKCAT TYPE /BI0/OISTOCKCAT,
* InfoObject: 0VENDOR Lieferant.
VENDOR TYPE /BI0/OIVENDOR,
END OF _ty_s_SC_1__RULE_14.

TYPES:
BEGIN OF _ty_s_SC_1__RULE_20,
* InfoObject: 0CPQUABU BW: Menge in Basismengeneinheit.
CPQUABU TYPE /BI0/OICPQUABU,
* InfoObject: 0STOCKCAT Bestandstypen.
STOCKCAT TYPE /BI0/OISTOCKCAT,
* InfoObject: 0STOCKTYPE Bestandsausprägung.
STOCKTYPE TYPE /BI0/OISTOCKTYPE,
* InfoObject: 0BASE_UOM Basismengeneinheit.
BASE_UOM TYPE /BI0/OIBASE_UOM,
END OF _ty_s_SC_1__RULE_20.

TYPES:
BEGIN OF _ty_s_SC_1__RULE_21,
* InfoObject: 0CPQUABU BW: Menge in Basismengeneinheit.
CPQUABU TYPE /BI0/OICPQUABU,
* InfoObject: 0STOCKCAT Bestandstypen.
STOCKCAT TYPE /BI0/OISTOCKCAT,
* InfoObject: 0STOCKTYPE Bestandsausprägung.
STOCKTYPE TYPE /BI0/OISTOCKTYPE,
* InfoObject: 0BASE_UOM Basismengeneinheit.
BASE_UOM TYPE /BI0/OIBASE_UOM,
END OF _ty_s_SC_1__RULE_21.

TYPES:
BEGIN OF _ty_s_SC_1__RULE_22,
* InfoObject: 0CPQUABU BW: Menge in Basismengeneinheit.
CPQUABU TYPE /BI0/OICPQUABU,
* InfoObject: 0STOCKTYPE Bestandsausprägung.
STOCKTYPE TYPE /BI0/OISTOCKTYPE,
* InfoObject: 0BASE_UOM Basismengeneinheit.
BASE_UOM TYPE /BI0/OIBASE_UOM,
END OF _ty_s_SC_1__RULE_22.

TYPES:
BEGIN OF _ty_s_SC_1__RULE_30,
* InfoObject: 0CPPVLC BW: Einkaufswert in Hauswährung.
CPPVLC TYPE /BI0/OICPPVLC,
* InfoObject: 0INDSPECSTK Kennzeichen Bewertung Sonderbestand.
INDSPECSTK TYPE /BI0/OIINDSPECSTK,
* InfoObject: 0STOCKCAT Bestandstypen.
STOCKCAT TYPE /BI0/OISTOCKCAT,
* InfoObject: 0LOC_CURRCY Hauswährung.
LOC_CURRCY TYPE /BI0/OILOC_CURRCY,
END OF _ty_s_SC_1__RULE_30.

* 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
INCLUDE rsbctgn_top.
INCLUDE rsbctgn_update_rules.

FORM routine_0011
TABLES
p_monitor STRUCTURE rsmonitor
USING
COMM_STRUCTURE type _ty_s_SC_1__RULE_9
CHANGING
RESULT TYPE _ty_s_TG_1_full-RECVALSTCK
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
* additional check if orders on hand or projekt stock
* and if they are valuated (A or M)
IF COMM_STRUCTURE-stockcat IS INITIAL OR
( COMM_STRUCTURE-stockcat CA 'EQ' AND
COMM_STRUCTURE-indspecstk CA 'AM' ).
* if the returncode is not equal zero, the result will not be updated
RESULT = COMM_STRUCTURE-cpquabu.
RETURNCODE = 0.
ELSE.
RETURNCODE = 4.
ENDIF.
* if abort is not equal zero, the update process will be canceled
ABORT = 0.

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

ENDFORM. "routine_0011

FORM routine_0013
TABLES
p_monitor STRUCTURE rsmonitor
USING
COMM_STRUCTURE type _ty_s_SC_1__RULE_10
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
* ... determine consolidated key
IF COMM_STRUCTURE-stockcat CA 'KQ' OR
COMM_STRUCTURE-stocktype CA 'QRS'.
PERFORM gn_get_global_key TABLES MONITOR
USING COMM_STRUCTURE-gn_r3_ssy
g_c_bwbeoty_r3vendor
COMM_STRUCTURE-vendor
RECORD_NO
RECORD_ALL
CHANGING RESULT
ABORT.
ENDIF.
* if the returncode is not equal zero, the result will not be updated
RETURNCODE = 0.

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

ENDFORM. "routine_0013

FORM routine_0003
TABLES
p_monitor STRUCTURE rsmonitor
USING
COMM_STRUCTURE type _ty_s_SC_1__RULE_11
CHANGING
RESULT TYPE _ty_s_TG_1_full-RECCNSSTCK
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
* only consignment stock is considered
CASE COMM_STRUCTURE-stockcat.
WHEN 'K'.
RESULT = COMM_STRUCTURE-cpquabu.
RETURNCODE = 0.
WHEN space.
IF COMM_STRUCTURE-stocktype CA 'KLM'.
RESULT = COMM_STRUCTURE-cpquabu.
RETURNCODE = 0.
ELSE.
RETURNCODE = 4.
ENDIF.
WHEN OTHERS.
RETURNCODE = 4.
ENDCASE.
ABORT = 0.

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

ENDFORM. "routine_0003

FORM routine_0014
TABLES
p_monitor STRUCTURE rsmonitor
USING
COMM_STRUCTURE type _ty_s_SC_1__RULE_14
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
* ... determine consolidated key
IF COMM_STRUCTURE-stockcat EQ 'K'.
PERFORM gn_get_global_key TABLES MONITOR
USING COMM_STRUCTURE-gn_r3_ssy
g_c_bwbeoty_r3vendor
COMM_STRUCTURE-vendor
RECORD_NO
RECORD_ALL
CHANGING RESULT
ABORT.
* if the returncode is not equal zero, the result will not be updated
Endif.
RETURNCODE = 0.


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

ENDFORM. "routine_0014

FORM routine_0002
TABLES
p_monitor STRUCTURE rsmonitor
USING
COMM_STRUCTURE type _ty_s_SC_1__RULE_20
CHANGING
RESULT TYPE _ty_s_TG_1_full-RECBLOSTCK
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
* only blocked stock is considered
IF COMM_STRUCTURE-stocktype EQ 'D' AND
COMM_STRUCTURE-stockcat NA 'KR'.
* result value of the routine
RESULT = COMM_STRUCTURE-cpquabu.
* if the returncode is not equal zero, the result will not be updated
RETURNCODE = 0.
ELSE.
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

FORM routine_0004
TABLES
p_monitor STRUCTURE rsmonitor
USING
COMM_STRUCTURE type _ty_s_SC_1__RULE_21
CHANGING
RESULT TYPE _ty_s_TG_1_full-RECQMSTCK
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
* only stock in quality inspection is considered
IF COMM_STRUCTURE-stocktype CA 'BLOR' AND
COMM_STRUCTURE-stockcat NA 'KR'.
RESULT = COMM_STRUCTURE-cpquabu.
* if the returncode is not equal zero, the result will not be updated
RETURNCODE = 0.
ELSE.
RETURNCODE = 4.
ENDIF.
* if abort is not equal zero, the update process will be canceled
ABORT = 0.

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

ENDFORM. "routine_0004

FORM routine_0012
TABLES
p_monitor STRUCTURE rsmonitor
USING
COMM_STRUCTURE type _ty_s_SC_1__RULE_22
CHANGING
RESULT TYPE _ty_s_TG_1_full-RECTRANSST
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
* only stock in transit is considered
IF COMM_STRUCTURE-stocktype CA 'FH'.
RESULT = COMM_STRUCTURE-cpquabu.
* if the returncode is not equal zero, the result will not be updated
RETURNCODE = 0.
ELSE.
RETURNCODE = 4.
ENDIF.
* if abort is not equal zero, the update process will be canceled
ABORT = 0.

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

ENDFORM. "routine_0012

FORM routine_0001
TABLES
p_monitor STRUCTURE rsmonitor
USING
COMM_STRUCTURE type _ty_s_SC_1__RULE_30
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
* only valuated stock is considered
IF COMM_STRUCTURE-stockcat IS INITIAL OR
( COMM_STRUCTURE-stockcat CA 'EQ' AND
COMM_STRUCTURE-indspecstk CA 'AM' ).
* 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.
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

*$*$ end of 2nd part global - insert your code only before this line *

*---------------------------------------------------------------------*
* CLASS routine IMPLEMENTATION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
CLASS lcl_transform IMPLEMENTATION.

METHOD compute_0RECVALSTCK.

* IMPORTING
* request type rsrequest
* datapackid type rsdatapid
* SOURCE_FIELDS-BASE_UOM TYPE /BI0/OIBASE_UOM
* SOURCE_FIELDS-CPQUABU TYPE /BI0/OICPQUABU
* SOURCE_FIELDS-INDSPECSTK TYPE /BI0/OIINDSPECSTK
* SOURCE_FIELDS-STOCKCAT TYPE /BI0/OISTOCKCAT
* EXPORTING
* RESULT type _ty_s_TG_1-RECVALSTCK

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_9,
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_0011
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_0RECVALSTCK
*----------------------------------------------------------------------*
* Method invert_0RECVALSTCK
*----------------------------------------------------------------------*
*
* 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_0RECVALSTCK.

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

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

Antiguo Código de 2lis_03_bf

*&---------------------------------------------------------------------*
*& Form routine_9998
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->DATA_PACKAGE text
* -->P_MONITOR text
* -->P_MONITOR_RECNO text
* -->ABORT text
* -->RAISING text
* -->CX_SY_ARITHMETIC_ERROR text
* -->CX_SY_CONVERSION_ERROR text
*----------------------------------------------------------------------*
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_0012
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_MONITOR text
* -->COMM_STRUCTURE text
* -->RESULT text
* -->RETURNCODE text
* -->ABORT text
* -->RAISING text
* -->CX_SY_ARITHMETIC_ERROR text
* -->CX_SY_CONVERSION_ERROR text
*----------------------------------------------------------------------*
FORM routine_0012
TABLES
p_monitor STRUCTURE rsmonitor
USING
COMM_STRUCTURE type _ty_s_SC_1__RULE_9
CHANGING
RESULT TYPE _ty_s_TG_1_full-ISSCNSSTCK
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
* only goods issue is considered
IF ( COMM_STRUCTURE-processkey EQ '100' "Other Issues
OR COMM_STRUCTURE-processkey EQ '101' "Returns / Vendor
OR COMM_STRUCTURE-processkey EQ '104' "Material Transfer
OR COMM_STRUCTURE-processkey EQ '105' "Stock Adjustment InvD
OR COMM_STRUCTURE-processkey EQ '106' "Stock Adjustment Other
OR COMM_STRUCTURE-processkey EQ '110' ) "Issue from Stock Transfer
AND COMM_STRUCTURE-bwapplnm EQ 'MM'
* only movements which are relevant for stock control
AND COMM_STRUCTURE-stockrelev EQ '1'
AND COMM_STRUCTURE-cpquabu <> 0.
* only consignment stock is considered
CASE COMM_STRUCTURE-stockcat.
WHEN 'K'.
RESULT = COMM_STRUCTURE-cpquabu.
RETURNCODE = 0.
WHEN space.
IF COMM_STRUCTURE-stocktype CA 'KLM'.
RESULT = COMM_STRUCTURE-cpquabu.
RETURNCODE = 0.
ELSE.
RETURNCODE = 4.
ENDIF.
WHEN OTHERS.
RETURNCODE = 4.
ENDCASE.
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_0012

*&---------------------------------------------------------------------*
*& Form routine_0014
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_MONITOR text
* -->COMM_STRUCTURE text
* -->RESULT text
* -->RETURNCODE text
* -->ABORT text
* -->RAISING text
* -->CX_SY_ARITHMETIC_ERROR text
* -->CX_SY_CONVERSION_ERROR text
*----------------------------------------------------------------------*
FORM routine_0014
TABLES
p_monitor STRUCTURE rsmonitor
USING
COMM_STRUCTURE type _ty_s_SC_1__RULE_10
CHANGING
RESULT TYPE _ty_s_TG_1_full-RECCNSSTCK
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
* only goods receipt is considered
IF ( COMM_STRUCTURE-processkey EQ '000' "Other Receipts
OR COMM_STRUCTURE-processkey EQ '001' "Goods Receipt / Vendor
OR COMM_STRUCTURE-processkey EQ '004' "Material Transfer
OR COMM_STRUCTURE-processkey EQ '005' "Stock Adjustment InvD
OR COMM_STRUCTURE-processkey EQ '006' "Stock Adjustment Other
OR COMM_STRUCTURE-processkey EQ '010' ) "Receipt from Stock Transfer
AND COMM_STRUCTURE-bwapplnm EQ 'MM'
* only movements which are relevant for stock control
AND COMM_STRUCTURE-stockrelev EQ '1'
AND COMM_STRUCTURE-cpquabu <> 0.
* only consignment stock is considered
CASE COMM_STRUCTURE-stockcat.
WHEN 'K'.
RESULT = COMM_STRUCTURE-cpquabu.
RETURNCODE = 0.
WHEN space.
IF COMM_STRUCTURE-stocktype CA 'KLM'.
RESULT = COMM_STRUCTURE-cpquabu.
RETURNCODE = 0.
ELSE.
RETURNCODE = 4.
ENDIF.
WHEN OTHERS.
RETURNCODE = 4.
ENDCASE.
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_0014

*&---------------------------------------------------------------------*
*& Form routine_0041
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_MONITOR text
* -->COMM_STRUCTURE text
* -->RESULT text
* -->RETURNCODE text
* -->ABORT text
* -->RAISING text
* -->CX_SY_ARITHMETIC_ERROR text
* -->CX_SY_CONVERSION_ERROR text
*----------------------------------------------------------------------*
FORM routine_0041
TABLES
p_monitor STRUCTURE rsmonitor
USING
COMM_STRUCTURE type _ty_s_SC_1__RULE_11
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
* ... determine consolidated key
IF COMM_STRUCTURE-stockcat EQ 'K'.
PERFORM gn_get_global_key TABLES MONITOR
USING COMM_STRUCTURE-gn_r3_ssy
g_c_bwbeoty_r3vendor
COMM_STRUCTURE-vendor
RECORD_NO
RECORD_ALL
CHANGING RESULT
ABORT.
* if the returncode is not equal zero, the result will not be updated
Endif.
RETURNCODE = 0.


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

ENDFORM. "routine_0041

*&---------------------------------------------------------------------*
*& Form routine_0010
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_MONITOR text
* -->COMM_STRUCTURE text
* -->RESULT text
* -->RETURNCODE text
* -->ABORT text
* -->RAISING text
* -->CX_SY_ARITHMETIC_ERROR text
* -->CX_SY_CONVERSION_ERROR text
*----------------------------------------------------------------------*
FORM routine_0010
TABLES
p_monitor STRUCTURE rsmonitor
USING
COMM_STRUCTURE type _ty_s_SC_1__RULE_12
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
* only goods issue is considered
IF ( COMM_STRUCTURE-processkey EQ '100' "Other Issues
OR COMM_STRUCTURE-processkey EQ '101' "Returns / Vendor
OR COMM_STRUCTURE-processkey EQ '104' "Material Transfer
OR COMM_STRUCTURE-processkey EQ '105' "Stock Adjustment InvD
OR COMM_STRUCTURE-processkey EQ '106' "Stock Adjustment Other
OR COMM_STRUCTURE-processkey EQ '110' ) "Issues from Stock Transfers
AND COMM_STRUCTURE-bwapplnm EQ 'MM'
* only movements which are relevant for stock control
AND COMM_STRUCTURE-stockrelev EQ '1'
AND COMM_STRUCTURE-cppvlc <> 0
* see OSS note 630254
AND ( COMM_STRUCTURE-stockcat IS INITIAL OR
( COMM_STRUCTURE-stockcat CA 'EQ' AND
COMM_STRUCTURE-indspecstk CA 'AM' ) ).
* result value of the routine
RESULT = COMM_STRUCTURE-cppvlc.
* if the returncode is zero, the result will 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_0010

*&---------------------------------------------------------------------*
*& Form routine_0011
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_MONITOR text
* -->COMM_STRUCTURE text
* -->RESULT text
* -->RETURNCODE text
* -->ABORT text
* -->RAISING text
* -->CX_SY_ARITHMETIC_ERROR text
* -->CX_SY_CONVERSION_ERROR text
*----------------------------------------------------------------------*
FORM routine_0011
TABLES
p_monitor STRUCTURE rsmonitor
USING
COMM_STRUCTURE type _ty_s_SC_1__RULE_13
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
* only goods receipt is considered
IF ( COMM_STRUCTURE-processkey EQ '000' "Other Receipts
OR COMM_STRUCTURE-processkey EQ '001' "Goods Receipt / Vendor
OR COMM_STRUCTURE-processkey EQ '004' "Material Transfer / Receipt
OR COMM_STRUCTURE-processkey EQ '005' "Stock Adjustment InvD
OR COMM_STRUCTURE-processkey EQ '006' "Stock Adjustment Other
OR COMM_STRUCTURE-processkey EQ '010' ) "Receipt from Stock Transfer
AND COMM_STRUCTURE-bwapplnm EQ 'MM'
* only movements which are relevant for stock control
AND COMM_STRUCTURE-stockrelev EQ '1'
AND COMM_STRUCTURE-cppvlc <> 0
* see OSS note 630254
AND ( COMM_STRUCTURE-stockcat IS INITIAL OR
( COMM_STRUCTURE-stockcat CA 'EQ' AND
COMM_STRUCTURE-indspecstk CA 'AM' ) ).
* result value of the routine
RESULT = COMM_STRUCTURE-cppvlc.
* if the returncode is zero, the result will 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_0011

*&---------------------------------------------------------------------*
*& Form routine_0038
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_MONITOR text
* -->COMM_STRUCTURE text
* -->RESULT text
* -->RETURNCODE text
* -->ABORT text
* -->RAISING text
* -->CX_SY_ARITHMETIC_ERROR text
* -->CX_SY_CONVERSION_ERROR text
*----------------------------------------------------------------------*
FORM routine_0038
TABLES
p_monitor STRUCTURE rsmonitor
USING
COMM_STRUCTURE type _ty_s_SC_1__RULE_15
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
* ... determine consolidated key
IF COMM_STRUCTURE-stockcat CA 'KQ' OR
COMM_STRUCTURE-stocktype CA 'QRS'.
PERFORM gn_get_global_key TABLES MONITOR
USING COMM_STRUCTURE-gn_r3_ssy
g_c_bwbeoty_r3vendor
COMM_STRUCTURE-vendor
RECORD_NO
RECORD_ALL
CHANGING RESULT
ABORT.
ENDIF.
* if the returncode is not equal zero, the result will not be updated
RETURNCODE = 0.

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

ENDFORM. "routine_0038

*&---------------------------------------------------------------------*
*& Form routine_0033
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_MONITOR text
* -->COMM_STRUCTURE text
* -->RESULT text
* -->RETURNCODE text
* -->ABORT text
* -->RAISING text
* -->CX_SY_ARITHMETIC_ERROR text
* -->CX_SY_CONVERSION_ERROR text
*----------------------------------------------------------------------*
FORM routine_0033
TABLES
p_monitor STRUCTURE rsmonitor
USING
COMM_STRUCTURE type _ty_s_SC_1__RULE_19
CHANGING
RESULT TYPE _ty_s_TG_1_full-ISSTOTSTCK
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
* only goods issue is considered
IF ( COMM_STRUCTURE-processkey EQ '100' "Other Issues
OR COMM_STRUCTURE-processkey EQ '101' "Returns / Vendor
OR COMM_STRUCTURE-processkey EQ '104' "Material Transfer
OR COMM_STRUCTURE-processkey EQ '105' "Stock Adjustment InvD
OR COMM_STRUCTURE-processkey EQ '106' "Stock Adjustment Other
OR COMM_STRUCTURE-processkey EQ '110' ) "Issue from Stock Transfer
AND COMM_STRUCTURE-bwapplnm EQ 'MM'
* only movements which are relevant for stock control
AND COMM_STRUCTURE-stockrelev EQ '1'
AND COMM_STRUCTURE-cpquabu <> 0.
RESULT = COMM_STRUCTURE-cpquabu.
* if the returncode is zero, the result will 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_0033

*&---------------------------------------------------------------------*
*& Form routine_0034
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_MONITOR text
* -->COMM_STRUCTURE text
* -->RESULT text
* -->RETURNCODE text
* -->ABORT text
* -->RAISING text
* -->CX_SY_ARITHMETIC_ERROR text
* -->CX_SY_CONVERSION_ERROR text
*----------------------------------------------------------------------*
FORM routine_0034
TABLES
p_monitor STRUCTURE rsmonitor
USING
COMM_STRUCTURE type _ty_s_SC_1__RULE_20
CHANGING
RESULT TYPE _ty_s_TG_1_full-RECTOTSTCK
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
* only goods receipt is considered
IF ( COMM_STRUCTURE-processkey EQ '000' "Other Receipts
OR COMM_STRUCTURE-processkey EQ '001' "Goods Receipt / Vendor
OR COMM_STRUCTURE-processkey EQ '004' "Material Transfer / Receipt
OR COMM_STRUCTURE-processkey EQ '005' "Stock Adjustment InvD
OR COMM_STRUCTURE-processkey EQ '006' "Stock Adjustment Other
OR COMM_STRUCTURE-processkey EQ '010' ) "Receipt from Stock Transfer
AND COMM_STRUCTURE-bwapplnm EQ 'MM'
* only movements which are relevant for stock control
AND COMM_STRUCTURE-stockrelev EQ '1'
AND COMM_STRUCTURE-cpquabu <> 0.
* result value of the routine
RESULT = COMM_STRUCTURE-cpquabu.
* if the returncode is zero, the result will 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_0034

*&---------------------------------------------------------------------*
*& Form routine_0035
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_MONITOR text
* -->COMM_STRUCTURE text
* -->RESULT text
* -->RETURNCODE text
* -->ABORT text
* -->RAISING text
* -->CX_SY_ARITHMETIC_ERROR text
* -->CX_SY_CONVERSION_ERROR text
*----------------------------------------------------------------------*
FORM routine_0035
TABLES
p_monitor STRUCTURE rsmonitor
USING
COMM_STRUCTURE type _ty_s_SC_1__RULE_21
CHANGING
RESULT TYPE _ty_s_TG_1_full-ISSVALSTCK
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
* only goods issue is considered
IF ( COMM_STRUCTURE-processkey EQ '100' "Other Issues
OR COMM_STRUCTURE-processkey EQ '101' "Returns / Vendor
OR COMM_STRUCTURE-processkey EQ '104' "Material Transfer
OR COMM_STRUCTURE-processkey EQ '105' "Stock Adjustment InvD
OR COMM_STRUCTURE-processkey EQ '106' "Stock Adjustment Other
OR COMM_STRUCTURE-processkey EQ '110' ) "Issues from Stock Transfers
AND COMM_STRUCTURE-bwapplnm EQ 'MM'
* only movements which are relevant for stock control
* additional check if orders on hand or projekt stock
* and if they are valuated (A or M)
AND COMM_STRUCTURE-stockrelev EQ '1'
AND COMM_STRUCTURE-cpquabu <> 0
AND ( COMM_STRUCTURE-stockcat IS INITIAL OR
( COMM_STRUCTURE-stockcat CA 'EQ' AND
COMM_STRUCTURE-indspecstk CA 'AM' ) ).
RESULT = COMM_STRUCTURE-cpquabu.
* if the returncode is zero, the result will 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_0035

*&---------------------------------------------------------------------*
*& Form routine_0036
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_MONITOR text
* -->COMM_STRUCTURE text
* -->RESULT text
* -->RETURNCODE text
* -->ABORT text
* -->RAISING text
* -->CX_SY_ARITHMETIC_ERROR text
* -->CX_SY_CONVERSION_ERROR text
*----------------------------------------------------------------------*
FORM routine_0036
TABLES
p_monitor STRUCTURE rsmonitor
USING
COMM_STRUCTURE type _ty_s_SC_1__RULE_22
CHANGING
RESULT TYPE _ty_s_TG_1_full-RECVALSTCK
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
* only goods receipt is considered
IF ( COMM_STRUCTURE-processkey EQ '000' "Other Receipts
OR COMM_STRUCTURE-processkey EQ '001' "Goods Receipt / Vendor
OR COMM_STRUCTURE-processkey EQ '004' "Material Transfer / Receipt
OR COMM_STRUCTURE-processkey EQ '005' "Stock Adjustment InvD
OR COMM_STRUCTURE-processkey EQ '006' "Stock Adjustment Other
OR COMM_STRUCTURE-processkey EQ '010' ) "Receipt from Stock Transfer
AND COMM_STRUCTURE-bwapplnm EQ 'MM'
* only movements which are relevant for stock control
* additional check if orders on hand or projekt stock
* and if they are valuated (A or M)
AND COMM_STRUCTURE-stockrelev EQ '1'
AND COMM_STRUCTURE-cpquabu <> 0
AND ( COMM_STRUCTURE-stockcat IS INITIAL OR
( COMM_STRUCTURE-stockcat CA 'EQ' AND
COMM_STRUCTURE-indspecstk CA 'AM' ) ).
RESULT = COMM_STRUCTURE-cpquabu.
* if the returncode is zero, the result will 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_0036

*&---------------------------------------------------------------------*
*& Form routine_0040
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_MONITOR text
* -->COMM_STRUCTURE text
* -->RESULT text
* -->RETURNCODE text
* -->ABORT text
* -->RAISING text
* -->CX_SY_ARITHMETIC_ERROR text
* -->CX_SY_CONVERSION_ERROR text
*----------------------------------------------------------------------*
FORM routine_0040
TABLES
p_monitor STRUCTURE rsmonitor
USING
COMM_STRUCTURE type _ty_s_SC_1__RULE_25
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
* ... determine consolidated key
IF COMM_STRUCTURE-stockcat CA 'KQ' OR
COMM_STRUCTURE-stocktype CA 'QRS'.
PERFORM gn_get_global_key TABLES MONITOR
USING COMM_STRUCTURE-gn_r3_ssy
g_c_bwbeoty_r3vendor
COMM_STRUCTURE-vendor
RECORD_NO
RECORD_ALL
CHANGING RESULT
ABORT.
ENDIF.
* if the returncode is not equal zero, the result will not be updated
RETURNCODE = 0.

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

ENDFORM. "routine_0040

*&---------------------------------------------------------------------*
*& Form routine_0037
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_MONITOR text
* -->COMM_STRUCTURE text
* -->RESULT text
* -->RETURNCODE text
* -->ABORT text
* -->RAISING text
* -->CX_SY_ARITHMETIC_ERROR text
* -->CX_SY_CONVERSION_ERROR text
*----------------------------------------------------------------------*
FORM routine_0037
TABLES
p_monitor STRUCTURE rsmonitor
USING
COMM_STRUCTURE type _ty_s_SC_1__RULE_31
CHANGING
RESULT TYPE _ty_s_TG_1_full-VENCONCON
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
* see OSS note 607710
* only goods issue is considered
IF ( COMM_STRUCTURE-processkey EQ '100' "Other Issues
OR COMM_STRUCTURE-processkey EQ '101' "Returns / Vendor
OR COMM_STRUCTURE-processkey EQ '104' "Material Transfer
OR COMM_STRUCTURE-processkey EQ '105' "Stock Adjustment InvD
OR COMM_STRUCTURE-processkey EQ '106' "Stock Adjustment Other
OR COMM_STRUCTURE-processkey EQ '110' ) "Issues from Stock Transfers
AND COMM_STRUCTURE-bwapplnm EQ 'MM'
* only movements which are relevant for stock control
AND COMM_STRUCTURE-stockrelev EQ '1'
AND COMM_STRUCTURE-cppvlc <> 0
AND COMM_STRUCTURE-stockcat EQ 'K'.
* result value of the routine
RESULT = COMM_STRUCTURE-cppvlc.
* if the returncode is zero, the result will 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_0037

*&---------------------------------------------------------------------*
*& Form routine_0013
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_MONITOR text
* -->COMM_STRUCTURE text
* -->RESULT text
* -->RETURNCODE text
* -->ABORT text
* -->RAISING text
* -->CX_SY_ARITHMETIC_ERROR text
* -->CX_SY_CONVERSION_ERROR text
*----------------------------------------------------------------------*
FORM routine_0013
TABLES
p_monitor STRUCTURE rsmonitor
USING
COMM_STRUCTURE type _ty_s_SC_1__RULE_37
CHANGING
RESULT TYPE _ty_s_TG_1_full-ISSBLOSTCK
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
* only goods issue is considered
IF ( COMM_STRUCTURE-processkey EQ '100' "Other Issues
OR COMM_STRUCTURE-processkey EQ '101' "Returns / Vendor
OR COMM_STRUCTURE-processkey EQ '104' "Material Transfer
OR COMM_STRUCTURE-processkey EQ '105' "Stock Adjustment InvD
OR COMM_STRUCTURE-processkey EQ '106' "Stock Adjustment Other
OR COMM_STRUCTURE-processkey EQ '110' ) "Issues from Stock Transfers
AND COMM_STRUCTURE-bwapplnm EQ 'MM'
* only blocked stock is considered
AND COMM_STRUCTURE-stocktype EQ 'D'
AND COMM_STRUCTURE-stockcat NA 'KR'
* only movements which are relevant for stock control
AND COMM_STRUCTURE-stockrelev EQ '1'
AND COMM_STRUCTURE-cpquabu <> 0.
* result value of the routine
RESULT = COMM_STRUCTURE-cpquabu.
* if the returncode is zero, the result will 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_0013

*&---------------------------------------------------------------------*
*& Form routine_0017
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_MONITOR text
* -->COMM_STRUCTURE text
* -->RESULT text
* -->RETURNCODE text
* -->ABORT text
* -->RAISING text
* -->CX_SY_ARITHMETIC_ERROR text
* -->CX_SY_CONVERSION_ERROR text
*----------------------------------------------------------------------*
FORM routine_0017
TABLES
p_monitor STRUCTURE rsmonitor
USING
COMM_STRUCTURE type _ty_s_SC_1__RULE_38
CHANGING
RESULT TYPE _ty_s_TG_1_full-ISSQMSTCK
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
* only goods issue is considered
IF ( COMM_STRUCTURE-processkey EQ '100' "Other Issues
OR COMM_STRUCTURE-processkey EQ '101' "Returns / Vendor
OR COMM_STRUCTURE-processkey EQ '104' "Material Transfer
OR COMM_STRUCTURE-processkey EQ '105' "Stock Adjustment InvD
OR COMM_STRUCTURE-processkey EQ '106' "Stock Adjustment Other
OR COMM_STRUCTURE-processkey EQ '110' ) "Issues from Stock Transfers
AND COMM_STRUCTURE-bwapplnm EQ 'MM'
* only stock in qulality inspection is considered
AND COMM_STRUCTURE-stocktype CA 'BLOR'
AND COMM_STRUCTURE-stockcat NA 'KR'
* only movements which are relevant for stock control
AND COMM_STRUCTURE-stockrelev EQ '1'
AND COMM_STRUCTURE-cpquabu <> 0.
* result value of the routine
RESULT = COMM_STRUCTURE-cpquabu.
* if the returncode is zero, the result will be updated
RETURNCODE = 0.
ELSE.
* if the returncode is not equal zero, the result will not be updated
RETURNCODE = 4.
ENDIF.

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

ENDFORM. "routine_0017

*&---------------------------------------------------------------------*
*& Form routine_0023
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_MONITOR text
* -->COMM_STRUCTURE text
* -->RESULT text
* -->RETURNCODE text
* -->ABORT text
* -->RAISING text
* -->CX_SY_ARITHMETIC_ERROR text
* -->CX_SY_CONVERSION_ERROR text
*----------------------------------------------------------------------*
FORM routine_0023
TABLES
p_monitor STRUCTURE rsmonitor
USING
COMM_STRUCTURE type _ty_s_SC_1__RULE_39
CHANGING
RESULT TYPE _ty_s_TG_1_full-ISSTRANSST
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
* only goods issue is considered
IF ( COMM_STRUCTURE-processkey EQ '100' "Other Issues
OR COMM_STRUCTURE-processkey EQ '101' "Returns / Vendor
OR COMM_STRUCTURE-processkey EQ '104' "Material Transfer
OR COMM_STRUCTURE-processkey EQ '105' "Stock Adjustment InvD
OR COMM_STRUCTURE-processkey EQ '106' "Stock Adjustment Other
OR COMM_STRUCTURE-processkey EQ '110' ) "Issues from Stock Transfers
AND COMM_STRUCTURE-bwapplnm EQ 'MM'
* only stock in transit is considered
AND COMM_STRUCTURE-stocktype CA 'FH'
* only movements which are relevant for stock control
AND COMM_STRUCTURE-stockrelev EQ '1'
AND COMM_STRUCTURE-cpquabu <> 0.
* result value of the routine
RESULT = COMM_STRUCTURE-cpquabu.
* if the returncode is zero, the result will be updated
RETURNCODE = 0.
ELSE.
* if the returncode is not equal zero, the result will not be updated
RETURNCODE = 4.
ENDIF.

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

ENDFORM. "routine_0023

*&---------------------------------------------------------------------*
*& Form routine_0018
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_MONITOR text
* -->COMM_STRUCTURE text
* -->RESULT text
* -->RETURNCODE text
* -->ABORT text
* -->RAISING text
* -->CX_SY_ARITHMETIC_ERROR text
* -->CX_SY_CONVERSION_ERROR text
*----------------------------------------------------------------------*
FORM routine_0018
TABLES
p_monitor STRUCTURE rsmonitor
USING
COMM_STRUCTURE type _ty_s_SC_1__RULE_40
CHANGING
RESULT TYPE _ty_s_TG_1_full-RECBLOSTCK
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
* only goods receipt is considered
IF ( COMM_STRUCTURE-processkey EQ '000' "Other Receipts
OR COMM_STRUCTURE-processkey EQ '001' "Goods Receipt / Vendor
OR COMM_STRUCTURE-processkey EQ '004' "Material Transfer / Receipt
OR COMM_STRUCTURE-processkey EQ '005' "Stock Adjustment InvD
OR COMM_STRUCTURE-processkey EQ '006' "Stock Adjustment Other
OR COMM_STRUCTURE-processkey EQ '010' ) "Receipt from Stock Transfer
AND COMM_STRUCTURE-bwapplnm EQ 'MM'
* only blocked stock is considered
AND COMM_STRUCTURE-stocktype EQ 'D'
AND COMM_STRUCTURE-stockcat NA 'KR'
* only movements which are relevant for stock control
AND COMM_STRUCTURE-stockrelev EQ '1'
AND COMM_STRUCTURE-cpquabu <> 0.
* result value of the routine
RESULT = COMM_STRUCTURE-cpquabu.
* if the returncode is zero, the result will 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_0018

*&---------------------------------------------------------------------*
*& Form routine_0015
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_MONITOR text
* -->COMM_STRUCTURE text
* -->RESULT text
* -->RETURNCODE text
* -->ABORT text
* -->RAISING text
* -->CX_SY_ARITHMETIC_ERROR text
* -->CX_SY_CONVERSION_ERROR text
*----------------------------------------------------------------------*
FORM routine_0015
TABLES
p_monitor STRUCTURE rsmonitor
USING
COMM_STRUCTURE type _ty_s_SC_1__RULE_41
CHANGING
RESULT TYPE _ty_s_TG_1_full-RECQMSTCK
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
* only goods receipt is considered
IF ( COMM_STRUCTURE-processkey EQ '000' "Other Receipts
OR COMM_STRUCTURE-processkey EQ '001' "Goods Receipt / Vendor
OR COMM_STRUCTURE-processkey EQ '004' "Material Transfer / Receipt
OR COMM_STRUCTURE-processkey EQ '005' "Stock Adjustment InvD
OR COMM_STRUCTURE-processkey EQ '006' "Stock Adjustment Other
OR COMM_STRUCTURE-processkey EQ '010' ) "Receipt from Stock Transfer
AND COMM_STRUCTURE-bwapplnm EQ 'MM'
* only stock in qulality inspection is considered
AND COMM_STRUCTURE-stocktype CA 'BLOR'
AND COMM_STRUCTURE-stockcat NA 'KR'
* only movements which are relevant for stock control
AND COMM_STRUCTURE-stockrelev EQ '1'
AND COMM_STRUCTURE-cpquabu <> 0.
* result value of the routine
RESULT = COMM_STRUCTURE-cpquabu.
* if the returncode is zero, the result will 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_0015

*&---------------------------------------------------------------------*
*& Form routine_0024
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_MONITOR text
* -->COMM_STRUCTURE text
* -->RESULT text
* -->RETURNCODE text
* -->ABORT text
* -->RAISING text
* -->CX_SY_ARITHMETIC_ERROR text
* -->CX_SY_CONVERSION_ERROR text
*----------------------------------------------------------------------*
FORM routine_0024
TABLES
p_monitor STRUCTURE rsmonitor
USING
COMM_STRUCTURE type _ty_s_SC_1__RULE_42
CHANGING
RESULT TYPE _ty_s_TG_1_full-RECTRANSST
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
* only goods receipt is considered
IF ( COMM_STRUCTURE-processkey EQ '000' "Other Receipts
OR COMM_STRUCTURE-processkey EQ '001' "Goods Receipt / Vendor
OR COMM_STRUCTURE-processkey EQ '004' "Material Transfer / Receipt
OR COMM_STRUCTURE-processkey EQ '005' "Stock Adjustment InvD +
OR COMM_STRUCTURE-processkey EQ '006' "Stock Adjustment Other +
OR COMM_STRUCTURE-processkey EQ '010' ) "Receipt from Stock Transfer
AND COMM_STRUCTURE-bwapplnm EQ 'MM'
* only stock in transit is considered
AND COMM_STRUCTURE-stocktype CA 'FH'
* only movements which are relevant for stock control
AND COMM_STRUCTURE-stockrelev EQ '1'
AND COMM_STRUCTURE-cpquabu <> 0.
* result value of the routine
RESULT = COMM_STRUCTURE-cpquabu.
* if the returncode is zero, the result will be updated
RETURNCODE = 0.
ELSE.
* if the returncode is not equal zero, the result will not be updated
RETURNCODE = 4.
ENDIF.

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

ENDFORM. "routine_0024

*&---------------------------------------------------------------------*
*& Form routine_0029
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_MONITOR text
* -->COMM_STRUCTURE text
* -->RESULT text
* -->RETURNCODE text
* -->ABORT text
* -->RAISING text
* -->CX_SY_ARITHMETIC_ERROR text
* -->CX_SY_CONVERSION_ERROR text
*----------------------------------------------------------------------*
FORM routine_0029
TABLES
p_monitor STRUCTURE rsmonitor
USING
COMM_STRUCTURE type _ty_s_SC_1__RULE_43
CHANGING
RESULT TYPE _ty_s_TG_1_full-ISSSCRP
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
* goods issue posting into scrap
* only standard movement types are considered
* copied scrap movement types must be added in this routine
IF ( COMM_STRUCTURE-movetype EQ '551' "GI scrapping
OR COMM_STRUCTURE-movetype EQ '552' "GI scrapping
OR COMM_STRUCTURE-movetype EQ '553' "GI scrapping QI
OR COMM_STRUCTURE-movetype EQ '554' "GI scrapping QI
OR COMM_STRUCTURE-movetype EQ '555' "GI scrapping blocked
OR COMM_STRUCTURE-movetype EQ '556' ) "GI scrapping blocked
AND COMM_STRUCTURE-bwapplnm EQ 'MM'.
* result value of the routine
RESULT = COMM_STRUCTURE-cpquabu .
* if the returncode is not equal zero, the result will not be updated
RETURNCODE = 0.
* if abort is not equal zero, the update process will be canceled
ELSE.
RETURNCODE = 4.
ENDIF.
ABORT = 0.

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

ENDFORM. "routine_0029

*&---------------------------------------------------------------------*
*& Form routine_0030
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_MONITOR text
* -->COMM_STRUCTURE text
* -->RESULT text
* -->RETURNCODE text
* -->ABORT text
* -->RAISING text
* -->CX_SY_ARITHMETIC_ERROR text
* -->CX_SY_CONVERSION_ERROR text
*----------------------------------------------------------------------*
FORM routine_0030
TABLES
p_monitor STRUCTURE rsmonitor
USING
COMM_STRUCTURE type _ty_s_SC_1__RULE_51
CHANGING
RESULT TYPE _ty_s_TG_1_full-ISSVALSCRP
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
* goods issue posting into scrap
* only standard movement types are considered
* copied scrap movement types must be added in this routine
IF ( COMM_STRUCTURE-movetype EQ '551' "GI scrapping
OR COMM_STRUCTURE-movetype EQ '552' "GI scrapping
OR COMM_STRUCTURE-movetype EQ '553' "GI scrapping QI
OR COMM_STRUCTURE-movetype EQ '554' "GI scrapping QI
OR COMM_STRUCTURE-movetype EQ '555' "GI scrapping blocked
OR COMM_STRUCTURE-movetype EQ '556' ) "GI scrapping blocked
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.
* if abort is not equal zero, the update process will be canceled
ELSE.
RETURNCODE = 4.
ENDIF.
ABORT = 0.

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

ENDFORM. "routine_0030