Skip to Content

How can I make a BADI validation for data input in BPC 10.1 NW Standard

Dec 06, 2016 at 09:28 AM


avatar image

I need to write a BADI that compares data in 2 cubes and if the comparison is not as required , I stop the save and popup the user with the validation error.

The comparison logic is comparing the sum of some data in 1 cube with the sum of some of some data in cube 2 based on some properties in the 2 cubes.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Vadim Kalinin Dec 06, 2016 at 09:32 AM

You can do it using write back badi or validation badi. But you have provide details:

What data you are saving (sample)?

How do you want to compare?

Show 6 Share
10 |10000 characters needed characters left characters exceeded

P.S. The difference between write back and validation badi is that write back can compare the full table of sent data and validation can compare only record after record.


I have 2 models

Model 1 contains : CATE dimensions +Dimension liquids with property subliquidLink

Member1 = liquidA , subliquidLink property =xyz

Member2 = liquidB , subliquidLink property=ABC

Member3 = liquidC , subliquidLink property=xyz

SIGNEDDATA :quantities of liquids

Model 2 contains CATE dimensions +Dimension ConsumedMaterials with property subliquidLink

Member1 = Subliquid1 , subliquidLink property=xyz

Member2 = Subliquid2 , subliquidLink property=xyz

Member3 = Subliquid3 , subliquidLink property=xyz

Member4 = Subliquid4 , subliquidLink property=ABC

Member5 = Subliquid5, subliquidLink property=ABC

SIGNEDDATA :quantities of subliquids

Logic :

In my business liquidA & liquidC are mixed then transformed to Subliquid1 ,Subliquid2 , Subliquid3 + losses

Required Validation:

While inputting the data i need to make sure that the total of Subliquid1+ Subliquid2 +Subliquid3 is less than liquidA + liquidC and if it is wrong i will popup a message saying " sum of output Subliquids cannot be more than sum of input liquids " and reject the save


Sorry, but not clear!

If you want some help please clearly explain the scenario:

What do you have in some model before data input?

How do you input data: screenshot of some template.

Why do you have subliquid property in the second model where you have individual subliquids?


In my case i have

- Input form for model 1 where the Purchasing Department user inputs the quantities of liquids bought.

- Input form for model 2 where the Production user inputs the produced subliquids by the company

The relation between liquids & sub liquids is

1 or more liquids are used to produce 1 or more subliquids

this relation is related to the liquids themselves and provided by technical department.

So the design is using property subliquidLink to link the 2 cubes

In the master data example above i had 2 subliquidLink property =xyz & ABC so i will loop in Model 1 to see which members have property XYZ then loop in model 2 to see which cubes have property xyz

by this loops i got the related input liquids and output subliquids

i do the same for ABC & for any subliquidLink property value.

My required validation is :

Total of produced subliquids is less or equal input liquids


Sorry, this is not the explanation required! Logically incorrect - still no reason for subliquid property in model 2

Please show real examples!

And absolutely unclear when the validation has to be done?


I use the subliquid property in both models to be many to many link between 2 models

all the bought products in cube 1 having specific property (ex XYZ) are used to produce all the "Produced Sub Liquids" in model 2 having the same property (ex XYZ)

example.png (11.4 kB)
Vadim Kalinin Dec 07, 2016 at 01:28 PM

Sorry, but many to many relationship can't be specified by property.

For many to many you need a relationship table or model:

liq.png (7.5 kB)
Show 1 Share
10 |10000 characters needed characters left characters exceeded

Thank you for your reply

in my case one liquid can only be used in 1 operation type ( cannot be input twice)

and each subliquid can only be output of 1 operation ( no 2 operation can have a common subliquid as output)

so the property is fulfilling my business case

Pplz see the example below

ex2.png (13.9 kB)
Vadim Kalinin Dec 08, 2016 at 08:16 PM

Strange production ...

From my own experience you have number of row materials and number of finished or semi-finished goods. And the relationship is many to many (one specific row material can be used in a number of finished/semi-finished goods). But in theory i can imagine your scenario.

Anyway, the main question is: when do you want to trigger validation (after what data is sent?)?

Looks like you first enter purchased liquids without validation and you have to validate subliquid data entry! Is it correct?

Also total validation is useless in general because it's not using the percents of the liquids used to produce subliquids...

Not clear!

Show 6 Share
10 |10000 characters needed characters left characters exceeded

Yes you are correct.

I want to validate that total of subliquids entry is less or equal the purchased liquids.

and if the entry is not passing the validation , I do not save the entry and pop up the user a message with the validation error.


Asking again and again: what data entry you are talking about?


in my example above

L1 & L3 are used to produce S1 & S3

in Model 1

Data entered was 150 for L1 & 250 for L2 and their total is 400

in Model 2

Operation department the user will enter the real produced subliquids S1 & S3

Example of valid data :S1 = 200 , S2= 100 total is 300 which is less that total input liquids

Example of invalid data :S1 = 200 , S2= 225 total is 435 which is more that total input liquids which cannot be correct

So i should stop the user from entering the invalid data and pop up a message saying total input liquids cannot be more than produced liquids


Looking on your text I can see that validation has to be done only when "user will enter the real produced subliquids S1 & S3" in operation department.

And the logic has to be:

User can enter S1 or S2 or both S1 and S2 in the single send.

Before writing data to cube, the existing data has to be read in itab and data send has to replace existing values in itab. Then total has to be calculated for itab and compared to existing sum of L1 and L2. If more - all sent records to be rejected.


Already in the cube:

L1=150, L2=250, SUML=400

S1=200, S2=100, SUMS=300

First data entry:

Single S2=300

Read from cube into itab:S1=200, S2=100

Replace S2=100 with S2=300

Calculate SUMS=200+300=500 > SUML=400

Reject send of S2=300

Second data entry:

Both S1=150, S2=300

Read from cube into itab:S1=200, S2=100

Replace S1=200 with S1=150 and S2=100 with S2=300

Calculate SUMS=150+300=450 > SUML=400

Reject send of both S1=150, S2=300

Is it clear?


Before developing any validation rule try to create validation on the Excel input form level (using Excel data validation). Try to save data and you will see the issues.


i need to compare values in 2 models

total values in model 1 >= total values in model 2

but in excel validation i will only validate thee data in the current model