cancel
Showing results for 
Search instead for 
Did you mean: 

Reference of a view in wddoinit method.

Former Member
0 Kudos

Hi experts!

I have a simple question, I think.

In WDDOMODIFYVIEW method I can work with parameter VIEW, like here:

DATA:  root_container TYPE REF TO cl_wd_transparent_container.

root_container ?= view->get_element( 'TR_BORRAR2' ).

I need do the same but in WDDOINIT method, but I don't have VIEW parameter in this method.

How I can work with my view in method WDDOINIT?

Thanks.

Accepted Solutions (1)

Accepted Solutions (1)

ramakrishnappa
Active Contributor
0 Kudos

Hi Alberto,

You can get the reference to view as below


DATA LO_VIEW type ref to if_wd_view.

     lo_view ?= wd_this->wd_get_api( ).

Hope this resolves your issue.

Regards,

Rama

Former Member
0 Kudos

Hi Ramakrishnappa

I tried this in method WDDOINIT but returns an error.

Dynamic type conflict when assigning references.


Thanks

Former Member
0 Kudos

It should work, Share your code, where the dump is coming.

ramakrishnappa
Active Contributor
0 Kudos

Hi Alberto,

The below statement should work. I am able to get the reference into lo_view .

  data lo_view type REF TO if_wd_view.

  lo_view ?= wd_this->wd_get_api( ).

Please try again ( copy & paste ).

Regards,

Rama

Former Member
0 Kudos

Hi.

I tried this code... copy & paste... Same result:

Dynamic type conflict when assigning references.


I don't know why not work...

I tired this in WDDOINIT method.

This code don't return error:

  DATA l_controller TYPE REF TO if_wd_controller.
l_controller ?= wd_this->wd_get_api( ).

But I need the view, not the controller.


Thanks.

Former Member
0 Kudos

Make sure you are writing code in the DOINIT method of view.

ramakrishnappa
Active Contributor
0 Kudos

Hi,

Okay, the issue is because, you have written your code in WDDOINIT method of component controller.

Please write the below lines in WDDOINIT of your view ( not in component controller )


  data lo_view type REF TO if_wd_view.

  lo_view ?= wd_this->wd_get_api( ).

Regards,

Rama

Former Member
0 Kudos

Hi.

The code is in WDDOINIT of my view and not work. Returns the error.

I don't understand..

ramakrishnappa
Active Contributor
0 Kudos

Can you please share the snap shot of your code.. just wanted to check

Former Member
0 Kudos

The snap shot

And the error:

In debug I can see that the error is in line:

lo_view ?= wd_this->wd_get_api( ).

Former Member
0 Kudos

try this code..


DATA lr_container TYPE REF TO cl_wd_uielement_container.
  data lo_view type REF TO if_wd_view.
   lo_view ?= wd_this->wd_get_api( ).

   lr_container ?= lo_view->get_element( 'TR_BORRAR2' ).

Former Member
0 Kudos

ERROR: Dynamic type conflict when assigning references.

Because TR_BORRAR2 may not be Transparent Container. Please check which UI element is TR_BORRAR2 and then use the corresponding type..


DATA lr_container TYPE REF TO cl_wd_uielement_container.   "For Container

DATA lr_container TYPE REF TO cl_wd_table.        " For Table

Rest of code will be same.

ramakrishnappa
Active Contributor
0 Kudos

Hi Chandra,

Your suggestion helps in resolving dump if its at line lo_view->get_element( ) but he is referring to the line

lo_view ?= wd_this->wd_get_api( )

Regards,

Rama

Former Member
0 Kudos

Ram, I am sure this error because of the thing i have mentioned. Let him check my reply and come back to us then we will decide what to do next.

Former Member
0 Kudos

Hi Chamdra and Ramakrishnappa.

First, thanks for your help and your time.

Chamdra, I have checked your previous reply and not work. Same error. And its in lo_view ?= wd_this->wd_get_api( )   not in  get_element().

Former Member
0 Kudos

Okay do one thing,

Comment all the code and write..

  data lo_view type REF TO if_wd_view.
   lo_view ?= wd_this->wd_get_api( ).


And try to run. And let us know what happening.

ramakrishnappa
Active Contributor
0 Kudos

Yes Chandra, we are really running behind these 2 lines to know the issue.

Former Member
0 Kudos

I tried this with all code commented. Same message, Dynamic type conflict when assigning references.

I share a snap shot of the info of wdthis. Perhaps help you to see the problem.


Former Member
0 Kudos

Can you please look into this..

cc :

ramakrishnappa
Active Contributor
0 Kudos

Hi Alberto,

Please double click on internal_api find out if the view reference is bound as below

If the view reference is not bound, you should be at lower release of Net weaver.

Share us the system details.

Regards,

Rama

Former Member
0 Kudos

I send you two pics. I don't know if it's important but the NetWeaver version is 2004s

ramakrishnappa
Active Contributor
0 Kudos

Hi Alberto,

Thanks for sharing the system details.

As per my understanding, lo_view ?= wd_get_api( ) works fine in system NW 7 with EHP 1 and higher.

Please ask basis team to update the system for higher Enhancement package.

For now, you can achieve your requirement by writing code in WDDOMODIFYVIEW

Regards,

Rama

Answers (3)

Answers (3)

former_member184578
Active Contributor
0 Kudos

Hi,

Sorry for my late response, I was out of SCN!

Are you getting this error in your particular WDA application or in all other applications as well?

Please check in another test application( write the same code in WDDOINT method). The attribute F_ALTER_EGO in the WD_THIS reference should point to the instance of class CL_WDR_DELEGATING_VIEW.

If you are on Netweaver 2004s version, you cannot get the if_wd_view reference in DOINIT method.


The API IF_WD_VIEW can exclusively be accessed using the attribute VIEW of the method WDDOMODIFYVIEW of the local view controller interface.

Ref: Web Dynpro Runtime APIs (SAP Library - Web Dynpro for ABAP)

Regards,

Kiran

amy_king
Active Contributor
0 Kudos

Hi Alberto,

If you have commented out all the code in the view's WDDOINIT method and are still seeing the type conflict error, then it is likely that the real error is elsewhere and Web Dynpro may have become out-of-sync and is pointing you to the wrong line of code.

Try commenting out code you have added recently in other places-- essentially back out your custom code bit by bit until you are able to execute without errors.

The error is of type RABAX_STATE, so also take a look in the ST22 error log to see if it has additional information on the source of the error.

is correct that the following should work so my guess is Web Dynpro has become out-of-sync.

data lo_view type ref to if_wd_view.
lo_view ?= wd_this->wd_get_api( ).

I also agree with Rama that it may be time to upgrade to NW7.

Cheers,

Amy

Former Member
0 Kudos

I've comented recently added code and not works.

The sistem is in NW7 but EPH is not in 1. Perhaps it is the problem, because the error its very peculiar.

I've resolved my problem using WDDOMODIFYVIEW method. But I had a problem with FIRST_TIME parameter and it's the reason because I worked with WDDOINIT.

This parameter is 'X' only the first time you run your view. If you go to other view and return to the previous, FIRST_TIME not reset your value to 'X'.

I solved it, changing the parameter Lifetime in VIEW to 'when visible'.

Thanks for the help.

Regards.

Alberto

Former Member
0 Kudos

Hi Alberto,

You can also do it this way.

1. Create a View attribute lr_view of type ref to IF_WD_VIEW.

2. In WDDOMODIFYVIEW method

 

    IF  first_time = abap_true.

          wd_this->lr_view = view.

     ENDIF.

Now you can access the view reference in any of the view method using wd_this->lr_view.

Regards,

Shibin

Former Member
0 Kudos

But this will work after WDDOINIT method is called already because WDDOMODIFYVIEW is called after wddoinit method. And once doinit method is called, it won't be able to call it again, so i don't think so this will be helpful in this case. .

Former Member
0 Kudos

Hi Chandra,

Thanks for the correction.  It won't work for WDDOINIT as you have rightly mentioned.

Regards,

Shibin

Former Member
0 Kudos

Thanks for your understanding