cancel
Showing results for 
Search instead for 
Did you mean: 

Exception while opening a component usage

Former Member
0 Kudos

Hi Experts,

              I am trying to call a custom webdynpro component from a standard WD component.

              The call is in a loop. so sometimes it opens the same custom webdynpro component twice.

              I am facing an exception while opening the same component twice.

             "web dynpro instance of the view zb_new already exists in component" is the message and exception is cx_wdr_rt_exception.

              Is it possible to open the same webdynpro component twice in the same instance. If yes please provide the solution.

              How will the context hold different values in this case. External pop up is not required by client.

              I already searched the forums but none of the threads has complete solution.

              Thank you in advance.

Regards

Sandeep.

Accepted Solutions (0)

Answers (2)

Answers (2)

amy_king
Active Contributor
0 Kudos

Hi Sandeep,

A runtime error will occur if an active component already exists for the component usage. In your loop before creating the component, call IF_WD_COMPONENT_USAGE->HAS_ACTIVE_COMPONENT to first check if the component already exists. Then only create the component if the method returns false.

Cheers,

Amy

Former Member
0 Kudos

Hi Amy,

           Thx for your reply. in the second iteration i can check this condition u mentioned above, But my question is How can I pop up the second window(Same component) again. Would it be possible to achieve this functionality.

amy_king
Active Contributor
0 Kudos

Hi Sandeep,

See if this SAP Help document on Dynamically Creating Component Usages helps you. It describes how to display an interface view of a used component more than once. The gist of the document is to create a new component usage within your loop using method CREATE_COMP_USAGE_OF_SAME_TYPE and to work with the unique component usage within the loop.

Cheers,

Amy

chengalarayulu
Active Contributor
0 Kudos

Sandeep,

as you mentioned, you are creating component usage inside the loop,,, which not required.

create component usage before starting the loop. else do follow..

data: lv_count type i value 0.

loop .....< >

     if lv_count eq 0.

          <<< Create Component Usage >>>

          add 1 to lv_count.

     endif.

endloop.

hope it will help you.

Former Member
0 Kudos

Thx for the reply. I've tried it but it is still giving the dump. It is trying to open the same webdynpro component twice in the same session. And as there can be only one instance of the context it may be giving a dump.