Travel Management Web Dynpro ABAP Enhancement

Embed Size (px)

Citation preview

  • 8/10/2019 Travel Management Web Dynpro ABAP Enhancement

    1/12

    SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX -bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

    2010 SAP AG 1

    Travel Management ABAP WebDynpro Enhancement

    Applies to:

    Enterprise portal, ECC 6.0, Web Dynpro ABAP. For more information, visit theWeb Dynpro ABAPhomepage

    Summary

    The article proposes a practical solution which uses the Webdynpro ABAP-based applications of TravelManagement for processing business trips and expenses as a replacement to the Webdynpro Java-basedapplications in Travel Management. The solution uses ABAP Webdynpro as a Platform for the User Interfaceto build the portal screen, pull the database and construct the business logic. The business objects whichcater under the solution are: Standard Field Label changes in the portal (field label not to be changed inbackend) and limiting the length of standard input field in the portal (field length not to be changed in

    backend).

    Authors: Anshul Kaistha and Tarun Kumar Rai

    Company: HCL-AXON

    Created on:20 December 2010

    Author Bio

    Anshul Kaistha is working in HCL-AXON, India from past one year. He is working on WD ABAP ,Module pool , Reports and Adobe Forms.

    Tarun Kumar Rai is working in HCL-AXON, India from past one year. He is working on WDABAP , BADI Implementation , Reports and Adobe Forms.

    http://www.sdn.sap.com/irj/sdn/nw-wdabaphttp://www.sdn.sap.com/irj/sdn/nw-wdabaphttp://www.sdn.sap.com/irj/sdn/nw-wdabaphttp://www.sdn.sap.com/irj/sdn/nw-wdabaphttp://www.sdn.sap.com/irj/sdn/nw-wdabaphttp://www.sdn.sap.com/irj/sdn/nw-wdabap
  • 8/10/2019 Travel Management Web Dynpro ABAP Enhancement

    2/12

    Travel Management ABAP Web Dynpro Enhancement

    SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX -bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

    2010 SAP AG 2

    Table of Contents

    Objective ............................................................................................................................................................. 3

    Creating Enhancement ....................................................................................................................................... 3

    UI Element Enhancement ................................................................................................................................... 5

    Field label Changes: ....................................................................................................................................... 5

    Limiting the input field length .......................................................................................................................... 6

    Standard Method Enhancement ......................................................................................................................... 8

    Screenshots of Application ................................................................................................................................. 9

    Related Content ................................................................................................................................................ 11

    Disclaimer and Liability Notice .......................................................................................................................... 12

  • 8/10/2019 Travel Management Web Dynpro ABAP Enhancement

    3/12

    Travel Management ABAP Web Dynpro Enhancement

    SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX -bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

    2010 SAP AG 3

    Objective

    The objective of the solution is to change field labels and limit field length only in the portal keeping thebackend unchanged. The functionalities used for the solution are:

    Enhancement implementation to enhance standard WD UI elements.

    Enhancement implementation to enhance standard methods in views/components.

    Creating Enhancement

    Enhancement is created by clicking the spiral button in Webdynpro Explorer

    Give the name of Enhancement Implementation and press Enter .Enhancement will be implemented.

  • 8/10/2019 Travel Management Web Dynpro ABAP Enhancement

    4/12

    Travel Management ABAP Web Dynpro Enhancement

    SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX -bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

    2010 SAP AG 4

    Now whenever we need to make changes as enhancement in this WD Component. Just click on theEnhance icon on the menu. And select the appropriate enhancement.

  • 8/10/2019 Travel Management Web Dynpro ABAP Enhancement

    5/12

    Travel Management ABAP Web Dynpro Enhancement

    SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX -bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

    2010 SAP AG 5

    UI Element Enhancement

    The layout editor only allow us to remove the standard screen elements and insert our own customizedscreen elements.

    Example: It was required to change label Location on PTK33-ERPLC to Airport Origin Code for expensetype Air, City/State for expense type Hotel and From/To for expense type Taxi. And limit input fieldLocation to 3 char only for expense type Air and for rest expense type it should be as it is. These changesshould be made only in the portal not in backend.

    Field label Changes:

    We removed the standard field label LOCATION and inserted 4 customized field label .One having textAirport Origin Code, second one having City/State ,third having From/To and last one having same textas of standard .

    Cross mark will appear against the removed UI element.

    Note: The removed UI element can be recovered by right clicking on UI element and selecting undo deletion option.

  • 8/10/2019 Travel Management Web Dynpro ABAP Enhancement

    6/12

    Travel Management ABAP Web Dynpro Enhancement

    SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX -bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

    2010 SAP AG 6

    Limiting the input field length

    We removed the standard input field and inserted our two customized input field .One having same propertyas of standard input field and other bind to attribute of type char 3.

    And here visibility and state of customized Screen elements is set by enhancing methodUI_APPLY_FIELD_CONTROL of class CL_FITV_WD_UTIL.

    Here we are capturing the customized element from the view.

    And then setting there visibility and state accordingly.

  • 8/10/2019 Travel Management Web Dynpro ABAP Enhancement

    7/12

    Travel Management ABAP Web Dynpro Enhancement

    SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX -bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

    2010 SAP AG 7

    Like here for expense type Taxi, we are setting the visibility of label containing text From/To same as ofremoved standard label visibility and all other label invisible. And accordingly we are setting the visibility andstate of input field.

    Till now we had only set the visibility of our customized input field which is bind to customized attribute. But

    still we have not passed the value to the standard attribute. This is done by enhancing the standard method.

  • 8/10/2019 Travel Management Web Dynpro ABAP Enhancement

    8/12

    Travel Management ABAP Web Dynpro Enhancement

    SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX -bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

    2010 SAP AG 8

    Standard Method Enhancement

    Standard method can be enhanced by writing the code in Pre-exit, Post-exit or Overwrite-exit.

    Pre-exit:- This method runs before the corresponding Standard method.

    Post-exit:- This method runs after the corresponding Standard method.

    Overwrite-exit: - This method overwrites the corresponding Standard method i.e. if we create overwrite exit,then the corresponding Standard method will not be executed and instead of it overwrite-exit method will be

    executed.

    To create any of these Exit, click the corresponding icon.

    Here Overwrite-exit of WDDOBEFOREACTION and WDDOMODIFYVIEW are created.

    For passing value of customized attribute to standard attribute we are overwriting methodWDDOBEFOREACTION and WDDOMODIFYVIEW using Overwrite-exit.

  • 8/10/2019 Travel Management Web Dynpro ABAP Enhancement

    9/12

    Travel Management ABAP Web Dynpro Enhancement

    SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX -bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

    2010 SAP AG 9

    Here we are reading the customized attribute and then passing its value to the standard attribute.

    Screenshots of Application

    When Expense type is Airfare,Location field label changed to Airport Origin Code and input field isrestricted to 3 characters.

    When Expense type is Taxi , Location field label changed to From/To and no restriction to input field.

  • 8/10/2019 Travel Management Web Dynpro ABAP Enhancement

    10/12

    Travel Management ABAP Web Dynpro Enhancement

    SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX -bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

    2010 SAP AG 10

    When Expense type is Hotel , Location field label changed to City/State and no restriction to input field.

  • 8/10/2019 Travel Management Web Dynpro ABAP Enhancement

    11/12

    Travel Management ABAP Web Dynpro Enhancement

    SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX -bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

    2010 SAP AG 11

    Related Content

    Modification-Free Enhancements

    For more information, visit theWeb Dynpro ABAP homepage

    http://help.sap.com/saphelp_nw04s/helpdata/en/c5/f4b9422e0fb911e10000000a1550b0/content.htmhttp://www.sdn.sap.com/irj/sdn/nw-wdabaphttp://www.sdn.sap.com/irj/sdn/nw-wdabaphttp://www.sdn.sap.com/irj/sdn/nw-wdabaphttp://www.sdn.sap.com/irj/sdn/nw-wdabaphttp://help.sap.com/saphelp_nw04s/helpdata/en/c5/f4b9422e0fb911e10000000a1550b0/content.htm
  • 8/10/2019 Travel Management Web Dynpro ABAP Enhancement

    12/12

    Travel Management ABAP Web Dynpro Enhancement

    SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX -bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

    Disclaimer and Liability Notice

    This document may discuss sample coding or other information that does not include SAP official interfaces and therefore is notsupported by SAP. Changes made based on this information are not supported and can be overwritten during an upgrade.

    SAP will not be held liable for any damages caused by using or misusing the information, code or methods suggested in this document,and anyone using these methods does so at his/her own risk.

    SAP offers no guarantees and assumes no responsibility or liability of any type with respect to the content of this technical article orcode sample, including any liability resulting from incompatibility between the content within this document and the materials andservices offered by SAP. You agree that you will not hold, or seek to hold, SAP responsible or liable with respect to the content of thisdocument.