cancel
Showing results for 
Search instead for 
Did you mean: 

Hi,I have a problem in using inbound and outbound plug

Former Member
0 Kudos

Hi,

I have a problem in using inbound and outbound plug

I am having two views in my window and defined one inbound and one outbound to each view and proper navigation is done

In first window by giving material document number i am fetching data from MSEG table and displaying on the screen in if i click on the button 'Navigate' then the second view will trigger in the second view based on the material fetched from the first view i am fetching Material details and displaying in the second view and thr is button in the second view 'Back' if i press that it will navigate to first view.

My problem is when again i try to execute from the first view instead of getting data its going for dump saying 'null node '
when i came back to first view the old data will be thr on screen is it necessary to clear those things and reinitializee the whole context??

if yes how to do that?? so plzzz help me to solve this issue

Thanks

Nirmal Jain

Accepted Solutions (1)

Accepted Solutions (1)

ajoy_chakraborty
Participant
0 Kudos

Hi Nirmal,

I have tried to re-create the scenario. Please find the steps:

  • Create WD Component with two views: VIEW1 and VIEW2
  • Go to COMPONENT CONTROLLER -> CONTEXT tab -> Create 2 Nodes

         First Node: IT_MATNR: Map it with MSEG-MATNR

                          Cardinality: 1..1

                          Selection: 0..1

          Second Node: IT_DETAILS: Map it to MARA-MATNR and MARA-ERSDA (same cardiniality and selection as above)

  • Go to VIEW1 -> Maintain context mapping with IT_MATNR only
  • Go to VIEW2 -> maintain context mapping with IT_DETAILS
  • Go to VIEW1 -> Create OUTBOUND plug (
  • OUT12). Go to VIEW2 -> Create corresponding INBOUND plug (IN21)
  • Similarly, VIEW2 -> Outbound plug (
  • OUT21) and VIEW1 -> Inbound plug (IN12)
  • Go to VIEW1 -> Layout -> Create input field -> Bind it with IT_MATNR-MATNR
  • Create NAVIGATE button -> enter the required outbound plug
  • Within NAVIGATE event:

{code}

wd_comp_controller->fetch_data( ).

wd_this->fire_out12_plg( ).

{code}

  • Similarly, in VIEW2 -> Create form (using code wizard) and map them to IT_DETAILS node
  • Create a BACK button and enter the required OUTBOUND plug
  • Go to WINDOWS and maintain NAVIGATION LINK
  • go to COMPONENT CONTROLLER -> Methods tab -> Create FETCH_DATA m
  • ethod
  • Use Code Wizard -> READ option -> bind with IT_MATNR
  • Write select query to fetch MATNR and ERSDA from MARA into variables
  • Use code wizard -> SET OPTION -> bind with IT_DETAILS-MATNR
  • Use code wizard -> SET option -> bind with IT_DETAILS-ERSDA
  • Assign the variables

Code will look like:

{code}

METHOD fetch_data .

  DATA lo_nd_it_matnr TYPE REF TO if_wd_context_node.
  DATA lo_el_it_matnr TYPE REF TO if_wd_context_element.
  DATA ls_it_matnr TYPE wd_this->element_it_matnr.
  DATA lv_matnr TYPE wd_this->element_it_matnr-matnr.

* navigate from <CONTEXT> to <IT_MATNR> via lead selection
  lo_nd_it_matnr = wd_context->get_child_node( name = wd_this->wdctx_it_matnr ).

* get element via lead selection
  lo_el_it_matnr = lo_nd_it_matnr->get_element( ).

* get single attribute
  lo_el_it_matnr->get_attribute(
    EXPORTING
      name =  `MATNR`
    IMPORTING
      value = lv_matnr ).

  DATA: lv_mat TYPE matnr,
        lv_ers TYPE ersda.

  SELECT SINGLE matnr ersda INTO (lv_mat, lv_ers) FROM mara
      WHERE matnr = lv_matnr.

     DATA lo_nd_it_details TYPE REF TO if_wd_context_node.
     DATA lo_el_it_details TYPE REF TO if_wd_context_element.
     DATA ls_it_details TYPE wd_this->element_it_details.
     DATA lv_ersda TYPE wd_this->element_it_details-ersda.

*    navigate from <CONTEXT> to <IT_DETAILS> via lead selection
     lo_nd_it_details = wd_context->get_child_node( name = wd_this->wdctx_it_details ).
*    get element via lead selection
     lo_el_it_details = lo_nd_it_details->get_element( ).

*    set single attribute
     lo_el_it_details->set_attribute(
       name =  `MATNR`
       value = lv_mat ).

* get element via lead selection
  lo_el_it_details = lo_nd_it_details->get_element( ).

* set single attribute
  lo_el_it_details->set_attribute(
    name =  `ERSDA`
    value = lv_ers ).

ENDMETHOD.

{code}

  • SAVE/ ACTIVATE/ TEST

  1. I have tested the scenario and its working fine
  2. No need to use INVALIDATE()
  3. Please check your CARDINALITY and SELECTION values

Regards,

Ajoy

Former Member
0 Kudos

Thanx for ur detailed explanation it helped me to solve the issue and please continue this

The problem was when i navigate from second view to first view and try to do any action on the first view it was going for dump.

To fetch the details from node2 i.e in view2 i used WD_CONTEXT.

When i navigate from second view to first view the node name COMPONENTCONTROLLER is replaced by node2 name in WD_CONTEXT i.e node name is filled with the name of node2. 

And alwayzz it has to be COMPONENTCONTROLLER details.

so we should not alter WD_CONTEXT contents.

I hope i made attempt to explain clearly 

Thanks a lot

Nirmal Jain

Answers (1)

Answers (1)

Former Member
0 Kudos

Paste the error from ST22. You can invalidate the code (clear the context) so that user can enter data as new input or you can default the material number. It depends on your requirement whether to clear the data when you come back to 1st view from a 2nd view.

Former Member
0 Kudos

Thanx fr ur valuable reply

I need to clear the values in the first view i.e i can say it has to start as fresh page(reset )

Now i am just navigating by using outbound plug when the navigate button is pressed the outbound  will trigger which is taking me to the first view

Problem is when i come back to first view, the data fetched previous action again appears init
and if i do any action its going for dump so according to my understanding it has to clear the data and initialize again as a fresh page The dump

The exception 'CX_WD_CONTEXT' was raised, but it was not caught anywhere along
the call hierarchy.

Since exceptions represent error situations and this error was not
adequately responded to, the running ABAP program
'CL_WDR_CONTEXT_ELEMENT========CP' has to be
terminated.

how to reset or initialize again the context or node?? or is it possible to call fres page again???

Thanks

Nirmal Jain

sahai
Contributor
0 Kudos

Hi Nirmal,

if you need to refresh/clear the node..you can use INVALIDATE( ). function

For example you have declared the node say name: NODE

NODE->INVALIDATE (  ).

This statement will refresh/clear all the data stored in the context node.

Regards,

Sahai.S

Former Member
0 Kudos

Hi,

Thanx for ur valuable replay,

I used INVALIDATE method in the inbound of first view i am able to clear all the data ,

Problem is when i again perform any action in the first view its going for Dump like Navigate or fetch the data

Thanks

Nirmal Jain

former_member199125
Active Contributor
0 Kudos

Hi Nirmal,

you said you want to clear the values in node1 when you are navigating from view 2 to view1, in your button action, after  you fire the navigation plug, then clear the view node contents.

As we do not know the view1 contents, we cannot guess the point of error unless you provided some thing

Regards

Srinvias