Top Banner
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com © 2009 SAP AG 1 Customizing F4 Help in Web Dynpro ABAP Using OVS Applies to: All Web Dynpro ABAP Technical Consultants. For more information, visit the ABAP homepage . Summary This document helps to create customized value help using OVS. Author: Sudarsan Dande Company: L & T Infotech Created on: 4 December 2009 Author Bio Sudarsan Dande is working with L & T Infotech as a Web Dynpro ABAP Consultant in Chennai. He is currently working E-Rec project using Web Dynpro ABAP. He has worked under various ABAP functionalities. His hobbies include playing cricket, watching TV.
24

Customizing F4 Help in Web Dynpro ABAP Using OVS

Oct 30, 2014

Download

Documents

mausumip

Customizing F4 Help in Web Dynpro ABAP Using OVS
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Customizing F4 Help in Web Dynpro ABAP Using OVS

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

© 2009 SAP AG 1

Customizing F4 Help in Web

Dynpro ABAP Using OVS

Applies to:

All Web Dynpro ABAP Technical Consultants. For more information, visit the ABAP homepage.

Summary

This document helps to create customized value help using OVS.

Author: Sudarsan Dande

Company: L & T Infotech

Created on: 4 December 2009

Author Bio

Sudarsan Dande is working with L & T Infotech as a Web Dynpro ABAP Consultant in Chennai. He is currently working E-Rec project using Web Dynpro ABAP. He has worked under various ABAP functionalities. His hobbies include playing cricket, watching TV.

Page 2: Customizing F4 Help in Web Dynpro ABAP Using OVS

Customizing F4 Help in Web Dynpro ABAP Using OVS

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

© 2009 SAP AG 2

Table of Contents

Purpose of the Document ................................................................................................................................... 3

Step by Step Procedure ...................................................................................................................................... 3

OVS help in Web Dynpro ABAP ..................................................................................................................... 3 WDDOINIT Method .................................................................................................................................................... 19

ON_OVSSEL Event Handler ...................................................................................................................................... 20

DO_OVS_APPSRC Method ...................................................................................................................................... 21

DO_OVS_APPSRCTYP Method ............................................................................................................................... 22

Related Content ................................................................................................................................................ 23

Disclaimer and Liability Notice .......................................................................................................................... 24

Page 3: Customizing F4 Help in Web Dynpro ABAP Using OVS

Customizing F4 Help in Web Dynpro ABAP Using OVS

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

© 2009 SAP AG 3

Purpose of the Document

This document helps in creating customized F4 help using ADD_SELECTION_FIELD method which involves OVS help. It provides step by step approach starting from the creation of Web Dynpro component to the Web Dynpro application execution with necessary screen shots which are useful for making your understanding much stronger. It also includes appropriate code inserted as a text file which needs to be implemented in appropriate methods for the successful creation of customized F4 help.

Step by Step Procedure

The following procedure consists all the steps for customized F4 help.

OVS help in Web Dynpro ABAP

Creating a Web Dynpro component:

a) Go to SE80 and see the screen shot below for your reference.

Page 4: Customizing F4 Help in Web Dynpro ABAP Using OVS

Customizing F4 Help in Web Dynpro ABAP Using OVS

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

© 2009 SAP AG 4

b) Enter a name for the Web Dynpro component and click on ‘Enter’ button, then the following pop up

appears.

c) Click on ‘Yes’ button. Enter the description for the component and provide window name and view

name. See the below screen shot

d) Click on ‘OK’ button and save as local object as shown below

Page 5: Customizing F4 Help in Web Dynpro ABAP Using OVS

Customizing F4 Help in Web Dynpro ABAP Using OVS

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

© 2009 SAP AG 5

e) Double click on component ‘ZOVSHELP’ and provide used components for the select options. Refer

the screen shot below.

f) ‘SAVE’ the component. Expand the views and double click on the ‘INPUTVIEW’ and click on the

‘LAYOUT’ tab

Page 6: Customizing F4 Help in Web Dynpro ABAP Using OVS

Customizing F4 Help in Web Dynpro ABAP Using OVS

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

© 2009 SAP AG 6

g) Click on ‘Insert Element’ and provide the details as below and click on ‘OK’

h) Enter the text for the Caption as ‘Value Help’ as shown below

i) Insert the Group in the input view by following the above procedure as shown below

Page 7: Customizing F4 Help in Web Dynpro ABAP Using OVS

Customizing F4 Help in Web Dynpro ABAP Using OVS

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

© 2009 SAP AG 7

j) Provide the text as ‘Select Options’ as shown below

k) Insert the View Container UI Element as shown below

Page 8: Customizing F4 Help in Web Dynpro ABAP Using OVS

Customizing F4 Help in Web Dynpro ABAP Using OVS

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

© 2009 SAP AG 8

l) Now click on the ‘Properties’ tab of the INPUTVIEW and create controller usages for the select

options as shown below

Page 9: Customizing F4 Help in Web Dynpro ABAP Using OVS

Customizing F4 Help in Web Dynpro ABAP Using OVS

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

© 2009 SAP AG 9

m) Click on the ‘Attributes’ tab of the INPUTVIEW and provide the following attributes as below

Page 10: Customizing F4 Help in Web Dynpro ABAP Using OVS

Customizing F4 Help in Web Dynpro ABAP Using OVS

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

© 2009 SAP AG 10

n) Click on ‘Methods’ tab of the INPUTVIEW , provide a ‘ON_OVSSEL’ event handler,

‘DO_OVS_APPSRC’ method, ‘DO_OVS_APPSRCTYP’ method and refer the following screen

shots below

Page 11: Customizing F4 Help in Web Dynpro ABAP Using OVS

Customizing F4 Help in Web Dynpro ABAP Using OVS

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

© 2009 SAP AG 11

Page 12: Customizing F4 Help in Web Dynpro ABAP Using OVS

Customizing F4 Help in Web Dynpro ABAP Using OVS

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

© 2009 SAP AG 12

o) Please refer the screen shots below for all the methods

Page 13: Customizing F4 Help in Web Dynpro ABAP Using OVS

Customizing F4 Help in Web Dynpro ABAP Using OVS

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

© 2009 SAP AG 13

Page 14: Customizing F4 Help in Web Dynpro ABAP Using OVS

Customizing F4 Help in Web Dynpro ABAP Using OVS

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

© 2009 SAP AG 14

p) Please find the screen shots below for inserting select options in the view of the window

Page 15: Customizing F4 Help in Web Dynpro ABAP Using OVS

Customizing F4 Help in Web Dynpro ABAP Using OVS

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

© 2009 SAP AG 15

Page 16: Customizing F4 Help in Web Dynpro ABAP Using OVS

Customizing F4 Help in Web Dynpro ABAP Using OVS

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

© 2009 SAP AG 16

Page 17: Customizing F4 Help in Web Dynpro ABAP Using OVS

Customizing F4 Help in Web Dynpro ABAP Using OVS

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

© 2009 SAP AG 17

Page 18: Customizing F4 Help in Web Dynpro ABAP Using OVS

Customizing F4 Help in Web Dynpro ABAP Using OVS

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

© 2009 SAP AG 18

q) Save the entire component. Create a Web Dynpro application as shown below

r) Click ‘OK’ and save it as local object. Now save, check and activate the entire component and test

the application

Page 19: Customizing F4 Help in Web Dynpro ABAP Using OVS

Customizing F4 Help in Web Dynpro ABAP Using OVS

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

© 2009 SAP AG 19

s) The code that is implemented in all the methods is as below

WDDOINIT Method

METHOD WDDOINIT .

DATA: LT_RANGE_TABLE TYPE REF TO DATA,

RT_RANGE_TABLE TYPE REF TO DATA,

READ_ONLY TYPE ABAP_BOOL,

TYPENAME TYPE STRING.

DATA:

L_REF_CMP_USAGE TYPE REF TO IF_WD_COMPONENT_USAGE.

DATA: LR_VALUE TYPE REF TO DATA.

FIELD-SYMBOLS: <FS_BEGDA> TYPE BEGDA,

<FS_ENDDA> TYPE ENDDA.

* create the used component

L_REF_CMP_USAGE = WD_THIS->WD_CPUSE_SELECT_OPTIONS( ).

IF L_REF_CMP_USAGE->HAS_ACTIVE_COMPONENT( ) IS INITIAL.

L_REF_CMP_USAGE->CREATE_COMPONENT( ).

ENDIF.

WD_THIS->M_WD_SELECT_OPTIONS = WD_THIS->WD_CPIFC_SELECT_OPTIONS( ).

* init the select screen

WD_THIS->M_HANDLER = WD_THIS->M_WD_SELECT_OPTIONS->INIT_SELECTION_SCREEN( ).

*Set the Global options

WD_THIS->M_HANDLER->SET_GLOBAL_OPTIONS(

I_DISPLAY_BTN_CANCEL = ABAP_FALSE

I_DISPLAY_BTN_CHECK = ABAP_FALSE

I_DISPLAY_BTN_RESET = ABAP_FALSE

I_DISPLAY_BTN_EXECUTE = ABAP_FALSE ).

*Input field Operating Division

* create a range table that consists of this new data element

LT_RANGE_TABLE = WD_THIS->M_HANDLER->CREATE_RANGE_TABLE(

I_TYPENAME = 'PLVAR' ).

* add a new field to the selection

WD_THIS->M_HANDLER->ADD_SELECTION_FIELD(

I_ID = 'PLVAR'

I_VALUE_HELP_STRUCTURE = 'HRP5125'

I_VALUE_HELP_STRUCTURE_FIELD = 'PLVAR'

IT_RESULT = LT_RANGE_TABLE I_READ_ONLY = READ_ONLY ).

*Input field Application Source type

* create a range table that consists of this new data element

LT_RANGE_TABLE = WD_THIS->M_HANDLER->CREATE_RANGE_TABLE(

I_TYPENAME = 'RCF_APPL_SOURCE_TYPE' ).

* add a new field to the selection

WD_THIS->M_HANDLER->ADD_SELECTION_FIELD(

I_ID = 'RCF_APPL_SOURCE_TYPE'

I_VALUE_HELP_TYPE =

IF_WD_VALUE_HELP_HANDLER=>CO_PREFIX_OVS

Page 20: Customizing F4 Help in Web Dynpro ABAP Using OVS

Customizing F4 Help in Web Dynpro ABAP Using OVS

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

© 2009 SAP AG 20

IT_RESULT = LT_RANGE_TABLE I_READ_ONLY = READ_ONLY ).

*Input field Application Source

* create a range table that consists of this new data element

LT_RANGE_TABLE = WD_THIS->M_HANDLER->CREATE_RANGE_TABLE(

I_TYPENAME = 'RCF_APPL_SOURCE' ).

* add a new field to the selection

WD_THIS->M_HANDLER->ADD_SELECTION_FIELD(

I_ID = 'RCF_APPL_SOURCE'

I_VALUE_HELP_TYPE =

IF_WD_VALUE_HELP_HANDLER=>CO_PREFIX_OVS

IT_RESULT = LT_RANGE_TABLE I_READ_ONLY = READ_ONLY ).

*Input field Requisition Created from

CREATE DATA LR_VALUE TYPE BEGDATUM.

ASSIGN LR_VALUE->* TO <FS_BEGDA>.

WD_THIS->M_HANDLER->ADD_PARAMETER_FIELD(

I_ID = 'BEGDATUM'

I_DESCRIPTION = 'Requisition Start date'

I_VALUE_HELP_STRUCTURE = 'HRP5125'

I_VALUE_HELP_STRUCTURE_FIELD = 'AEDTM'

I_OBLIGATORY = ABAP_TRUE

I_VALUE = LR_VALUE ).

*Input field Requisition Created to

CREATE DATA LR_VALUE TYPE ENDDATUM.

ASSIGN LR_VALUE->* TO <FS_ENDDA>.

WD_THIS->M_HANDLER->ADD_PARAMETER_FIELD(

I_ID = 'ENDDATUM'

I_DESCRIPTION = 'Requisition End date'

I_VALUE_HELP_STRUCTURE = 'HRP5125'

I_VALUE_HELP_STRUCTURE_FIELD = 'AEDTM'

I_OBLIGATORY = ABAP_TRUE

I_VALUE = LR_VALUE ).

ENDMETHOD.

ON_OVSSEL Event Handler

METHOD ON_OVSSEL .

IF I_OVS_DATA-M_SELECTION_FIELD_ID = 'RCF_APPL_SOURCE'.

DO_OVS_APPSRC( I_OVS_DATA ).

ELSEIF I_OVS_DATA-M_SELECTION_FIELD_ID = 'RCF_APPL_SOURCE_TYPE'.

DO_OVS_APPSRCTYP( I_OVS_DATA ).

ENDIF.

ENDMETHOD.

Page 21: Customizing F4 Help in Web Dynpro ABAP Using OVS

Customizing F4 Help in Web Dynpro ABAP Using OVS

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

© 2009 SAP AG 21

DO_OVS_APPSRC Method

METHOD DO_OVS_APPSRC .

TYPES: BEGIN OF T_APPSRC1,

APPSRC TYPE RCF_APPL_SOURCE,

END OF T_APPSRC1.

DATA: IT_APPSRC TYPE TABLE OF T_APPSRC1.

DATA:

LT_APPSRC TYPE TABLE OF T77RCF_APPLSRC_T,

WA_APPSRC LIKE LINE OF LT_APPSRC,

FIELDNAME TYPE STRING,

LV_APPSRCTY TYPE REF TO DATA.

FIELD-SYMBOLS:

<LT_OVS_RESULT> TYPE T77RCF_APPLSRC_T,

<LT_SEL_OPT_RESULT> TYPE STANDARD TABLE,

<FS_APPSRCTY> TYPE TABLE,

<FIELD> TYPE DATA.

*Getting select option from application source type

LV_APPSRCTY = WD_THIS->M_HANDLER->GET_RANGE_TABLE_OF_SEL_FIELD(

I_ID = 'RCF_APPL_SOURCE_TYPE' ).

ASSIGN LV_APPSRCTY->* TO <FS_APPSRCTY>.

CASE I_OVS_DATA-M_OVS_CALLBACK_OBJECT->PHASE_INDICATOR.

WHEN IF_WD_OVS=>CO_PHASE_2.

SELECT APPL_SOURCE

FROM T77RCF_APPLSRC

INTO TABLE IT_APPSRC

WHERE APPL_SOURCE_TYPE IN <FS_APPSRCTY>.

IF SY-SUBRC = 0.

SELECT APPL_SOURCE DESCRIPTION

FROM T77RCF_APPLSRC_T

INTO CORRESPONDING FIELDS OF TABLE LT_APPSRC

FOR ALL ENTRIES IN IT_APPSRC

WHERE APPL_SOURCE = IT_APPSRC-APPSRC

AND LANGU = 'EN'.

ENDIF.

I_OVS_DATA-M_OVS_CALLBACK_OBJECT->SET_OUTPUT_TABLE( OUTPUT = LT_APPSRC ).

WHEN IF_WD_OVS=>CO_PHASE_3.

ASSIGN I_OVS_DATA-M_OVS_CALLBACK_OBJECT->SELECTION->* TO <LT_OVS_RESULT>.

ASSIGN I_OVS_DATA-MT_SELECTED_VALUES->* TO <LT_SEL_OPT_RESULT>.

FIELDNAME = I_OVS_DATA-M_SELECTION_FIELD_ID+4. "Removing RCF_

ASSIGN COMPONENT FIELDNAME OF STRUCTURE <LT_OVS_RESULT> TO <FIELD>.

INSERT <FIELD> INTO TABLE <LT_SEL_OPT_RESULT>.

ENDCASE.

ENDMETHOD.

Page 22: Customizing F4 Help in Web Dynpro ABAP Using OVS

Customizing F4 Help in Web Dynpro ABAP Using OVS

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

© 2009 SAP AG 22

DO_OVS_APPSRCTYP Method

METHOD DO_OVS_APPSRCTYP .

TYPES: T_APPSRC TYPE TABLE OF T77RCF_APPLSTY_T.

DATA:

LT_APPSRC TYPE TABLE OF T77RCF_APPLSTY_T,

WA_APPSRC LIKE LINE OF LT_APPSRC,

FIELDNAME TYPE STRING.

FIELD-SYMBOLS:

<LT_OVS_RESULT> TYPE T_APPSRC,

<APPSRC> LIKE LINE OF <LT_OVS_RESULT>,

<LT_SEL_OPT_RESULT> TYPE STANDARD TABLE,

<FIELD> TYPE DATA.

CASE I_OVS_DATA-M_OVS_CALLBACK_OBJECT->PHASE_INDICATOR.

WHEN IF_WD_OVS=>CO_PHASE_0.

I_OVS_DATA-M_OVS_CALLBACK_OBJECT->SET_CONFIGURATION(

COL_COUNT = 3 TABLE_MULTI_SELECT = ABAP_TRUE ).

WHEN IF_WD_OVS=>CO_PHASE_1.

I_OVS_DATA-M_OVS_CALLBACK_OBJECT->SET_INPUT_STRUCTURE(

INPUT = WA_APPSRC ).

WHEN IF_WD_OVS=>CO_PHASE_2.

SELECT APPL_SOURCE_TYPE DESCRIPTION

FROM T77RCF_APPLSTY_T

INTO CORRESPONDING FIELDS OF TABLE LT_APPSRC

WHERE LANGU = 'EN'.

I_OVS_DATA-M_OVS_CALLBACK_OBJECT->SET_OUTPUT_TABLE( OUTPUT = LT_APPSRC ).

WHEN IF_WD_OVS=>CO_PHASE_3.

ASSIGN I_OVS_DATA-M_OVS_CALLBACK_OBJECT->SELECTION->* TO <LT_OVS_RESULT>.

ASSIGN I_OVS_DATA-MT_SELECTED_VALUES->* TO <LT_SEL_OPT_RESULT>.

LOOP AT <LT_OVS_RESULT> ASSIGNING <APPSRC>.

FIELDNAME = I_OVS_DATA-M_SELECTION_FIELD_ID+4. "Removing RCF_

ASSIGN COMPONENT FIELDNAME OF STRUCTURE <APPSRC> TO <FIELD>.

INSERT <FIELD> INTO TABLE <LT_SEL_OPT_RESULT>.

ENDLOOP.

ENDCASE.

ENDMETHOD.

Page 23: Customizing F4 Help in Web Dynpro ABAP Using OVS

Customizing F4 Help in Web Dynpro ABAP Using OVS

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

© 2009 SAP AG 23

Related Content

Please find the below references links which will provide more information about the OVS help.

http://help.sap.com/saphelp_erp2005/helpdata/EN/30/d7fa41c915da6fe10000000a1550b0/content.htm

http://help.sap.com/saphelp_nw04s/helpdata/en/47/9ef8c99b5e3c5ce10000000a421937/content.htm

https://wiki.sdn.sap.com/wiki/display/Snippets/OVS%20search%20help

For more information, visit the ABAP homepage

Page 24: Customizing F4 Help in Web Dynpro ABAP Using OVS

Customizing F4 Help in Web Dynpro ABAP Using OVS

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

© 2009 SAP AG 24

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.