Question:
Hi,
following scenario. I've got CO-PA data sources which extract data from my parent plants for both parent plants and subsidiaries. The first data source is used to transfer the data with the option 0comp_code = bukrs. For the seocnd data source I have to create a routine using kunre from CO-PA to determine the company code.
I have done the following:
1. Create a table in BW (ZWGNDL) with the fields: mandt, kunnr, bukrs. This is only used for the determination, therefore I didn't create an infoobject.
2. Create a routine in the update rules for the subsidiary's data source. Records with kunre not within the table zwgndl (these are none of our subsidiaries) have to be skipped but the data load itself shouldnt fail.
Here's my coding:
PROGRAM CONVERSION_ROUTINE.
* Type pools used by conversion program
TYPE-POOLS: RS, RSARC, RSARR, SBIWA, RSSM.
* Declaration of transfer structure (selected fields only)
TYPES: BEGIN OF TRANSFER_STRUCTURE ,
* InfoObject 0BILLTOPRTY: CHAR - 000010
KUNRE(000010) TYPE C,
END OF TRANSFER_STRUCTURE .
* Global code used by conversion rules
*$*$ begin of global - insert your declaration only below this line *-*
TABLES: zwgndl.
* DATA: ...
*$*$ end of global - insert your declaration only before this line *-*
*----------------------------------------------------------------------*
* FORM COMPUTE_COMP_CODE
*----------------------------------------------------------------------*
* Compute value of InfoObject 0COMP_CODE
* in communication structure /BIC/CSWICAP_P4_INTERFACE
*
* Technical properties:
* field name = COMP_CODE
* data element = /BI0/OICOMP_CODE
* data type = CHAR
* length = 000004
* decimals = 000000
* ABAP type = C
* ABAP length = 000004
* reference field =
*----------------------------------------------------------------------*
* Parameters:
* --> RECORD_NO Record number
* --> TRAN_STRUCTURE Transfer structure
* <-- RESULT Return value of InfoObject
* <-> G_T_ERRORLOG Error log
* <-- RETURNCODE Return code (to skip one record)
* <-- ABORT Abort code (to skip whole data package)
*----------------------------------------------------------------------*
FORM COMPUTE_COMP_CODE
USING RECORD_NO LIKE SY-TABIX
TRAN_STRUCTURE TYPE TRANSFER_STRUCTURE
G_S_MINFO TYPE RSSM_S_MINFO
CHANGING RESULT TYPE /BI0/OICOMP_CODE
G_T_ERRORLOG TYPE rssm_t_errorlog_int
RETURNCODE LIKE SY-SUBRC
ABORT LIKE SY-SUBRC. "set ABORT <> 0 to cancel datapackage
*$*$ begin of routine - insert your code only below this line *-*
* DATA: l_s_errorlog TYPE rssm_s_errorlog_int.
select single * from zwgndl where kunnr = TRAN_STRUCTURE-kunre.
if sy-subrc = 0.
RESULT = zwgndl-bukrs.
else.
* returncode <> 0 means skip this record
RETURNCODE = 4.
endif.
* abort <> 0 means skip whole data package !!!
ABORT = 0.
*$*$ end of routine - insert your code only before this line *-*
ENDFORM.
*----------------------------------------------------------------------*
* FORM INVERT_COMP_CODE
*----------------------------------------------------------------------*
* Inversion of selection criteria for InfoObject 0COMP_CODE
*
* This subroutine needs to be implemented only for SAP RemoteCubes
* (for better performance) and for the Report/Report Interface
* (drill through).
*
*----------------------------------------------------------------------*
* --> I_RT_CHAVL_CS Ranges table for current InfoObject
* --> I_THX_SELECTION_CS Selection criteria for all other InfoObjects
* <-- C_T_SELECTION Selection criteria for fields of
* transfer structure
* <-- E_EXACT Flag: Inversion was exact
*----------------------------------------------------------------------*
FORM INVERT_COMP_CODE
USING I_RT_CHAVL_CS TYPE RSARC_RT_CHAVL
I_THX_SELECTION_CS TYPE RSARC_THX_SELCS
CHANGING C_T_SELECTION TYPE SBIWA_T_SELECT
E_EXACT TYPE RS_BOOL.
*$*$ begin of inverse routine - insert your code only below this line*-*
DATA:
L_S_SELECTION LIKE LINE OF C_T_SELECTION.
* An empty selection means all values
CLEAR C_T_SELECTION.
L_S_SELECTION-FIELDNM = 'KUNRE'.
* ...
* Selection of all values may be not exact
E_EXACT = RS_C_FALSE.
*$*$ end of inverse routine - insert your code only before this line *-*
Now the load fails. When I edit the data in psa (every kunre is one from zwgndl) the load is okay. How do I achieve that only the false records will be skipped and the load itself is okay?!
_________________
Juergen Limbach
Answer:
you could move this to the start routine and there delete the "wrong" entries from your data_package table... it'll probably run faster too
Answer:
It probably failed with a message stating "too many errors".
If you exceed a certain number of skipped records in a transfer rule, then the load fail. This number maybe changed somewhere (by default, it is set to 1), maybe in the infopackage itself, don't remember.
But if you follow El Belgio's advice, then you completely bypass the problem.
Ch
_________________
_
There are only 10 types of people in the world :
those who understand binary and those who don't.
Answer:
It's been a long time since I've worked in BW... Nearly forgotten the start routine.
Thanks... The variety of how to modify the data is almost too wide... Have a nice weekend, in one hour my holidays will begin.
_________________
Juergen Limbach