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

Problems with BADI_ARTICLE_REF_RT...

Former Member
0 Likes
1,716

Hi,

in order to modify automatically the content of valuation class (MBEW-BKLAS) at save command of transactions MM41/42, we are using BADI_ARTICLE_REF_RT, methods REFERENZ_BEFORE-REFERENZ_AFTE.

The solution is ok but it has a problem: for a particular group of plants (MBEW-BWKEY), all the ones starting with 'IT', the BAdI is jumped and than the content of valuation class is not modified.

We cannot understand whey this happens: any idea?

Thanks in advance.

5 REPLIES 5
Read only

Former Member
0 Likes
1,157

i understand your sceneraio but i am not able to gain what code you wrote in BADI impl, send ur code once to better understand it clearly

Read only

0 Likes
1,157

Well,

the code is the following:

    SELECT SINGLE valfrom INTO l_bwkey
    FROM setleaf
   WHERE setname EQ 'ZPS_VALAREA'
     AND valfrom EQ badi_mbew-bwkey.

  IF sy-subrc IS INITIAL.

    badi_mbew-bklas = 'PS01'.


  ELSE.

    SELECT SINGLE bklas INTO badi_mbew-bklas
      FROM mbew
     WHERE matnr EQ badi_mbew-matnr
       AND bwkey EQ badi_mbew-bwkey
       AND bwtar EQ badi_mbew-bwtar.

  ENDIF.

In other words: for the plants contained in the set defined, the valuation class should be set with a costant value, for the others the valuation class should be set with the existing value (if found). Now, we have n plants, say 'XXX1', 'XXX2', ...,'IT01', 'IT02',..., 'ITNN', ...'XXXN': if I put a breakpoint in the methods, the transaction stops for every 'XXXY' plant (and the code work properly), but not for the plants starting with 'IT'. I'm wondering if, for these plants, I should use another BAdI or exit (and which one...).

Read only

0 Likes
1,157

I forgot to write that for the plants contained in the set and not starting with 'IT', and for the plants not contanined in the set and not starting with 'IT' the code, of course, works correctly.

Read only

0 Likes
1,157

Hi,

Can you check first the plants which starts are in final variale and also check if any validations are there for that plant.

Regards,

Gurunath Kumar D

Read only

Former Member
0 Likes
1,157

I hope it's clear that the problem is: for certain plants ('ITXX'') the bapi appears to be skipped because, putting a break point in the method, the transaction doesn't stop at it (the contrary for the other plants).