cancel
Showing results for 
Search instead for 
Did you mean: 

Remove all elements from 1..n node

ashish_shah
Contributor
0 Kudos

Hi Experts,

I am trying to remove all the elements from a 1..n node.

as per my understanding After performing this it should throw a dump.

However it is not throwing any dump.

So can you guys explain how is webdynpro framework allowing me to delete even the last element from the node with cardinality 1..n?

Regards,

Ashish Shah

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Asish,

I am not seeing anywhere in the API's that 1..n nodes thouw dump or raise exception on deleting elements.

in this document [http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/60730016-dbba-2a10-8f96-9754a865b814?quicklink=index&overridelayout=true|http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/60730016-dbba-2a10-8f96-9754a865b814?quicklink=index&overridelayout=true]

explained that at least one element should be instantiated at runtime. So i think, when you delete the last element, framework just creates a empty element automatically or the last element is just invalidated and not deleted.

ashish_shah
Contributor
0 Kudos

Hi Senthil,

If you refer this URL , it says :

[http://help.sap.com/saphelp_nwce711core/helpdata/en/47/bef93c85f56c68e10000000a42189b/content.htm]

Violating the Cardinality Constraints

A nodeu2019s cardinality defines the minimum and maximum number of elements its collection may contain at runtime. It is most important that you do not write coding that attempts to violate these constraints.

If you do, then a runtime exception will be raised that will probably abort your entire Web Dynpro application.

Your Web Dynpro coding should anticipate and then avoid the following situations:

● Delete the default element from a node whose minimum cardinality is 1

It does not matter explicitly which element is left in the node collection, as long as at least one element remains.

● Add a second element to a node whose maximum cardinality is 1

So according to this it should throw Dump, however it does not !!!

So trying to understand what lower cardinality means?

Regards,

Ashish Shah

ashish_shah
Contributor
0 Kudos

Hi Thomas ( Thomas Jung) ,

Can you please share your views on this?

Regards,

Ashish Shah

gill367
Active Contributor
0 Kudos

HI Ashish,

I guess in Web Dynpro ABAP it is possible to delete.

the minimum cardinality in the WDA is followed just to create one element automatically initially

the documentation link that you have given is for Web Dynpro java.

have you tried in WDJ. i guess there you might be getting the exception.

but in case of WDA it is not throwing. It may be a bug.

i tried even with 1..1 there also it is allowed to remove the element.

Thanks

sarbjeet singh

Former Member
0 Kudos

Hi ,You may be right, the reference link which you have posted is from CE . Apparently seems to be that Java and ABAP webdynpro implementations differ.

Anyway as i already said and Saarbjeet confirmed here that in WDA it is not dumping.

ashish_shah
Contributor
0 Kudos

Hi Sarabjeet and Senthil,

I believe it is a bug in WebDynpro ABAP.

What i understood was : fundamentally what webDynpro Java does is also done in WebDynpro ABAP.

So this brings a doubt over the basic features like Cardinality property of WebDynpro ABAP node and its implementation.

So what does the lower cardinality mean in WebDynpro ABAP?

1) Minimum number of elements that WebDynpro ABAP framework will create at runtime

or

2) Minimum number of elements a Context node has to contain at runtime

I have not checked it yet in WebDynpro Java , but i am sure it throws an exception in Java.

Thomas , i want you to answer this , can you kindly reply to this question?

Regards,

Ashish Shah

gill367
Active Contributor
0 Kudos

it doesn't throw an error in web dynpro java also.

there also you can remove it.

the only thing i guess this minimum cardinality is doing is creating the elements automatically when you try to access the

node or invalidate it.

thanks

sarbjeet singh

ashish_shah
Contributor
0 Kudos

Hi All,

As a matter of fact, i also tried to add an element to a node with cardinality 1:1 in WDDOINIT of View.

DATA lo_nd_datanode TYPE REF TO if_wd_context_node.

DATA lo_el_datanode TYPE REF TO if_wd_context_element.

* navigate from <CONTEXT> to <DATANODE> via lead selection
   lo_nd_datanode = wd_context->get_child_node( name = wd_this->wdctx_datanode ).

* get element via lead selection
   lo_el_datanode = lo_nd_datanode->create_element( ).

   lo_nd_datanode->bind_element( NEW_ITEM = lo_el_datanode SET_INITIAL_ELEMENTS = ABAP_FALSE ).

Still i didnt get any Short dump.

I am not convinced that this should not throw a dump. It is violating the cardinality of 1:1 node.

Can Thomus Jung Respond to this thread with explanation.

Regards,

Ashish Shah

former_member184578
Active Contributor
0 Kudos

Hi Asish.,

As per my knowledge also it has to show dump.!!

U can try APPEND INTITAL LINE TO LT_NODE and bind this internal table LT_NODE to ur node.. I think it ll clear and give the initial values containing empty node..

Pls ckeck n let me know.

Thanks,

Regards,

Kiran.