Friday, November 30, 2012

Peculiar calendar week and its handling in BW

In one of earlier post I mentioned Time characteristics as Rule Type in Transformations. We can see how useful they are here. Especially in case of derivation of week (0CALWEEK) based on calendar day (0CALDAY). To decide into which week particular day falls might be tricky. Basically the main problem here is to decide about first/last week of year. It depends on calendar implementation which may differ from country to country. By default BW logic is govern by ISO (International Organization for Standardization). Its definition 8601 of first week (in short) is following:

- First day of the week is always Monday
- First week in year is week that includes January 4th

You can override this definition by implementing BadI CALENDAR_DEFINITION (for SAP Basis 62 & 64) and by Enhancement Spot (Basis 7). For details refer to SAP Notes below. To be honest this is not easy topic. :-)

1063178 - Calendar definition differs from ISO 8601
810900 - Counting weeks and working days
1520596 - 0CALWEEK does not support 53 fiscal weeks

Thursday, November 29, 2012

How to check if BAdI is implemented?

There are several possibilities to do that however almost none of them is really 100% check. I will go through them and will see that you can get out of them.

Enhancement concept tables/views:

V_EXT_IMP - View of all BAdI implementations (check field ACTIVE = 'X')
V_EXT_ACT – View on active implementations for an exit 
BADIIMPL_ENH - Implementation Active/Inactive Runtime Table (check field ACTIVE = 'X')
BADIIMPLENHCUST - Implementation Active/Inactive Runtime Table (check field ACTIVE_IMG = 'X')

TA SE84: this is probably the best way

Go via Repository Information System -> Enhancements=>
Classic BAdIs (Impl.)
Enhancement Implementations
          Dictionary Enhancement Impl.
Composite Enh. Implementation

and then enter Z* or Y* for customer implementations name field

Wednesday, November 28, 2012

IF statement in BEx queries

Using IF statement is very convenient how to evaluate the data. As usually BW developers are coming with programming background it is very obvious that they are looking into such statements. Although it is not very obvious from the very modest menu of functions in BEx’s formulas IF is possible it is just not easy to realize how this can be achieved.

Logic how to implement IF in BE’x formulas is following:

(  cond1  ) * ( result_if_cond1_is_tru ) + (  cond2 ) * (  result_if_cond2_is_tru )

+    means    ELSE

*    means    THEN

You can combine several conditions with AND operator. For example here’s simple IF-ELSE; in case KF1 is greater then KF2 put KF3 as result else put KF4 as result:

( KF1 > KF2) * KF3 + ( KF1 <= KF2) * KF4

Official documentation about so called “Conditional Calculations (IF-THEN-ELSE)” can be found here: