cancel
Showing results for 
Search instead for 
Did you mean: 

Regarding WDA Standard Hook methods..

Former Member
0 Kudos

     Hi Everyone,

           I am confuse about writting code in webdynpro standard methods. Suppose i have a requirement like based on material number(matnr) i need to fetch some data from MARA table. Lets I have two views INPUT_VIEW and OUTPUT_VIEW and in INPUT_VIEW suppose I have an inputfield where i will enter MATNR value and based on this value I need to populate on OUTPUT_VIEW. So for fetching data from MARA table where i need to write my code. please eleborate...

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

there are two option to do this

1. you can put code in wdmodifyview hook method  of output_view but it may lead to performance issue because every time any action perform in output_view will going to call this method.

2. create a method and call this method in inbound plug of output_view. only

if output view is called by fireing outbound plug then your code for getting data you can put in inbound plug of output view.

         this increase your performance because this method only called when you call output_view by fireing plug any action perform in output_view will not call your data_fetching method.

<removed by moderator>

Message was edited by: Oxana Noa Zubarev

Answers (5)

Answers (5)

Former Member
0 Kudos

Hi Sanjib,

In many ways you can do this.

1) By creating output node( MARA) in component controller and map it to both input view and output view.

  In input view create a button and in onaction method, read input field and get the values from mara table into an internal table and bind it to output node.

in second view design layout with table and do the data binding.

  After that create outbound plug for view1 and inbound plug for view2 and create navigation link in window.

In the same action method fire this outbound plug.

2)  Create outbound plug for view1  with outbound parameter as matnr  type  mara-matnr, and inbound plug for view2 with importing parameter as  matnr  type mara-matnr and create navigation link between these in window.

    Create action method for ONENTER event for the input field and fire the outbound plug.

      in  handle_inboundplg() method get values from mara for the imported matnr into internal table and bind it to output node.

3)   Read  input field and keep it as attribute in component controller and fire the outbound plug in

   onenter action method or Button action method.

     get values from mara table into internal table for component controller attribute ( matnr) and bind it to output node in wddoinit method of view2.

Regards,

Paul.

sahai
Contributor
0 Kudos

Hi,

Add a button on the View where you have the input field.

You can do all your coding on that button.

Regards,

Shitanshu Sahai

Former Member
0 Kudos

Hi Sanjib,

   Why don't you chek the some basic tutorials to get ideas like binding , mapping , using hook methods etc. &  take a fresh start with your coding.

I m sure this will help  u.

http://scn.sap.com/docs/DOC-8863

Regards,

Monishankar Chatterjee

mangesh_sonawane
Participant
0 Kudos

HI Sanjib,

1. Declare the node in component controller.

2.Drag the same in both view.

3.Assign material number to that input field of first view.

4.Now read the material number field in second view.

5.Now bind table based on the material number

Select * from MARA into corresponind fied of table (table lt_node) where matnr = (Material number u read eg. lv_matnr)

Thanks & regards,

Mangesh Sonawane

Former Member
0 Kudos

Hi Sanjib,

When ever you are firing an outbound plug, it triggers inbound plug of another view which you have mapped using navigation links. In your case, you have to mention MATNR in outbound plug parameters of input_view. Each inbound plug will have a default Event Handler(name HANDLEIN_viewname) which triggers for every call to this inbound plug.

So, its always good to write code here, in this event handler method to fetch the data based on the parameters from previous view.

There is another way to do this, you can bind the values coming from inbound plug to your context node attributes and write the select query in WDDOINIT so that you can use the data where ever you need.

Reward if helpful.

Regards,

Mahidhar. 

Former Member
0 Kudos

Hi Mahidhar,

    Thank you for your reply. Can you give little more description regarding where exactly needs to write my code. As you guide I declare MATNR as parameter in Outbound plug. After than what needs to be done for populating output in output view..

sreenu_b2
Explorer
0 Kudos

Hi Sanjib,

1. You defined an Outbound Plug with importing parameter MATNR type MARA-MATNR

2. In view1 onaction of the button or anytime to navigate to second view , fire the corresponding outbound plug

Method Onaction.

*First read the matnr attribute from context

lo_el_node->get_attribute( exporting Name = MATNR

                                       importing value = lv_matnr ).

*Fire the method

wd_this->fire_out1_plg( lv_matnr ).

Go To view2 .

1. Defien an inbound plug .By doing so corespoding event handler method with name HANLDE<inboundplug name > is created.

2. Double click to implmenet this event handler method

Maintain an importing parameter for this event handler method with the same name as outbound  Plug(i.e MATNR type MARA-MATNR)

Within this event handler method write the business logic to get the MARA data based on importing parameter MARA  and bind the internal table data into MARA node

Former Member
0 Kudos

  Hi Sreenu,

       I am not sure how to bind one Internal table with node in WDA. Please give one demo code.

m_aravindan
Active Participant
0 Kudos

Hi Sanjib ,

                Try this link ..  simple example how to use table in web dynpro and how to bind values for that table..

http://www.sapdev.co.uk/webapps/webdynpro/wdp_intotable.htm

Regards

Aravindan

Former Member
0 Kudos

Hi Aravind,

       I tried as describe in demo program. But during testing I am getting following errors and I am not able to rectify it.

m_aravindan
Active Participant
0 Kudos

Hi Sanjib ,

            

  just try to create a new web dynpro component and try all the steps in that link.

Hope it works.

Regards

Aravindan