Monday 3 June 2013

Some SAP BW Examples

I work with SAP BW as the datawarehouse feeding our Qlikview reporting.  I've picked up a fair bit of SAP BW and ABAP over time, but struggle to quickly remember things that I have to do oonly occasionally - always have to go back to searching out methods.  This is how I will remember - by including some examples.


   Get CALWEEK from CALDAY or

Using RST_TOBJ_TO_DERIVED_TOBJ function.
 

REPORT Z_MICHAEL.
constants: rs_c_true           TYPE rs_bool      VALUE 'X'.
data: lv_date type d.
data: l_chavl(60)        TYPE c,
      l_chatt(
60type c"rsd_chavl,
      lv_week 
type /bi0/oicalweek.

lv_date = sy-datum.

DO 31 times.
  lv_date = lv_date + 
1.
  
write / lv_date.
  
CLEAR l_chavl.
  l_chavl = lv_date.

  
CALL FUNCTION 'RST_TOBJ_TO_DERIVED_TOBJ'
    
EXPORTING
      I_TIMNM_FROM = 
'0CALDAY'
      I_TIMNM_TO = 
'0CALWEEK'
      i_timvl   = l_chavl
      i_fiscvarnt = 
'Z6'
      i_buffer           = rs_c_true
    
importing
      e_timvl = l_chatt
    
EXCEPTIONS
      incompatible_tobjs = 
1
      no_input_value     = 
2
      fiscvarnt_missing  = 
3
      input_not_numeric  = 
4
      wrong_date         = 
5
      wrong_fiscper      = 
6
      x_message          = 
7
      
OTHERS             = 8.


  
write l_chatt.
ENDDO.

No comments:

Post a Comment