You are on page 1of 2

SAP Note

1119651 - Creating a BAdI macro


Version 1 Validity: 28.11.2007 - active

Language English (Master)

Header Data
Released On
Release Status
Component

28.12.2011 09:47:45
Released for Customer
SCM-APO-FCS-MAC MacroBuilder

Other Components SCM-APO-SNP-MAC MacroBuilder


Priority
Category

Correction with medium priority


Consulting

Symptom
As of SCM 5.0, it is possible to use BAdI macros instead of User Exit macros.
This note explains how to use BAdI macros.

Other Terms
/SAPAPO/SDP94, /SAPAPO/SNP94, /SAPAPO/TS_BATCH_RUN
/SAPAPO/ADVX_MACRO_CALCULATION
Class /SAPAPO/ADVX, method USER_EXIT_MACRO

Reason and Prerequisites


Some functionalities are not available within the standard macros.

Solution
You can create your own implementations of the BAdI /SAPAPO/ADVX,
method USER_EXIT_MACRO.
The BAdI macro is a substitute for the old User Exit(enhancement APODM005)
Caution:
Likewise with User Exit macros, there should be only ONE implementation of this BAdI method, with
different coding based on the macro's internal name (I_ADV_MACROID).
Otherwise all the implementations of the BAdI would be executed and this may give unexpected
results.
Proceed as follows to implement your BAdI Macro:
1. In the macroBuilder, create a macro of type BAdI. Save the macroBook.
2. In transaction SE18, create your BAdI implementation. Here below, as a reminder, steps how to
do this. For further information, please check the online documentation.
a) Display BAdI /SAPAPO/ADVX,
b) Push the <Create BAdI Implementation> button,
c) Next screen, push <create Enhancement Implementation>,
d) Enter the name of the implementation and a short text, then <enter> and <continue> until
the list of Enhancement Implementation is displayed again.
e) Choose the object created above and <Enter>
f) Enter the BAdI implementation name again as well as the description, and a name for the
implementing class.
g) Next screen <create> or <copy> as per your requirement and <save>.
Now you are taken to the BAdI Implementation screen.
h) Double click the implementing class then double click the method
(/SAPAPO/IF_EX_ADVX~USER_EXIT_MACRO) and enter in change mode to create your own code.
H i n t :
You can check the example class /SAPAPO/CL_EX_ADVX_EXAMPLE and its
method /SAPAPO/IF_EX_ADVX~USER_EXIT_MACRO to see how to extract the macro name and then write the
code corresponding to the macro name.

Here below the Method's interface:


*"* components of interface /SAPAPO/IF_EX_ADVX
interface /SAPAPO/IF_EX_ADVX
public .
interfaces IF_BADI_INTERFACE .
methods USER_EXIT_MACRO
importing
I_ADV_LAYOUTtype /SAPAPO/ADV_LAYOUT
I_ADV_VIEWtype /SAPAPO/ADV_VIEW
I_ADV_MACROID type /SAPAPO/MAKRO
I_T_ADV_PLOB_VALUES type /SAPAPO/DM_T_PLOB_VALUES
I_T_LINES type /SAPAPO/MSDP_APP_LINES_TAB
I_T_COLStype /SAPAPO/MSDP_APP_COLS_TAB
I_T_DRILL_PATHtype /SAPAPO/MSDP_DRILL_PATH_TAB
I_T_GROUP_BYtype /SAPAPO/TS_GROUP_BY_TAB
changing
C_T_TAB type /SAPAPO/MSDP_APP_TAB_TAB
C_T_TAB_OLD type /SAPAPO/MSDP_APP_TAB_TAB
C_S_ACTVIEW type /SAPAPO/PB_ACT_VIEW_STR .
endinterface.

Validity
This document is not restricted to a software component or software component version

References
This document refers to:
SAP Notes
539797 Collective consulting note on macros
418801 Creating a user exit macro
412429 Defining jobs with macros

This document is referenced by:


SAP Notes (3)
418801 Creating a user exit macro
412429 Defining jobs with macros
539797 Collective consulting note on macros

You might also like