reyemsaibot

SAP BI Blog about SAP BW/4HANA, Analysis for Office and SAP HANA - by Tobias Meyer

Schlagwort: abap

  • SAP BW Use Pattern in Variable with Customer Exit

    In my current project I created with a collegue a really cool function to analyze a string with 1333 characters. We are using a BW 7.4 SP 17 on HANA. First we have to build an Advanced DataStoreObject with a Field which has a length of 1333. For further understanding, we call the
    field Field_1333. As data type I used SSTRING.

    Create a field with a length of 1333 in Eclipse
    Create a field with a length of 1333 in Eclipse

    The Advanced DataStoreObject will be included into a CompositeProvider. The Problem is the CompositeProvider cannot work with a field which has the length of 1333.

    Advanced DSO cannot work with a field which is longer than 255
    Advanced DSO cannot work with a field which is longer than 255

    So my colleague decided to build an Open ODS View on top of the Advanced DSO. Therefor you have to activate the checkbox External SAP HANA View. My Open ODS View contains only
    the field „Field_1333“, Number of Records and one InfoObject I need for my query. As you can see, the Open ODS View shows a length of 250 for the field „Field_1333“. This is only a
    display problem.

    Open ODS View Display Problem
    Open ODS View Display Problem

    When you look into the data, the Information is complete.

    Datafield in ADSO
    Datafield in ADSO

    Now I use the Open ODS View in my CompositeProvider and here we go, the field is now available for my query.

    Mapping Field with Open ODS View
    Mapping Field with Open ODS View

    Now we build a query on the CompositeProvider and add the necessary InfoObject into the rows and a restricted key figure into the columns with a variable for the field „Field_1333“. This variable
    is used to fill the customer exit variable of the field „Field_1333“.

    Query Variable Customer Exit
    Query Variable Customer Exit

    Now you have the opportunity to fill a lot of values separated by comma. The customer exit sorts all values by ascending and fill the variable with ‚*‘ & value & ‚*‘

    ls_e_range-low = ls_e_range-low && ‚*‘ && ls_code-ccode && ‚*‘.

    Now we can combine different combinations and get a result. This result is used as a PreQuery in my main development. So I am able to build a complex analytics application and give the user the
    opportunity to analyze his data deeply.

    Replacement Variable with PreQuery
    Replacement Variable with PreQuery

    author.


    I am Tobias, I write this blog since 2014, you can find me on twitter and youtube. If you want you can leave me a paypal coffee donation. You can also contact me directly if you want.

  • SAP BW ABAP remove symbols

    From time to time it happens that the source system delivers special characters and the Business Warehouse system can not handle it. So the
    loading process may be crashed.

     

    One solution is the following ABAP code:

     

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    DATA:
      zeichen(1) TYPE c,
      muster(2) TYPE c,
      field TYPE c LENGTH 000060.
      field = SOURCE_FIELDS-YYSTREET.
    
    DO.
      IF field CO ' !"%&()*+,-./:;<=>?_0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZÄÖÜßabcdefg' && 'hijklmnopqrstuvwxyzäöü '.
        EXIT.
      ELSE.
        zeichen = field+sy-fdpos(1).
        muster+0(1) = zeichen.
        muster+1(1) = space.
        TRANSLATE field USING muster.
      ENDIF.
    
    ENDDO.
    
    RESULT = field.
    

    author.


    I am Tobias, I write this blog since 2014, you can find me on twitter and youtube. If you want you can leave me a paypal coffee donation. You can also contact me directly if you want.