13.implementing badi for the transactions vl02 & mm02

Upload: kiranmeesala

Post on 10-Oct-2015

48 views

Category:

Documents


3 download

DESCRIPTION

BADI

TRANSCRIPT

Implementing BADI for the transactions VL02 & MM02By Truptimaya Mishra, Capgemini IndiaIntroduction to BADI1. Based on OOPS concept.2. No access key required.3. All BADIs can be seen in a classCL_EXITHANDLER.Step 1:Run the transactionSE24. Under object type put the class nameCL_EXITHANDLER.Click on display button.

Under this classCL_EXITHANDLERselect the methodGET_INSTANCEand double click.

Under the methodGET_INSTANCEput break point on a function module calledCALL METHOD CL_EXITHANDLER=>GET_CLASS_NAME_BY_INTERFACEStep 2:Then according to the requirement run the transaction. In this example transaction code isVL02.Run the transactionVL02. As in 1ststep we have putted a break point, that function module will give all BADI used by the transaction in each screen and activity on the application(VL02). Under the parameterEXIT_NAMEthis debugger screen will give allBADIname for each screen. Each time press F8, you will get all BADI used for the screen. After that system will go for next screen.BADI NAME: EHS_DG_001LE_SHP_DELIVERY_PROCLE_SHP_PRICINGBADI_LAYERCU_CONFIG_DELEGATION1stscreen of transactionVL02.Step 3:Choose your BADI name and you can see the detail in transactionSE18. Lets take aBADI BADI_LAYER. Click on display button.PressF8to get the details of the corresponding BADI.Here we can get the attribute and interface details of the BADI. As this one is screen BADIsub-screen tab also is there.Step 4:To implement the BADI, we have transactionSE19.To create new BADI to implement the put your BADI name here. If the BADI is an enhancement-point then put the BADI name in optionNEW BADIand if only BADI then put the name inCLASSIC BADI.Give the BADI name and click on create button.Press F8.Again press F8. Give an implementation name. Let it beZTTTTTGive the description and select a suitable method double click to get into the method to put the ABAP code.

To edit an implemented BADI the below portion is used. Click on the change button to edit the BADI.EXAMPLE: To change the description of a material in transaction MM02. Step 1:Run the transactionSE24. Under object type put the class nameCL_EXITHANDLER.Click on display button.Under this classCL_EXITHANDLERselect the methodGET_INSTANCEand double click.Under the methodGET_INSTANCEput break point on a function module calledCALL METHOD CL_EXITHANDLER=>GET_CLASS_NAME_BY_INTERFACE

Step 2:Then according to the requirement run the transaction. In this example transaction code isMM02.Run the transactionMM02. As in 1ststep we have putted a break point, that function module will give all BADI used by the transaction in each screen and activity on the application(MM02). Press F8 to get the BADI used.BADIname before calling the main screen of MM02.BADI_SCREEN_LOGIC_RTW_RETAILSYSTEM_IDENTPress enter to get into the details.BADIname after calling the main screen of MM02.BADI_MATERIAL_OD

Press enter to proceed.

BADI used.BADI_MATERIAL_ODECM_EXITBADI_LAYERGOS_SRV_SELECTBADI_MATERIAL_ODECM_EXITChange the description line and click on SAVE icon.BADI name:BADI_GTIN_VARIANTBADI_MATERIAL_CHECKEHSS_SPEC_CHECKSStep 3:Run the transactionSE18to see the details ofBADI.Click on display button to see the methods declared in that.Choose the method where the material description is defined.Step 4:Run the transactionSE19and create an implementation for the corresponding BADI. Click on create button to create an implementation.Give a name for the implementation.Give the description. Click on save icon and double click on the method chosen.On a double clicking system will provide you the editor to write the code.Code isDATA:WA1 TYPE SHORT_DESC.DATA: WA TYPE SHORT_DESC.WA-MAKTX = 'HELLO'.LOOP AT STEXT INTO WA1.CONCATENATE WA1-MAKTX WA-MAKTX INTO WA1-MAKTX.MODIFY STEXT FROM WA1.ENDLOOP.Note: activate the program and the implementation.