Application Development 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: 

Queries on BADI Business Add In

Former Member
0 Kudos

I am working onn WOROKORDER_UPDATE BADI for Production Order for Process Industries. Following are my queries:

1. Is there a sequence in which the methods fire for example Interface method IF_EX_WORKORDER_UPDATEAT_SAVE is fired say before or after method IF_EX_WORKORDER_UPDATEBEFORE_UPDATE. This is for WORKORDER_UPDATE BADI.

2. Does each method get fired in same instance of same Implementation Class or in a separate instance.

3. If the methods are fired in separate instances how to share data across the separate instances in a OO approved manner other than SET/GET or EXPORT/IMPORT traditional mechanisms.

4. How to debug in ABAP debugger, seting breakpoints and watchpoints in method implementation code. Without having to wade through huge amounts of caller transaction code.

5. How to use BADI method for validation passing back a eror message to calling transaction say COR1 without raising exception and system message. Specifically I wish to use IF_EX_WORKORDER_UPDATE~BEFORE_UPDATE for custom Validation.

4 REPLIES 4

ssimsekler
Active Contributor
0 Kudos

Hi Jayantha

<b>> 1. Is there a sequence in which the methods fire for

> example Interface method

> IF_EX_WORKORDER_UPDATE~AT_SAVE is fired say before or

> after method IF_EX_WORKORDER_UPDATE~BEFORE_UPDATE.

> This is for WORKORDER_UPDATE BADI.</b>

Each method of a BAdI is triggerred at a defined point during the program flow. So this means that there is a order.

<b>> 2. Does each method get fired in same instance of

> same Implementation Class or in a separate instance.</b>

Each method seems to be triggered in the same instance however, BAdI methods can only deal with its own variables and the data passed through its interface. So, it depends on the design of the interface and the encapsulation level how much you can interfere in the program flow.

<b>> 3. If the methods are fired in separate instances how

> to share data across the separate instances in a OO

> approved manner other than SET/GET or EXPORT/IMPORT

> traditional mechanisms.</b>

BAdIs are more or less restricted interferences to the program flow. Having variables of more visibility or data sharing may have adverse effects. So, try to be contented with the given interface.

<b>> 4. How to debug in ABAP debugger, seting breakpoints

> and watchpoints in method implementation code.

> Without having to wade through huge amounts of caller

> transaction code.</b>

It restricts debugging at some parts, do not know why. If you set break-points, you can get nonsense error messages. However, you can still debug some parts.

<b>> 5. How to use BADI method for validation passing back

> a eror message to calling transaction say COR1

> without raising exception and system message.

> Specifically I wish to use

> IF_EX_WORKORDER_UPDATE~BEFORE_UPDATE for custom

> Validation.</b>

It may prevent you to leave the current screen (especially at before_update methods) for ensuring encapsulation I believe.

Hope this much helps...

*--Serdar

christian_wohlfahrt
Active Contributor
0 Kudos

Hi Jayantha,

I'm also using this BADI and got some experience:

2) At least before_update / in_update don't have access to common data (I tried own class attribute).

3) I'm making some tests in before_update (because of status table) and updating a field in in_update. I forwad my information with EXPORT to shared buffer.

4) Debugging behaves normal - only methods in update tasks are difficult to get, just like any other update task debugging.

Regards,

Christian

Former Member
0 Kudos

Thanks for all the info.

Two important issues remain:

1. WORKORDER_UPDATE BADi would have been far more useful if the sequence if method invocation was "logical". It seems reasonable to call BEFORE_UPDATE before AT_SAVE. Or at least pas IT_ITEM to AT_SAVE!

2. Each method should have exception ERROR_WITH_MESSAGE. AT_SAVE has but BEFORE_UPDATE does not.

Any clarifications why the current design of WORKORDER_UPDATE BAdi is OK would be very enlightening.

Regards & thanks

-jnc

0 Kudos

Hi Jayantha

As stated before, its the SAP developer group who defines the interface and capability of a BAdI and I believe they shoul build the BAdI considering lots of arguments. However, if you still think that somethings may change, you can get in contact with SAP through <a href="http://service.sap.com">OSS</a>.

*--Serdar