adding explicit enhancement to custom program

10
Search Home Trainings Quiz Tips Tutorials Functional Cert Q's Interview Q's Jobs Testimonials Advertise Contact Us SAP Virtual/Onsite Trainings Document Categories: ABAP TM Adobe Forms ABAPHR ALE & IDocs ALV BAPI BASIS BSP Business Objects Business Workflow CRM NEW LSMW SAP Script/Smart Forms BI/BW eXchange Infrastructure (XI) Enterprise Portals (EP) eCATT Object Oriented Programming SAP Query Userexits/BADIs WebDynpro for Java/ABAP TM Others What's New? ABAP Test Cockpit HOT SAP ABAP Pragmas Understanding SE32 (ABAP Text Element Maintenance) Creating an IDoc File on SAP Application Server Understanding “Advance with dialog” option of SAP Workflow SAP Workflow Scenario: Maintenance Notification Approval Enhancements to a standard class Working with Floating Field in Adobe Forms Inserting data from Internal Table into the step “Send Mail” Display GL Account long text using enhancement framework Differences between polymorphism in JAVA and ABAP Passing multiline parameters from an ABAP Class event to a Workflow container Concept of Reevaluate agents for active work items in SAP Workflow Dynamic creation of component usage in ABAP WebDynpro Adobe Forms: Display symbols like copyright and others Deactivate Hold functionality in Purchase order (ME21N) Quiz on OOABAP Add fields in FBL5N using BADIs Tutorial on Wide casting Defining a Range in Module Pool Program Copy fields from one structure/table into another structure/table Side Panel Usage in NWBC Contribute? Sample Specs What's Hot? Web Dynpro for ABAP Tutorials Join the Mailing List Enter name and email address below: Adding Explicit Enhancement to custom program By Rohit Ranka, StraVis IT Solutions Introduction: Enhancement Framework is the new paradigm to bring all enhancement techniques under one roof. It can also be switched using Switch Framework. The following are different enhancement technologies available under this framework. • Source Code Enhancement • Function Group Enhancement • Class Enhancement • KernelBADI Enhancement Source Code enhancement Whenever enhancement needs to be incorporated directly into the ABAP source code, this technology shall be provided. Implementing this technology is also called as Source Code PlugIn. There are two types of Source Code enhancements possible. Implicit enhancement option Explicit enhancement option Explicit enhancement option As implicit enhancements are predefined enhancements provided by SAP in the source code, the explicit enhancements can be implemented by the customers or partners. There are two types of Explicit Enhancement options available. For this, we now have two new ABAP statements, viz. 1. Enhancement point (Syntax ENHANCEMENTPOINT) 2. Enhancement section (Syntax ENHANCEMENTSECTION) Enhancement section is used to replace a set of code or statements with the customer (custom code). In this technique the original source code does not get executed but, the customer implementation (custom code) gets executed. Note Explicit enhancements though can be placed anywhere in the source code but, not just anywhere except some areas where SAP would allow (program allows). STEP 1: Create a package in transaction SE80 (Object navigator) Name YDEV Start a Nursery School Start Earning From First Month. Low Investment and High Returns. JEE Main Ran Pred Use ou Mains Predic 2015 a Know You S

Upload: sandeep-dattaraju

Post on 16-Sep-2015

15 views

Category:

Documents


0 download

DESCRIPTION

Adding Explicit Enhancement to Custom Program

TRANSCRIPT

  • 6/12/2015 AddingExplicitEnhancementtocustomprogram

    http://saptechnical.com/Tutorials/ExitsBADIs/Explicit/Index.htm 1/3

    Search

    Home Trainings Quiz Tips Tutorials Functional CertQ's InterviewQ's Jobs Testimonials Advertise ContactUs

    SAP Virtual/OnsiteTrainings

    Document Categories:

    ABAPTMAdobeFormsABAPHRALE&IDocsALVBAPIBASISBSPBusinessObjectsBusinessWorkflowCRMNEWLSMWSAPScript/SmartFormsBI/BWeXchangeInfrastructure(XI)EnterprisePortals(EP)eCATTObjectOrientedProgrammingSAPQueryUserexits/BADIsWebDynproforJava/ABAPTMOthers

    What's New?

    ABAPTestCockpitHOTSAPABAPPragmasUnderstandingSE32(ABAPTextElementMaintenance)CreatinganIDocFileonSAPApplicationServerUnderstandingAdvancewithdialogoptionofSAPWorkflowSAPWorkflowScenario:MaintenanceNotificationApprovalEnhancementstoastandardclassWorkingwithFloatingFieldinAdobeFormsInsertingdatafromInternalTableintothestepSendMailDisplayGLAccountlongtextusingenhancementframeworkDifferencesbetweenpolymorphisminJAVAandABAPPassingmultilineparametersfromanABAPClasseventtoaWorkflowcontainerConceptofReevaluateagentsforactiveworkitemsinSAPWorkflowDynamiccreationofcomponentusageinABAPWebDynproAdobeForms:DisplaysymbolslikecopyrightandothersDeactivateHoldfunctionalityinPurchaseorder(ME21N)QuizonOOABAPAddfieldsinFBL5NusingBADIsTutorialonWidecastingDefiningaRangeinModulePoolProgramCopyfieldsfromonestructure/tableintoanotherstructure/tableSidePanelUsageinNWBC

    Contribute?

    Sample Specs

    What's Hot?

    WebDynproforABAPTutorials

    JointheMailingList

    Enternameandemailaddressbelow:

    Adding Explicit Enhancement to custom programByRohitRanka,StraVisITSolutions

    Introduction:

    EnhancementFramework is the new paradigm to bring all enhancement techniques under one roof. It can also beswitched using Switch Framework. The following are different enhancement technologies available under thisframework.

    SourceCodeEnhancement

    FunctionGroupEnhancement

    ClassEnhancement

    KernelBADIEnhancement

    SourceCodeenhancement

    Whenever enhancement needs to be incorporated directly into the ABAP source code, this technology shall beprovided. Implementing this technology is also calledasSourceCodePlugIn.There are two types ofSourceCodeenhancementspossible.

    Implicitenhancementoption

    Explicitenhancementoption

    Explicitenhancementoption

    As implicit enhancements are predefined enhancements provided by SAP in the source code, the explicitenhancementscanbeimplementedbythecustomersorpartners.

    TherearetwotypesofExplicitEnhancementoptionsavailable.Forthis,wenowhavetwonewABAPstatements,viz.

    1.Enhancementpoint(SyntaxENHANCEMENTPOINT)2.Enhancementsection(SyntaxENHANCEMENTSECTION)

    Enhancementsectionisusedtoreplaceasetofcodeorstatementswiththecustomer(customcode).Inthistechniquetheoriginalsourcecodedoesnotgetexecutedbut,thecustomerimplementation(customcode)getsexecuted.

    NoteExplicitenhancementsthoughcanbeplacedanywhereinthesourcecodebut,not justanywhereexceptsomeareaswhereSAPwouldallow(programallows).

    STEP1:CreateapackageintransactionSE80(Objectnavigator)NameYDEV

    StartaNurserySchool

    StartEarningFromFirstMonth.LowInvestmentandHigh

    Returns.

    JEEMainsRankPredictorUseourJEEMainsRankPredictor2015andKnowWhereYouStand.

  • 6/12/2015 AddingExplicitEnhancementtocustomprogram

    http://saptechnical.com/Tutorials/ExitsBADIs/Explicit/Index.htm 2/3

    Name:

    Email:

    Subscribe UnsubscribeGO

    STEP2:Navigateto'Enhancements'folderofyourpackage.Package(YDEV)Enhancement.

    Rightclickthe'Enhancements''Create''EnhancementSpot'.

    Fillinthedetailsinthe'CreateEnhancementSpot'dialog.

    Andsaveitintocreatedpackage.Observetheenhancementspotcreatedunderthe'EnhancementSpots'folder.

    STEP3:'RightClick'thespotcreatedand'Implement'it(CreateanImplementation).

  • 6/12/2015 AddingExplicitEnhancementtocustomprogram

    http://saptechnical.com/Tutorials/ExitsBADIs/Explicit/Index.htm 3/3

    Fillinallthedetailsinthe'CreateEnhancementImplementation'dialog.

    STEP4:Now,weneedto'Activate'theenhancementspot.InadditionwiththeEnhancementspotthe'EnhancementImplementation'willgetactivated.

    Clickheretocontinue...

    Pleasesendusyourfeedback/[email protected]

    HomeContributeAboutUsPrivacyTermsOfUseDisclaimerSafeCompanies:AdvertiseonSAPTechnical.COM|PostJobContactUs

    SAPTechnical.COM.Allrightsreserved.Allproductnamesaretrademarksoftheirrespectivecompanies.SAPTechnical.COMisinnowayaffiliatedwithSAPAG.

    SAP,SAPR/3,R/3software,mySAP,ABAP,BAPI,xApps,SAPNetWeaver,andandanyotherSAPtrademarksareregisteredtrademarksofSAPAGinGermanyandinseveralothercountries.Everyeffortismadetoensurecontentintegrity.Useinformationonthissiteatyourownrisk.

    GraphicDesignbyRoundtheBendWizards

    LimitedElectronicsSale

    ElectriyingOffersUpto50%Off.WideRangeOfProducts.

    ShopToday!

  • 6/12/2015 AddingExplicitEnhancementtocustomprogram

    http://saptechnical.com/Tutorials/ExitsBADIs/Explicit/Page2.htm 1/3

    Search

    Home Trainings Quiz Tips Tutorials Functional CertQ's InterviewQ's Jobs Testimonials Advertise ContactUs

    SAP Virtual/OnsiteTrainings

    Document Categories:

    ABAPTMAdobeFormsABAPHRALE&IDocsALVBAPIBASISBSPBusinessObjectsBusinessWorkflowCRMNEWLSMWSAPScript/SmartFormsBI/BWeXchangeInfrastructure(XI)EnterprisePortals(EP)eCATTObjectOrientedProgrammingSAPQueryUserexits/BADIsWebDynproforJava/ABAPTMOthers

    What's New?

    ABAPTestCockpitHOTSAPABAPPragmasUnderstandingSE32(ABAPTextElementMaintenance)CreatinganIDocFileonSAPApplicationServerUnderstandingAdvancewithdialogoptionofSAPWorkflowSAPWorkflowScenario:MaintenanceNotificationApprovalEnhancementstoastandardclassWorkingwithFloatingFieldinAdobeFormsInsertingdatafromInternalTableintothestepSendMailDisplayGLAccountlongtextusingenhancementframeworkDifferencesbetweenpolymorphisminJAVAandABAPPassingmultilineparametersfromanABAPClasseventtoaWorkflowcontainerConceptofReevaluateagentsforactiveworkitemsinSAPWorkflowDynamiccreationofcomponentusageinABAPWebDynproAdobeForms:DisplaysymbolslikecopyrightandothersDeactivateHoldfunctionalityinPurchaseorder(ME21N)QuizonOOABAPAddfieldsinFBL5NusingBADIsTutorialonWidecastingDefiningaRangeinModulePoolProgramCopyfieldsfromonestructure/tableintoanotherstructure/tableSidePanelUsageinNWBC

    Contribute?

    Sample Specs

    What's Hot?

    WebDynproforABAPTutorials

    JointheMailingList

    Enternameandemailaddressbelow:

    Adding Explicit Enhancement to custom program...Previous

    STEP 5: Here we are applying enhancements to a CUSTOM program not a standard program to demonstrate thefunctionality. So we create a simple program 'YDEV_CODE' (say) it is retrieving records from the database table'VBAK'(SalesDocumentHeader)anddisplayingafewrecords.

    Now, if thecustomerwants to replace thesetof logicwithhisown logic (say) like retrieving records fromdatabasetable'VBAP'(SalesDocumentItem)andthendisplayafewrecords,he/shewillcreateanenhancementsectionwhichgoeslike,

    CreateaprogramYDEV_CODE.

    OUTPUT

    TrainingMaterialsCustomizabletrainingmaterialstoteachsoftskillsworkshops.

    1YearOnlineMBARs.7500nibmglobal.com/OnlineMBA

    100%1YearOnlineMBA.Approved&AccreditedByIAO&AACBE.JoinNow

    TopMNCVacanciesmonsterindia.com

    FindtheRightJobwithMonster.SubmitCVtoApply&GetHired!

    BareBonesDynamicsAXdynamicsaxcompanions.com

    EverythingyouneedtosetupDynamicsAX2012fromscratch

    OnlineMongoDBTrainingeasylearning.guru/MongoDBTraining

    27+hrsofMongoDBOnlineTraining.RegisterForLiveDemoClasses.

    GetFreeMobileRechargemysmartprice.com

    FreeRs.20MobileRechargeVoucher.AddMySmartPriceChromeExtension

  • 6/12/2015 AddingExplicitEnhancementtocustomprogram

    http://saptechnical.com/Tutorials/ExitsBADIs/Explicit/Page2.htm 2/3

    Name:

    Email:

    Subscribe UnsubscribeGO

    STEP6:Rightclicktheareawhichisappropriatetoapplytheenhancement

    NoteExplicitenhancementsthoughcanbeplacedanywhereinthesourcecodebut,notjustanywhereexceptsomeareaswhereSAPwouldallow(programallows).

    Now, in the 'CreateEnhancementOption' fill in thedetails,herefill thenameunder 'Enhancementsection'only.ThenfillintheEnhancementSpotImplementationNamewhichwecreatedearlier.

  • 6/12/2015 AddingExplicitEnhancementtocustomprogram

    http://saptechnical.com/Tutorials/ExitsBADIs/Explicit/Page2.htm 3/3

    NowweareabletoseeprogramlineshaveEnhancementSectionEndEnhancementSection.

    Note Make sure that the code which has to be replaced is within the 'ENHANCEMENTSECTION...' and 'ENDENHANCEMENTSECTION'.

    Clickheretocontinue..

    Pleasesendusyourfeedback/[email protected]

    HomeContributeAboutUsPrivacyTermsOfUseDisclaimerSafeCompanies:AdvertiseonSAPTechnical.COM|PostJobContactUs

    SAPTechnical.COM.Allrightsreserved.Allproductnamesaretrademarksoftheirrespectivecompanies.SAPTechnical.COMisinnowayaffiliatedwithSAPAG.

    SAP,SAPR/3,R/3software,mySAP,ABAP,BAPI,xApps,SAPNetWeaver,andandanyotherSAPtrademarksareregisteredtrademarksofSAPAGinGermanyandinseveralothercountries.Everyeffortismadetoensurecontentintegrity.Useinformationonthissiteatyourownrisk.

    GraphicDesignbyRoundtheBendWizards

    Mobile&TabDhamakaSale

    ElectriyingOffersUpto55%OffOnHandsets&Accessories.

    ShopToday!

  • 6/12/2015 AddingExplicitEnhancementtocustomprogram

    http://saptechnical.com/Tutorials/ExitsBADIs/Explicit/Page3.htm 1/4

    Search

    Home Trainings Quiz Tips Tutorials Functional CertQ's InterviewQ's Jobs Testimonials Advertise ContactUs

    SAP Virtual/OnsiteTrainings

    Document Categories:

    ABAPTMAdobeFormsABAPHRALE&IDocsALVBAPIBASISBSPBusinessObjectsBusinessWorkflowCRMNEWLSMWSAPScript/SmartFormsBI/BWeXchangeInfrastructure(XI)EnterprisePortals(EP)eCATTObjectOrientedProgrammingSAPQueryUserexits/BADIsWebDynproforJava/ABAPTMOthers

    What's New?

    ABAPTestCockpitHOTSAPABAPPragmasUnderstandingSE32(ABAPTextElementMaintenance)CreatinganIDocFileonSAPApplicationServerUnderstandingAdvancewithdialogoptionofSAPWorkflowSAPWorkflowScenario:MaintenanceNotificationApprovalEnhancementstoastandardclassWorkingwithFloatingFieldinAdobeFormsInsertingdatafromInternalTableintothestepSendMailDisplayGLAccountlongtextusingenhancementframeworkDifferencesbetweenpolymorphisminJAVAandABAPPassingmultilineparametersfromanABAPClasseventtoaWorkflowcontainerConceptofReevaluateagentsforactiveworkitemsinSAPWorkflowDynamiccreationofcomponentusageinABAPWebDynproAdobeForms:DisplaysymbolslikecopyrightandothersDeactivateHoldfunctionalityinPurchaseorder(ME21N)QuizonOOABAPAddfieldsinFBL5NusingBADIsTutorialonWidecastingDefiningaRangeinModulePoolProgramCopyfieldsfromonestructure/tableintoanotherstructure/tableSidePanelUsageinNWBC

    Contribute?

    Sample Specs

    What's Hot?

    WebDynproforABAPTutorials

    JointheMailingList

    Enternameandemailaddressbelow:

    Adding Explicit Enhancement to custom program...Previous

    STEP7:Nowtoincludethecustomcodeintheprogramwhichwillreplacetheoriginalcode,enablethe'EnhancementMode'byclickingonthe'Spiral'button.

    Place the cursor on the 'Enhancementsection' and navigate to 'Edit' 'Enhancement Operations' 'CreateImplementation'.

    Fill in the details for the 'Create Enhancement Implementation' dialog. Click on 'Create' button for the 'Select orCreateEnhancementImplementation'dialog.

    LimitedElectronicsSaleshopclues.com/Electronic_Deal

    ElectriyingOffersUpto50%Off.WideRangeOfProducts.ShopToday!

    Call/SMSBasedFeaturesknowlarity.com/Appdevelopment

    EnableCall/SMSBasedFeaturesCustomSolutionsforAndroid/iOS

    TrainingMaterialsCustomizabletrainingmaterialstoteachsoftskillsworkshops.

  • 6/12/2015 AddingExplicitEnhancementtocustomprogram

    http://saptechnical.com/Tutorials/ExitsBADIs/Explicit/Page3.htm 2/4

    Name:

    Email:

    Subscribe UnsubscribeGO

    STEP 8: Now, write the code within the 'ENHANCEMENT' and 'ENDENHANCEMENT' statements as thereplacementcode.

    STEP9: Don't forget to 'Activate' the enhancement Switch the 'Enhancement' modeOFF and 'Activate' theentireprogram.

    STEP10:Executethetransaction/programtofindoutthedifference.

    BeforeEnhancement:

  • 6/12/2015 AddingExplicitEnhancementtocustomprogram

    http://saptechnical.com/Tutorials/ExitsBADIs/Explicit/Page3.htm 3/4

    AfterEnhancement:

    Summary:

    1. Here we deals with the enhancement of a 'Z' program it is possible to 'CREATE' an 'ENHANCEMENTSECTION'. But, in case of a 'STANDARD SAP' program there are certain places (provided by SAP) like'ENHANCEMENTPOINT...'and'ENHANCEMENTSECTION...'wherewecancreateimplementationsbasedoncustomersbusinessfunctionality.

    2.Therecanbeonlyoneandonlyone'ACTIVE'implementationforan'ENHANCEMENTSECTION'.

    SourceCode:

    *&**&ReportYDEV_CODE*&*&**&*&*&*

    REPORTYDEV_CODE.TABLES:VBAK,VBAP.DATA:IT_VBAKTYPESTANDARDTABLEOFVBAKINITIALSIZE0,WA_VBAKTYPEVBAK,IT_VBAPTYPESTANDARDTABLEOFVBAPINITIALSIZE0,WA_VBAPTYPEVBAP.

    INITIALIZATION.REFRESH:IT_VBAK,IT_VBAP.CLEAR:WA_VBAK,WA_VBAP.

    STARTOFSELECTION.ENHANCEMENTSECTIONYDEV_ENHANCE_SECTIONSPOTSYDEV_IMPLEMENT_SPOT.SELECT*FROMVBAPINTOTABLEIT_VBAP[]UPTO15ROWS.

    WRITE:/02'SalesDocument',20'Date',

  • 6/12/2015 AddingExplicitEnhancementtocustomprogram

    http://saptechnical.com/Tutorials/ExitsBADIs/Explicit/Page3.htm 4/4

    40'Time',65'NameofPerson'.ULINE.IFIT_VBAP[]ISNOTINITIAL.LOOPATIT_VBAPINTOWA_VBAP.WRITE:/02WA_VBAPVBELN,20WA_VBAPPOSNR,40WA_VBAPMATNR,65WA_VBAPMATWA.ENDLOOP.ENDIF.ENDENHANCEMENTSECTION.*$*$Start:YDEV_ENHANCE_SECTION$*$*ENHANCEMENT1YDEV_IMPLEMENT_ENHC_SECTION."activeversionSELECT*FROMVBAPINTOTABLEIT_VBAP[]UPTO10ROWS.

    WRITE:/02'SalesDocument',20'SalesItem',40'MaterialNumber',65'Materialentered'.ULINE.IFIT_VBAP[]ISNOTINITIAL.LOOPATIT_VBAPINTOWA_VBAP.WRITE:/02WA_VBAPVBELN,20WA_VBAPPOSNR,40WA_VBAPMATNR,65WA_VBAPMATWA.ENDLOOP.ENDIF.ENDENHANCEMENT.*$*$End:YDEV_ENHANCE_SECTION$*$*

    Pleasesendusyourfeedback/[email protected]

    HomeContributeAboutUsPrivacyTermsOfUseDisclaimerSafeCompanies:AdvertiseonSAPTechnical.COM|PostJobContactUs

    SAPTechnical.COM.Allrightsreserved.Allproductnamesaretrademarksoftheirrespectivecompanies.SAPTechnical.COMisinnowayaffiliatedwithSAPAG.

    SAP,SAPR/3,R/3software,mySAP,ABAP,BAPI,xApps,SAPNetWeaver,andandanyotherSAPtrademarksareregisteredtrademarksofSAPAGinGermanyandinseveralothercountries.Everyeffortismadetoensurecontentintegrity.Useinformationonthissiteatyourownrisk.

    GraphicDesignbyRoundtheBendWizards

    TopMNCVacancies

    FindtheRightJobwithMonster.SubmitCVtoApply&GetHired!

    Adding Explicit Enhancement to custom program-part1Adding Explicit Enhancement to custom program-part2Adding Explicit Enhancement to custom program-part3