Sie sind auf Seite 1von 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 Web
Dynpro Enhancement
Applies to:
Enterprise portal, ECC 6.0, Web Dynpro ABAP. For more information, visit the Web Dynpro ABAP
homepage
Summary
The article proposes a practical solution which uses the Webdynpro ABAP-based applications of Travel
Management for processing business trips and expenses as a replacement to the Webdynpro Java-based
applications in Travel Management. The solution uses ABAP Webdynpro as a Platform for the User Interface
to build the portal screen, pull the database and construct the business logic. The business objects which
cater under the solution are: Standard Field Label changes in the portal (field label not to be changed in
backend) 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 WD
ABAP , BADI Implementation , Reports and Adobe Forms.
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

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 the
backend 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.



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 the
Enhance icon on the menu. And select the appropriate enhancement.




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 customized
screen elements.
Example: It was required to change label Location on PTK33-ERPLC to Airport Origin Code for expense
type Air, City/State for expense type Hotel and From/To for expense type Taxi. And limit input field
Location to 3 char only for expense type Air and for rest expense type it should be as it is. These changes
should 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 text
Airport Origin Code, second one having City/State ,third having From/To and last one having same text
as 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.
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 property
as 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 method
UI_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.
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 of
removed standard label visibility and all other label invisible. And accordingly we are setting the visibility and
state 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.
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 method
WDDOBEFOREACTION and WDDOMODIFYVIEW using Overwrite-exit.
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 is
restricted to 3 characters.

When Expense type is Taxi , Location field label changed to From/To and no restriction to input field.
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.

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 the Web Dynpro ABAP homepage
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 12
Disclaimer and Liability Notice
This document may discuss sample coding or other information that does not include SAP official interfaces and therefore is not
supported 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 or
code sample, including any liability resulting from incompatibility between the content within this document and the materials and
services offered by SAP. You agree that you will not hold, or seek to hold, SAP responsible or liable with respect to the content of this
document.