Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Data in the cube is showing multiple entries when compared with ODS

Former Member
0 Kudos

Hello BW Gurus,

We have a waste report in production planning on Cube and ODS separately. The same info package loads both targets (which means same infosource) but when we run a report on Cube, the records are showing multiple entries (i.e. Key Figures are not matching when compared to ODS) where as the ODS records are showing correctly as it was in R/3. There are totally 6 key figures out of which 4 pulled from R/3 and 2 are populated in BW.

An Example:

Waste report in PP run for plant 1000 for 12/2005 and process order 123456. The operational scrap should be 2.46% and the component scrap should be 3.00% for material 10000000. The report is showing 7.87% for planned operational waste % and 9.6% for planned component waste %. These values are not correct. The ODS values for order 123456 matched the data in R/3 for component and operational scrap.

There is a Start routine to the ODS and also to the cube. I am not good at ABAP so requesting your Help.

Here is the ODS Code:

tables: /BI0/PPRODORDER.

loop at data_package.

select single COORD_TYPE

PRODVERS

into (/BI0/PPRODORDER-COORD_TYPE,

/BI0/PPRODORDER-PRODVERS)

from /BI0/PPRODORDER

where PRODORDER = data_package-PRODORDER

and OBJVERS = 'A'.

if sy-subrc = 0.

if /BI0/PPRODORDER-COORD_TYPE = 'XXXX'

or /BI0/PPRODORDER-COORD_TYPE = 'YYYY'.

data_package-PRODVERS = space.

else.

data_package-PRODVERS = /BI0/PPRODORDER-PRODVERS.

endif.

endif.

if data_package-calday = space

or data_package-calday = '00000000'.

if data_package-TGTCONSQTY NE 0.

data_package-calday = data_package-ACTRELDATE.

endif.

endif.

modify data_package.

endloop.

Here is Cube Code:

tables: /BI0/PPRODORDER,

/BIC/ODS.

TYPES:

BEGIN OF ys_mat_unit,

material TYPE /bi0/oimaterial,

mat_unit TYPE /bi0/oimat_unit,

numerator TYPE /bi0/oinumerator,

denomintr TYPE /bi0/oidenomintr,

END OF ys_mat_unit.

DATA:

l_s_mat_unit TYPE ys_mat_unit,

e_factor type p decimals 5.

loop at data_package.

select single COORD_TYPE

PRODVERS

into (/BI0/PPRODORDER-COORD_TYPE,

/BI0/PPRODORDER-PRODVERS)

from /BI0/PPRODORDER

where PRODORDER = data_package-PRODORDER

and OBJVERS = 'A'.

if sy-subrc = 0.

if /BI0/PPRODORDER-COORD_TYPE = 'XXX'

or /BI0/PPRODORDER-COORD_TYPE = 'YYY'.

data_package-PRODVERS = space.

else.

data_package-PRODVERS = /BI0/PPRODORDER-PRODVERS.

endif.

endif.

if data_package-calday = space

or data_package-calday = '00000000'.

if data_package-TGTCONSQTY NE 0.

data_package-calday = data_package-ACTRELDATE.

endif.

endif.

data_package-agsu = 'GSU'.

data_package-agsu_qty = 0.

select single gr_qty

base_uom

into (/BIC/ODS-gr_qty,

/BIC/ODS-base_uom)

from /BIC/ODS

where prodorder = data_package-prodorder

and material = data_package-material.

if sy-subrc = 0.

if /BIC/ODS-base_uom = 'GSU'.

data_package-agsu_qty = /BIC/ODS-gr_qty.

else.

SELECT SINGLE * FROM /bi0/pmat_unit

INTO CORRESPONDING FIELDS OF l_s_mat_unit

WHERE material = data_package-material

AND mat_unit = 'GSU'

AND objvers = 'A'.

IF sy-subrc = 0.

IF l_s_mat_unit-denomintr <> 0.

e_factor = l_s_mat_unit-denomintr /

l_s_mat_unit-numerator.

multiply /BIC/ODS-gr_qty by e_factor.

data_package-agsu_qty = /BIC/ODS-gr_qty.

ENDIF.

else.

CALL FUNCTION 'UNIT_CONVERSION_SIMPLE'

EXPORTING

INPUT = /BIC/ODS-gr_qty

NO_TYPE_CHECK = 'X'

ROUND_SIGN = ' '

UNIT_IN = /BIC/ODS-base_uom

UNIT_OUT = 'GSU'

IMPORTING

OUTPUT = DATA_PACKAGE-gsu_qty

EXCEPTIONS

CONVERSION_NOT_FOUND = 1

DIVISION_BY_ZERO = 2

INPUT_INVALID = 3

OUTPUT_INVALID = 4

OVERFLOW = 5

TYPE_INVALID = 6

UNITS_MISSING = 7

UNIT_IN_NOT_FOUND = 8

UNIT_OUT_NOT_FOUND = 9

OTHERS = 10.

endif.

endif.

endif.

modify data_package.

endloop.

some how the AGSU qyt is not populating in the cube and when I dbug the code, I could see a clean record in the internal table but not in the cube.

your suggestion and solutions would be highly appreciated.

thanks,

Swathi.

3 REPLIES 3

Lakshmant1
Active Contributor
0 Kudos

Hi swathi,

Check the field DATA_PACKAGE-gsu_qty mentioned in the function module 'UNIT_CONVERSION_SIMPLE'. Is it DATA_PACKAGE-gsu_qty or DATA_PACKAGE-agus_qty.

Thanks

Lakshman

Former Member
0 Kudos

Hello Lakshman,

I its data_package-agus_qty and it a print mistake. Please let me know if you have any other inputes.

Thanks,

0 Kudos

Hi Swathi,

In your code for cube, when the second select statement which fetches data from /bic/ods failes, then also you are modifying the data_package. Also to avoid the duplicate records in your data package, use the modify statement before the ELSE part.

Try using the Transporting Syntax while using the modify statement and clear the Workareas of the Internal Tables.

Thanks

Lakshman