cancel
Showing results for 
Search instead for 
Did you mean: 

WDDOMODIFY is getting called twice.

vishesh_malik
Participant
0 Kudos

Hi,

I am facing a problem where wddomodify is getting called twice when I am selecting a value from a drop down. While for other drop downs on the same view WDDOMODIFY is not even getting called. I would appreciate, if anyone of you can provide any info regarding the same.

Thanks,

Vishesh

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

Hi vishesh,

WDDOMODIFYVIEW (Method for Modifying the View before Rendering)

u2022 This is the only method in which dynamically modifying the UI controls is permitted.

u2022 The reference to the view and the information whether this view is displayed for the first time are passed to the method.

So, in your issue wdmodify is rendering for severral times as such try keep it in loop with defalut if first time and ,check whether any code is executed in wdexit and wdpostprocessing methods .

Thanks,

Aswin Girmaji

vishesh_malik
Participant
0 Kudos

DATA LO_ND_IMPORTING_CREATE TYPE REF TO IF_WD_CONTEXT_NODE.

DATA LO_EL_IMPORTING_CREATE TYPE REF TO IF_WD_CONTEXT_ELEMENT.

DATA LS_IMPORTING_CREATE TYPE WD_THIS->ELEMENT_IMPORTING_CREATE.

DATA LV_DOC_TYPE TYPE WD_THIS->ELEMENT_IMPORTING_CREATE-DOC_TYPE.

  • navigate from <CONTEXT> to <IMPORTING_CREATE> via lead selection

LO_ND_IMPORTING_CREATE = WD_CONTEXT->GET_CHILD_NODE( NAME = WD_THIS->WDCTX_IMPORTING_CREATE ).

  • get element via lead selection

LO_EL_IMPORTING_CREATE = LO_ND_IMPORTING_CREATE->GET_ELEMENT( ).

  • get single attribute

LO_EL_IMPORTING_CREATE->GET_ATTRIBUTE(

EXPORTING

NAME = `DOC_TYPE`

IMPORTING

VALUE = LV_DOC_TYPE ).

DATA LO_ND_IF_EDITABILITY TYPE REF TO IF_WD_CONTEXT_NODE.

DATA LO_EL_IF_EDITABILITY TYPE REF TO IF_WD_CONTEXT_ELEMENT.

DATA LV_EDIT_SUB_TYPE TYPE WD_THIS->ELEMENT_IF_EDITABILITY-EDIT_SUB_TYPE.

DATA LV_EDIT_PARENT TYPE WD_THIS->ELEMENT_IF_EDITABILITY-EDIT_PARENT.

DATA LV_DROPDOWN TYPE REF TO CL_WD_DROPDOWN_BY_KEY.

DATA LV_INPUTFIELD TYPE REF TO CL_WD_INPUT_FIELD .

  • navigate from <CONTEXT> to <IF_EDITABILITY> via lead selection

LO_ND_IF_EDITABILITY = WD_CONTEXT->GET_CHILD_NODE( NAME = WD_THIS->WDCTX_IF_EDITABILITY ).

  • get element via lead selection

LO_EL_IF_EDITABILITY = LO_ND_IF_EDITABILITY->GET_ELEMENT( ).

LO_EL_IF_EDITABILITY->GET_ATTRIBUTE( EXPORTING NAME = `EDIT_SUB_TYPE`

IMPORTING VALUE = LV_EDIT_SUB_TYPE ).

LO_EL_IF_EDITABILITY->GET_ATTRIBUTE( EXPORTING NAME = `EDIT_PARENT`

IMPORTING VALUE = LV_EDIT_PARENT ).

DATA LO_ND_FUNCTIONALITY TYPE REF TO IF_WD_CONTEXT_NODE.

DATA LO_EL_FUNCTIONALITY TYPE REF TO IF_WD_CONTEXT_ELEMENT.

DATA LS_FUNCTIONALITY TYPE WD_THIS->ELEMENT_FUNCTIONALITY.

DATA LV_OPTION_CHANGED TYPE WD_THIS->ELEMENT_FUNCTIONALITY-OPTION_CHANGED.

DATA LV_OPTION_SELECTED TYPE WD_THIS->ELEMENT_FUNCTIONALITY-OPTION_SELECTED.

  • navigate from <CONTEXT> to <FUNCTIONALITY> via lead selection

LO_ND_FUNCTIONALITY = WD_CONTEXT->GET_CHILD_NODE( NAME = WD_THIS->WDCTX_FUNCTIONALITY ).

  • get element via lead selection

LO_EL_FUNCTIONALITY = LO_ND_FUNCTIONALITY->GET_ELEMENT( ).

  • get single attribute

LO_EL_FUNCTIONALITY->GET_ATTRIBUTE(

EXPORTING

NAME = `OPTION_CHANGED`

IMPORTING

VALUE = LV_OPTION_CHANGED ).

LO_EL_FUNCTIONALITY->GET_ATTRIBUTE(

EXPORTING

NAME = `OPTION_SELECTED`

IMPORTING

VALUE = LV_OPTION_SELECTED ).

DATA LO_EL_CONTEXT TYPE REF TO IF_WD_CONTEXT_ELEMENT.

DATA LS_CONTEXT TYPE WD_THIS->ELEMENT_CONTEXT.

DATA LV_SET_STATE TYPE WD_THIS->ELEMENT_CONTEXT-SET_STATE.

  • get element via lead selection

LO_EL_CONTEXT = WD_CONTEXT->GET_ELEMENT( ).

  • get single attribute

LO_EL_CONTEXT->GET_ATTRIBUTE(

EXPORTING

NAME = `SET_STATE`

IMPORTING

VALUE = LV_SET_STATE ).

IF LV_SET_STATE = 'X'.

IF LV_DOC_TYPE = 'ABC' AND LV_EDIT_SUB_TYPE IS INITIAL.

LO_EL_IF_EDITABILITY->SET_ATTRIBUTE(

NAME = `EDIT_SUB_TYPE`

VALUE = 'X' ).

LV_DROPDOWN ?= VIEW->GET_ELEMENT('DRPDWN_SUBTYPE_CHANGE').

CALL METHOD LV_DROPDOWN->SET_STATE

EXPORTING

VALUE = 01

.

ELSE.

LO_EL_IF_EDITABILITY->SET_ATTRIBUTE(

NAME = `EDIT_SUB_TYPE`

VALUE = '' ).

LV_DROPDOWN ?= VIEW->GET_ELEMENT('DRPDWN_SUBTYPE_CHANGE').

CALL METHOD LV_DROPDOWN->SET_STATE

EXPORTING

VALUE = 00

.

ENDIF.

IF LV_EDIT_PARENT IS INITIAL AND

( LV_DOC_TYPE = '123' OR LV_DOC_TYPE = 'qwerty').

LO_EL_IF_EDITABILITY->SET_ATTRIBUTE(

NAME = `EDIT_PARENT`

VALUE = 'X' ).

LV_DROPDOWN ?= VIEW->GET_ELEMENT('DRPDWN_PARENT_CHNG_DOCTYPE').

CALL METHOD LV_DROPDOWN->SET_STATE

EXPORTING

VALUE = 01

.

LV_INPUTFIELD ?= VIEW->GET_ELEMENT('IF_PARENT_CHNG_DOCNUM').

CALL METHOD LV_INPUTFIELD->SET_STATE

EXPORTING

VALUE = 01

.

ELSE.

LO_EL_IF_EDITABILITY->SET_ATTRIBUTE(

NAME = `EDIT_PARENT`

VALUE = '' ).

LV_DROPDOWN ?= VIEW->GET_ELEMENT('DRPDWN_PARENT_CHNG_DOCTYPE').

CALL METHOD LV_DROPDOWN->SET_STATE

EXPORTING

VALUE = 00

.

LV_INPUTFIELD ?= VIEW->GET_ELEMENT('IF_PARENT_CHNG_DOCNUM').

CALL METHOD LV_INPUTFIELD->SET_STATE

EXPORTING

VALUE = 00

.

ENDIF.

LO_EL_CONTEXT->SET_ATTRIBUTE( NAME = `SET_STATE`

VALUE = ' ' ).

ENDIF.

LO_EL_CONTEXT->GET_ATTRIBUTE(

EXPORTING

NAME = `SET_STATE`

IMPORTING

VALUE = LV_SET_STATE ).

IF LV_OPTION_CHANGED = 'X' AND LV_OPTION_SELECTED = 'C'.

DATA LO_ND_ZGGL TYPE REF TO IF_WD_CONTEXT_NODE.

DATA LO_EL_ZGGL TYPE REF TO IF_WD_CONTEXT_ELEMENT.

  • navigate from <CONTEXT> to <ZGGL_RICEFTOOL> via lead selection

LO_ND_ZGGL = WD_CONTEXT->GET_CHILD_NODE( NAME = WD_THIS->WDCTX_ZGGL).

LO_ND_ZGGL->INVALIDATE( ).

  • get element via lead selection

LO_EL_ZGGL = LO_ND_ZGGL->GET_ELEMENT( ).

LO_ND_IMPORTING_CREATE->INVALIDATE( ).

LO_EL_IMPORTING_CREATE = LO_ND_IMPORTING_CREATE->GET_ELEMENT( ).

LO_EL_IMPORTING_CREATE->SET_ATTRIBUTE( NAME = `VISIBILITY_GROUP`

VALUE = '2' ).

LO_EL_IMPORTING_CREATE->SET_ATTRIBUTE( NAME = `VISIBILITY_TABLE`

VALUE = '1' ).

LO_EL_IMPORTING_CREATE->SET_ATTRIBUTE(

NAME = `ACTION_RDBTN`

VALUE = 'C' ).

LO_EL_IF_EDITABILITY->SET_ATTRIBUTE(

NAME = `EDIT_CREATE`

VALUE = ' ' ).

LO_EL_IF_EDITABILITY->SET_ATTRIBUTE(

NAME = `EDIT_DISPLAY`

VALUE = 'X' ).

LO_EL_FUNCTIONALITY->SET_ATTRIBUTE( NAME = `OPTION_CHANGED`

VALUE = ' ' ).

ENDIF.

vishesh_malik
Participant
0 Kudos

Sorry guys tried to post the code but uable to post it in correct format so deleting it...

Edited by: Vishesh@1986 on Sep 26, 2011 1:00 PM

Former Member
0 Kudos

Wddomodify is a hook method being called by the framework. Do not code or rely on all logic inside this method, code only what is relevant for the UI Elements and use First_time boolean to differentiate the first time and every round trip.

This method would be called on every round trip to server .

Former Member
0 Kudos

Hi Vishesh,

As suggested use first_time... code like this...

IF FIRST_TIME = ABAP_TRUE.

your code...

ENDIF.

Cheers,

Kris.

vishesh_malik
Participant
0 Kudos

Hi Kris,

Thanks for the response!

But I cannot use it as I have to call my code after everytime action is called and then set the parameters as per the value selected from drop down. Also, I am facing this only with one particular drop down for other drop downs WDDOMODIFY method is not even geting called. While MODIFY method is getting called I am setting a boolean parameter as False but when it gets called second time the value of parameter does not get reset and still remains True. I am not understanding why it is happening as once the value is set as False then even in second iteration it should come as False, which is not happening in my case.

Thanks,

Vishesh

Former Member
0 Kudos

Hi,

Can you bit explain about your requirement clearly..?

and why you are writing your code in WDDOMODIFYVIEW?

Cheers,

Kris.

ChandraMahajan
Active Contributor
0 Kudos

Hi,

if you want to populate 2nd dropdown based on value selected in 1st one then write the code in the event of 1st dropdown and handle it accordingly.

Thanks,

Chandra

vishesh_malik
Participant
0 Kudos

Hi Kris,

I need to set the STATE of a dropdowm UI as required or normal based on the value selected in another dropdown. I have earlier teted this functionality and it was working fine. But now when I am testing the application , on selection of value from the Parent dropdown UI the state of other drodowns is getting set as 'Required' but after setting it as required the WDDOMODIFY method again gets called and then reset the STATE to normal the latter part is happening due to the logic where again another problem arises, during the first call of WDDOMODIFY I am setting a parameter as False after setting the State of dropdowns but during second (automatic and unknown) iteration of WDDOMODIFY that parameter is again coming as True(X) which should actually be False (Blank). Due to which the State is again resetting to normal as I an using this boolean attrbute to identify whether this code should execute or not. My concern is, why is WDDOMODIFY method getting called twice. And this is happening for only one dropdown for other dropdowns WDDOMODIFY is not getting called even once which is my another concern.

If you need more info then let me know but my requirement is to set the STATE of few UI elements based on the value selected in dropdown(which here I referred as Parent Dropdown)

Thanks for the response!

Vishesh

vishesh_malik
Participant
0 Kudos

Hi Chandra,

I don't want to populate some value.. I am setting STATE of a UI element dynamically. but due to 2 calls of WDDOMODIFY method in first iteration it is going to IF condition and setting STATE as 'Required' and due this unusual 2nd iteration of WDDOMODIFY method it is going to else condition and again setting STATE as 'Normal Item'.

As a result, it appears as if nothing is happening which is actually happening due to 2 simultaneous calls of MODIFY method .

Thanks for the response!

Vishesh

ChandraMahajan
Active Contributor
0 Kudos

Hi Vishesh,

you have ur parent dropdown. it will have method onSelect. just put the code of setting the state etc in this method.

Thanks,

Chandra

Former Member
0 Kudos

Hi,

Then we have, onselect event for dropdown. use that. no need to use modify method.

Write your code on first dropdown of onselect event, to set state property of sec dropdown.

Cheers,

Kris.

vishesh_malik
Participant
0 Kudos

Hi Chandra/Kris

Even if I will write the code inside onSelect method again my issue reamins the same.

Why is WDDOMODIFY method getting called twice there is something wrong which I want to correct as I had earlier also applied the same logic inside MODIFY method and it is working fine there but something is missing in this case. Also why is the value of Boolean attribute not setting and appearing same.

I was avoiding code inside onSelect as for that I will have to use different attributes to bind them to the State property of different UI elements. Now I am going to do that only but I am keeping this question as unanswered, so that we can get a correct and apprpriate answer for it.

I am still waiting for answer!!

Thanks,

Vishesh

vishesh_malik
Participant
0 Kudos

Hi,

Some more info.

The WDDOMODIFY method is getting called twice because the action associated with the dropdown onSelect is also getting called twice. I am getting more and more confused why is this happening.

Thanks,

Vishesh

Former Member
0 Kudos

Vishesh@1986,

I understand that your onselect event is changing the drop down, and the wddomodify view is resetting it causing the change to be lost. This is happening because of two trips.

Whatever the initial state is, that you are setting in the wddomodify view, I suggest handling that in the parent select event. If the parent is initial, initialize the child drop down (for example), if not, set the required state as needed. You should be able to handle all cases in the selection events. I have done many dynamic drop down screens of a similar nature and have handled it all through those events.

Really, I find little use for the wddomodify view with the exception of first_time events.

ChandraMahajan
Active Contributor
0 Kudos

Hi,

Use the standard parameter FIRST_TIME available in method WDDOMODIFYVIEW and code accordingly.

This will solve the issue.

Thanks,

Chandra