Skip to Content
Technical Articles

Setting to connect to debugger in BW4 HANA

Dear All,

This is one of the few most elementary things that we often get stuck while testing routines in BW4 for greenfield implementations – To set breakpoints and debug transformation code in eclipse or HANA studio based BW4 version. Till BW 7.4, it connects directly to the debugger if we set breakpoints in ‘Display Generated Program’ and execute DTP in simulate mode.

While putting breakpoint in TRFN routine in SAP GUI(new window inside Eclipse), we may get error as

Breakpoints cannot be set because of external context (–> long text)

We can use below setting to connect to debugger :

Windows -> Preference -> ABAP Development -> Debug -> Configure Project Specific Settings -> Project D41 -> ‘Enable Debugger’ checkbox would be enabled, please disable it -> Apply and Close

Then open the routine with SAP GUI and put breakpoints where required and run DTP in simulate mode.

Alternatively, you can also configure DTP simulate in Expert Mode :

 

 

When the Debugger connects, search for your routines through keywords like LOOP AT RESULT_PACKAGE for end routines, put breakpoint and F8 to pull pointer on the required statements.

Regards,

Ruma Ghosh

1 Comment
You must be Logged on to comment or reply to a post.
  • Or, and this is what I do, put all your coding into a global class, and call it from the transformation.

    *$*$ begin of 2nd part global - insert your code only below this line  
      data: routine type ref to zcl_my_transformation.
    *$*$ end of 2nd part global - insert your code only before this line 
    ...
    *$*$ begin of routine - insert your code only below this line        *-*
        IF routine IS NOT BOUND.
          CREATE OBJECT routine.
        ENDIF.
    
        routine->start_routine( CHANGING x_package = SOURCE_PACKAGE ).
    
    *$*$ end of routine - insert your code only before this line         *-*
    ...

    The signature for the method routine is as follows

    CHANGING x_package TYPE STANDARD TABLE
    RAISING cx_rsrout_abort
            cx_rsbk_errorcount.

    You can access the contents of the table using a structure that has just the fields you are interested in.

    DATA: BEGIN OF package,
            field1 TYPE ...
            field2 TYPE ...
          END OF package.
    
    LOOP AT x_package ASSIGNING FIELD-SYMBOL(<package>).
      MOVE-CORRESPONDING <package> TO package.
      ...process the data using the structure package.
      MOVE-CORRESPONDING package TO <package>.
    ENDLOOP.

    The advantages to this approach are:

    1. You can set a breakpoint directly in the class method
    2. You can group classes for transformations within class hierarchies, or using interfaces
    3. Scope for reuse and better modularisation and encapsulation
    4. You can test the method directly with a test program – or (better!) test methods within the class
    5. You can compare versions with in an instance, or across instances.

    In the BW project I’m on, we adopted this approach years ago and it has many times paid dividends.