Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to debug a macro ?

Former Member
0 Likes
2,085

I have a piece of code, which has macro and it skips the below code, which I assume the check withing the macro has failed.Unable to trace anything so far.

* keys set within both stock types must match
    relation = s2l_strel_unrelated.

    DEFINE check_intsect_key.
* exit if key in intersection doesn't match
      check ( intsect z s2l_stock_key_&1 ) or
            ( keyvals-&1 = stock_type->keyvals-&1 ).
    END-OF-DEFINITION.

    apply_macro_to_stock_keys check_intsect_key. --- THIS CAUSES THE BELOW CODE TO BE SKIPPED, how to identify WHY ?

* if we get were, the intersection part matches

    IF only_me IS INITIAL.
      IF only_st IS INITIAL.
        relation = s2l_strel_equal.
      ENDIF.
* 'me' is more general than stock_type
      relation = s2l_strel_more_general.
    ELSEIF only_st IS INITIAL.
* 'me' is more specific than stock_type
      relation = s2l_strel_more_specific.
    ENDIF.
  ENDIF.
ENDMETHOD.

<Added code tags>

Edited by: Suhas Saha on Feb 8, 2012 5:14 PM

5 REPLIES 5
Read only

marcin_cholewczuk
Active Contributor
0 Likes
1,445

Hi,

Please use search before posting question. It's not possible to debug macro.

BR

Marcin Cholewczuk

Read only

0 Likes
1,445

Hi Marcin,

I did search for the same and found info which said a macro cannot be debugged. Something else said activate system debugging, which did not work for me.

My concern is the code, how do I decipher what causes different behaviour ?

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,445

> Something else said activate system debugging, which did not work for me.

System debugging wont let you debug macros.

I can see that the macro contains a simple CHECK statement(not sure why it was coded this way), you can check the variable contents in debug & see why this condition fails!

BR,

Suhas

Read only

sreenivas_pachva
Participant
0 Likes
1,445

Hi,

we cant debug macros in sap.

Regards

sreenivas p

Edited by: sreenivas.p on Feb 8, 2012 1:06 PM

Read only

Former Member
0 Likes
1,445

Made the below changes, moved the code out of the macro and debugged the same. Helps.

  • keys set within both stock types must match

relation = s2l_strel_unrelated.

  • DEFINE check_intsect_key.

    • exit if key in intersection doesn't match

  • check ( intsect z s2l_stock_key_&1 ) or

  • ( keyvals-&1 = stock_type->keyvals-&1 ).

  • END-OF-DEFINITION.

*

  • apply_macro_to_stock_keys check_intsect_key.

check ( intsect z s2l_stock_key_matnr ) or

( keyvals-matnr = stock_type->keyvals-matnr ).

  • if we get were, the intersection part matches