cancel
Showing results for 
Search instead for 
Did you mean: 

How to bind the attribute in the context to a dynamic created element?

Former Member
0 Kudos

Hi, experts,

There are some attributes in the node context(ee_node) that contained the attribute named "ANSSA" in the view(test_view) in the WDA for abap. In the method modifyview of the view(there is a transfered parameter that represent the name of "ANSSA")

I want to create a dynamic element(inputfield) in the test_view. The element need bind the context attribute (ANSSA).Through the transfered parameter(para), I only know the name of the attribute binded.

How can I bind the attribute of the context in the following code?

METHOD modifyview .

*****************************

*

*importing para type string.

*importing m_view type ref to if_wd_view.

*

******************************

data wd_inputfield type ref to cl_wd_input_field.

  • create one element automatically in the view.

wd_inputfield = CL_WD_INPUT_FIELD=>NEW_INPUT_FIELD(

view = m_view

id = para

BIND_VALUE = ???

).

ENDMETHOD.

I don't know how to replace the "???" in the method modifyview? Do you give me some hint for it?

You can reply back to me via e-mail if you think we should discuss this internally at tao.wang@besuretech.com or wwangt_92@hotmail.com.

Thanks.

Best regards,

tao

Accepted Solutions (1)

Accepted Solutions (1)

S-H
Active Participant
0 Kudos

Hi,

If we have a cotext node SFLIGHTS and CARRID as its attribute, then we can provide

bind_value = 'SFLIGHTS.CARRID' 

Best regards,

Suresh

Former Member
0 Kudos

Hi, Suresh,

Thanks a lot for your help.

Just now, I think I may finished the code. But when I run the WDA for the dynamic created element, the system occuring error. do you give me some hints?

The following is my code in the wddomodifyview method in the ADDR_AUTO_DISP_VIEW view.

METHOD wddomodifyview .

******************************************

  • importing view type ref to if_wd_view.

*

******************************************

DATA transparent_container TYPE REF TO cl_wd_transparent_container.

DATA inputfield type ref to cl_wd_input_field.

DATA inputfield_id type string.

DATA LABEL TYPE REF TO CL_WD_LABEL.

data m_view type ref to if_wd_view.

transparent_container ?= view->get_element( `TRANSPARENT_CONTAINER` ).

transparent_container->set_visible(

EXPORTING

value = if_wdl_core=>visibility_visible ).

wd_this->SET_DYNAMIC_INPUT(

EXPORTING

inputfield_ID = 'ANSSA'

M_VIEW = view

IMPORTING

INPUTFIELD = inputfield

LABEL = LABEL

).

***************The web page will occur error when running the WDA as soon as I write the code.***********

transparent_container->add_child( THE_CHILD = inputfield ).

*********************************************************************************************************

ENDMETHOD.

The following is the code of the SET_DYNAMIC_INPUT method.

method SET_DYNAMIC_INPUT .

*********************************************

*

*importing

*INPUTFIELD_ID type STRING

*M_VIEW type ref to IF_WD_VIEW

*

*

*exporting

*INPUTFIELD type ref to CL_WD_INPUT_FIELD

*LABEL type ref to CL_WD_LABEL

*****************************************************

Data binded_context type string.

concatenate 'ADDR_AUTO_DISP_VIEW.EE_ADDRESS.' INPUTFIELD_ID into binded_context .

inputfield = CL_WD_INPUT_FIELD=>NEW_INPUT_FIELD(

view = m_view

id = inputfield_id

read_only = abap_true

BIND_VALUE = binded_context

).

label = cl_wd_label=>new_label( view = m_view

label_for = inputfield_id

).

endmethod.

When I run the WDA, The web page occuring the error information:

"

The following error text was processed in the system DEV : Access via 'NULL' object reference not possible.

The error occurred on the application server devserver_DEV_00 and in the work process 0 .

The termination type was: RABAX_STATE

The ABAP call stack was:

Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/L8STANDARD==============CP

Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/L7STANDARD==============CP

Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/L8STANDARD==============CP

Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/L8STANDARD==============CP

Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/L7STANDARD==============CP

Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/L8STANDARD==============CP

Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/L8STANDARD==============CP

Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/L7STANDARD==============CP

Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/L7STANDARD==============CP

Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/L8STANDARD==============CP

"

Do you give me some hints?

Thanks a million.

Best regards,

tao

former_member196517
Contributor
0 Kudos

Hi Wang,

you dont need to pass view reference while calling this method as you are calling from wdomodifyview method only ( thru called function set_dynamic_input)

CL_WD_INPUT_FIELD=>NEW_INPUT_FIELD

try removing a view parameter from this

Regards

Anuj Goyal

Former Member
0 Kudos

Hi, Suresh,

Thanks a lot for your help in advance.

Now, I modify my code. The following is my new code in the wddomodifyview method in the ADDR_AUTO_DISP_VIEW view.

METHOD wddomodifyview .

******************************************

  • importing view type ref to if_wd_view.

******************************************

DATA transparent_container TYPE REF TO cl_wd_transparent_container.

DATA inputfield type ref to cl_wd_input_field.

DATA inputfield_id type string.

DATA LABEL TYPE REF TO CL_WD_LABEL.

data m_view type ref to if_wd_view.

transparent_container ?= view->get_element( `TRANSPARENT_CONTAINER` ).

transparent_container->set_visible(

EXPORTING

value = if_wdl_core=>visibility_visible ).

m_view = transparent_container->view.

wd_this->SET_DYNAMIC_INPUT(

EXPORTING

inputfield_ID = 'ANSSA'

IMPORTING

INPUTFIELD = inputfield

LABEL = LABEL

).

**************The web page will occur error when running the WDA as soon as I write the code.***********

transparent_container->add_child( THE_CHILD = inputfield ).

*********************************************************************************************************

ENDMETHOD.

The following is the code of the SET_DYNAMIC_INPUT method.

method SET_DYNAMIC_INPUT .

*********************************************

*

*importing

*INPUTFIELD_ID type STRING

*exporting

*INPUTFIELD type ref to CL_WD_INPUT_FIELD

*****************************************************

Data binded_context type string.

concatenate 'ADDR_AUTO_DISP_VIEW.EE_ADDRESS.' INPUTFIELD_ID into binded_context .

inputfield = CL_WD_INPUT_FIELD=>NEW_INPUT_FIELD(

id = inputfield_id

read_only = abap_true

BIND_VALUE = binded_context

).

endmethod.

When I run the WDA, The web page occuring the error information:

"

Note

The following error text was processed in the system DEV : Access via 'NULL' object reference not possible.

The error occurred on the application server devserver_DEV_00 and in the work process 0 .

The termination type was: RABAX_STATE

The ABAP call stack was:

Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/L8STANDARD==============CP

Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/L7STANDARD==============CP

Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/L8STANDARD==============CP

Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/L8STANDARD==============CP

Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/L7STANDARD==============CP

Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/L8STANDARD==============CP

Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/L8STANDARD==============CP

Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/L7STANDARD==============CP

Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/L7STANDARD==============CP

Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/L8STANDARD==============CP

"

But when I delete the code of the wddomodifyview, and create a inputfield in the layout of the view, and bind the "ANSSA" to the "value" property in the layout, the WDA is running correctly.

Do you give me some hints?

Thanks a million.

Best regards,

tao

Former Member
0 Kudos

Hi, Suresh,

Thanks a lot for your help.

The last mail have some errors. Now, I modify my code error. The following is my new code in the wddomodifyview method in the ADDR_AUTO_DISP_VIEW view.

Now, I modify my code. The following is my new code in the wddomodifyview method in the ADDR_AUTO_DISP_VIEW view.

METHOD wddomodifyview .

******************************************

  • importing view type ref to if_wd_view.

******************************************

DATA transparent_container TYPE REF TO cl_wd_transparent_container.

DATA inputfield type ref to cl_wd_input_field.

transparent_container ?= view->get_element( `TRANSPARENT_CONTAINER` ).

transparent_container->set_visible(

EXPORTING

value = if_wdl_core=>visibility_visible ).

wd_this->SET_DYNAMIC_INPUT(

EXPORTING

inputfield_ID = 'ANSSA'

IMPORTING

INPUTFIELD = inputfield

).

**************The web page will occur error when running the WDA as soon as I write the code.***********

transparent_container->add_child( THE_CHILD = inputfield ).

*********************************************************************************************************

ENDMETHOD.

The following is the code of the SET_DYNAMIC_INPUT method.

method SET_DYNAMIC_INPUT .

*********************************************

*

*importing

*INPUTFIELD_ID type STRING

*exporting

*INPUTFIELD type ref to CL_WD_INPUT_FIELD

*****************************************************

Data binded_context type string.

concatenate 'ADDR_AUTO_DISP_VIEW.EE_ADDRESS.' INPUTFIELD_ID into binded_context .

inputfield = CL_WD_INPUT_FIELD=>NEW_INPUT_FIELD(

id = inputfield_id

read_only = abap_true

BIND_VALUE = binded_context

).

endmethod.

When I run the WDA, The web page occuring the error information:

"

Note

The following error text was processed in the system DEV : Access via 'NULL' object reference not possible.

The error occurred on the application server devserver_DEV_00 and in the work process 0 .

The termination type was: RABAX_STATE

The ABAP call stack was:

Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/L8STANDARD==============CP

Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/L7STANDARD==============CP

Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/L8STANDARD==============CP

Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/L8STANDARD==============CP

Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/L7STANDARD==============CP

Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/L8STANDARD==============CP

Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/L8STANDARD==============CP

Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/L7STANDARD==============CP

Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/L7STANDARD==============CP

Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/L8STANDARD==============CP

"

But when I delete the code of the wddomodifyview, and create a inputfield in the layout of the view, and bind the "ANSSA" to the "value" property in the layout, the WDA is running correctly.

Do you give me some hints?

Thanks a million.

Best regards,

tao

Former Member
0 Kudos

Hi, Suresh,

Thanks a lot for your help in advance.

Now, I modify my code. The following is my new code in the wddomodifyview method in the ADDR_AUTO_DISP_VIEW view. It is correct when I run the WDA.

METHOD wddomodifyview .

DATA transparent_container TYPE REF TO cl_wd_transparent_container.

DATA inputfield type ref to cl_wd_input_field.

DATA inputfield_id type string.

transparent_container ?= view->get_element( `TRANSPARENT_CONTAINER` ).

transparent_container->set_visible(

EXPORTING

value = if_wdl_core=>visibility_visible ).

wd_this->SET_DYNAMIC_INPUT(

EXPORTING

inputfield_ID = 'ANSSA'

IMPORTING

INPUTFIELD = inputfield

).

cl_wd_grid_data=>new_grid_data( element = inputfield

h_align = 00 ).

transparent_container->add_child( THE_CHILD = inputfield ).

ENDMETHOD.

The problem has been solved.

Thanks a million.

Best regards,

tao

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi, Suresh,

This problem have been solved.

Thanks a lot.

Best regards,

tao