cancel
Showing results for 
Search instead for 
Did you mean: 

How to call a BADI (BADI_FMDERIVE) from a BAPI (BAPI_GOODSMVT_CREATE)

0 Kudos

Hi all,

I am facing a problem running BAPI_GOODSMVT_CREATE via RFC (XI/PI).

The BADI_FMDERIVE is not called and it leads to errors in the goods movement posting.

When running the BAPI via transaction SE37 the BADI is corectly called.

May you help on this problem?

Thank you

Silvia

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Please try the following:

1. Put a HTTP break-point in the FM BAPI_GOODSMVT_CREATE.

2. Put another HTTP break-point in the follwoing line:

if i_cobl-zzcost_cat space.

and try run the interface via XI.

in the debug mode you can see if the BADI is called at all.

Pls check the execution flow to find why it's not called in case while calling from XI.

Reward point if helpful.

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi Stefano,

Can you tell me what was the solution to this issue as I am facing the same problem?

Thanks,

Samrat.

0 Kudos

Thank you very much for your help.

I tried to set an "External breakpoint" but it did not work.

May you please tell me what do you mean by "HTTP breakpoint"?

Thanks a lot

(and of course many many reward points !!!)

Silvia

0 Kudos

I do not think there is any condition on it (I am only a functional analyst, not able to implement a BADI by myself!). Here is the content of the implemented methods, may you please tell me what you think about it?

Thank you

Silvia

method IF_EX_BADI_FMDERIVE~SET_STRATEGY_BUTTONS.

C_BUTTONS-USE_CHANGE_DOC = 'X'.

C_BUTTONS-USE_BADI = 'X'.

endmethod.

METHOD if_ex_badi_fmderive~fill_customer_fields.

DATA: avtype2 TYPE gmgr-grant_nbr.

if i_cobl-zzcost_cat <> space.

c_derive-zzcost_cat = i_cobl-zzcost_cat.

c_derive-zzav_type = i_cobl-zzav_type.

endif.

  • IF C_derive-COMMIT_ITEM(1) = 'E'.

  • c_derive-zzcost_cat = i_cobl-fipex+1(2).

  • c_derive-zzav_type = i_cobl-fipex+3(1).

  • ENDIF.

check c_derive-zzcost_cat = space and

c_derive-zzav_type = space.

IF c_derive-grant_nbr = 'NOT_RELEVANT_FOR_GM' or c_derive-grant_nbr is initial.

c_derive-zzav_type = 1.

  • Transfer planning data from CO comes with grant initial and business transction RKP1

if C_DERIVE-TRANSAC = 'RKP1'.

CASE c_derive-wBS_element+7(1).

WHEN '1'.

c_derive-zzcost_cat = '10'.

WHEN '2'.

c_derive-zzcost_cat = '20'.

endcase.

endif.

CASE c_derive-wBS_element+7(1).

WHEN '3'.

c_derive-zzcost_cat = '30'.

WHEN '4'.

c_derive-zzcost_cat = '40'.

WHEN '5'.

c_derive-zzcost_cat = '50'.

ENDCASE.

ELSE.

CASE c_derive-wBS_element+7(1).

WHEN '1'.

c_derive-zzcost_cat = '10'.

c_derive-zzav_type = 1.

CLEAR avtype2.

  • select single zzavail_type2 into avtype2 from gmgr where GRANT_NBR = i_cobl-GRANT_NBR.

  • IF avtype2 = 'X'.

  • c_derive-zzav_type = 2.

  • ENDIF.

WHEN '2'.

c_derive-zzcost_cat = '20'.

c_derive-zzav_type = 1.

CLEAR avtype2.

  • select single zzavail_type2 into avtype2 from gmgr where GRANT_NBR = i_cobl-GRANT_NBR.

  • IF avtype2 = 'X'.

  • c_derive-zzav_type = 2.

  • ENDIF.

WHEN '3'.

c_derive-zzcost_cat = '30'.

c_derive-zzav_type = 2.

WHEN '4'.

c_derive-zzcost_cat = '40'.

c_derive-zzav_type = 2.

WHEN '5'.

c_derive-zzcost_cat = '50'.

c_derive-zzav_type = 2.

ENDCASE.

ENDIF.

ENDMETHOD.

Former Member
0 Kudos

Looking at your issue my hunch is there might be some code that is conditionally firing. Pls check if the code is active only for certain user (did you put any SY-UNAME check?).

In case middleware is calling the BAPI it will call with the RFC user (remote).