0% found this document useful (0 votes)
201 views5 pages

Creating UI Elements Dynamically in Abap Webdynpro Application

Creating Ui elements dynamically in abap web dynpro application is done in Modifyview Method. Following is the code to create a input field and button element on the screen METHOD wddomodifyview.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
201 views5 pages

Creating UI Elements Dynamically in Abap Webdynpro Application

Creating Ui elements dynamically in abap web dynpro application is done in Modifyview Method. Following is the code to create a input field and button element on the screen METHOD wddomodifyview.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

GettingStarted Newsletters

Welcome,Guest

Login

Register

SearchtheCommunity

Products

Services&Support

AboutSCN

Downloads

Industries

Training&Education

Partnership

DeveloperCenter

LinesofBusiness

UniversityAlliances

Events&Webinars

Innovation

Spaces

Browse

Search

WebDynproABAP / WebDynproABAPHome

CreatingUIElementsDynamicallyinAbapWebdynproApplication
CreatedbyRaviAswani,lastmodifiedonOct07,2009
CreatingUielementsliketabledynamicallyinabapwebdynproapplication.
Step1.CreateanabapwebdynproapplicationinSE80likeYH_DYNAMIC_UI_ELEMENTSwithviewMainandWindowMain_window.

EVOPDFToolsDemo

Step2.CreateanodeSFLIGHTwithAttributesasshown

Store


Step3.Createanevent'GET_FLIGHT'inmethodstabandsaveyourApplication.
Step4.CreatingUIElementsdynamicallyisdoneinModifyviewMethod.FollowingisthecodetocreateaInputFieldandButtonElementonthescreen

METHODwddomodifyview.

DATAlr_containerTYPEREFTOcl_wd_uielement_container.

DATAlr_inputTYPEREFTOcl_wd_input_field.

DATAlr_tableTYPEREFTOcl_wd_table.

DATAlo_nd_sflightTYPEREFTOif_wd_context_node.

DATAlr_buttonTYPEREFTOcl_wd_button.

*navigatefrom<CONTEXT>to<SFLIGHT>vialeadselection

lo_nd_sflight=wd_context>get_child_node(name=wd_this>wdctx_sflight).

IFfirst_time=abap_true.

lr_container?=view>get_element('ROOTUIELEMENTCONTAINER').

DATAlr_grid_dataTYPEREFTOcl_wd_grid_data.

DATAlr_flow_dataTYPEREFTOcl_wd_flow_data.

DATAlr_matrixTYPEREFTOcl_wd_matrix_head_data.

CALLMETHODcl_wd_input_field=>new_input_field

EXPORTING

bind_value='SFLIGHT.CARRID'

id='INPUT1'

RECEIVING

control=lr_input.

lr_matrix=cl_wd_matrix_head_data=>new_matrix_head_data(lr_input).

lr_input>set_layout_data(lr_matrix).

CALLMETHODlr_container>add_child

EXPORTING

index=1

EVOPDFToolsDemo


the_child=lr_input.

CALLMETHODcl_wd_button=>new_button

EXPORTING

enabled='X'

id='B1'

on_action='GET_FLIGHT'

text='GetFlightData'

RECEIVING

control=lr_button.

lr_matrix=cl_wd_matrix_head_data=>new_matrix_head_data(lr_button).

lr_button>set_layout_data(lr_matrix).

CALLMETHODlr_container>add_child

EXPORTING

index=1

the_child=lr_button.

ELSE.

lr_container?=view>get_element('ROOTUIELEMENTCONTAINER').

DATAlo_el_contextTYPEreftoif_wd_context_element.

DATAlv_flagTYPEwd_this>element_contextflag.

*getelementvialeadselection

lo_el_context=wd_context>get_element().

*getsingleattribute

lo_el_context>get_attribute(

EXPORTING

name=`FLAG`

IMPORTING

value=lv_flag).

EVOPDFToolsDemo

codetocreatetabledynamically

IFlv_flagEQ'1'.

CALLMETHODcl_wd_dynamic_tool=>create_table_from_node

EXPORTING

ui_parent=lr_container

table_id='MY_TABLE'

node=lo_nd_sflight

RECEIVING


table=lr_table.

ENDIF.

ENDIF.

ENDMETHOD.
Step5.WhilecreatingbuttonweassignACTIONtothebutton..butthepre-requisiteisthattheactionshouldalreadybethereincreatedmode.
Step6.ToPoplateDataintotheTable

METHODonactionget_flight.

DATAlo_nd_sflightTYPEREFTOif_wd_context_node.

DATAlo_el_sflightTYPEREFTOif_wd_context_element.

DATAls_sflightTYPEwd_this>element_sflight.

DATAlv_carridTYPEwd_this>element_sflightcarrid.

DATAit_flightTYPESTANDARDTABLEOFsbook.

DATAwa_flightLIKELINEOFit_flight.

*navigatefrom<CONTEXT>to<SFLIGHT>vialeadselection

lo_nd_sflight=wd_context>get_child_node(name=wd_this>wdctx_sflight).

*getsingleattribute

lo_nd_sflight>get_attribute(

EXPORTING

name=`CARRID`

IMPORTING

value=lv_carrid).

*&FetchDatafromdatabasetable

SELECTcarrid"Airline

connid"ConnectionId

fldate"FlightDate

FROMsbook

INTOCORRESPONDING

FIELDSOFTABLEit_flight

WHEREcarridEQlv_carrid.

IFsysubrcEQ0.

lo_nd_sflight>bind_table(it_flight).

ENDIF.

datalo_el_contexttypereftoif_wd_context_element.

EVOPDFToolsDemo


DATAlv_flagTYPEwd_this>element_contextflag.

*getelementvialeadselection

lo_el_context=wd_context>get_element().

lv_flag='1'.

*setsingleattribute

lo_el_context>set_attribute(

name=`FLAG`

value=lv_flag).

ENDMETHOD.
Step7.Createanapplicationandsave&activateit.
Step8.
Output:

EVOPDFToolsDemo

Nolabels

ContactUs
Privacy

SAPHelpPortal
TermsofUse

LegalDisclosure

Copyright

FollowSCN

You might also like