cancel
Showing results for 
Search instead for 
Did you mean: 

How to call create_window_for_cmp_usage to have popups in loop sequence

Former Member
0 Kudos

Hi,

I have a scneaio as follows; I have created a component to fill some of values of a material record ( COMP X ) it holds some input fields whose data i want to use in COMP Y.

Added this component as component usage to the component COMP Y. Now in a View Controller of Componeny Y );I am using a loop on material records.Each time when i process the loop; i will get the respective material number and call the

the component usage of X using the following code


         LOOP ....
        
          lo_cmp_usage =   wd_this->wd_cpuse_func_serno_capt( ).
          IF lo_cmp_usage->has_active_component( ) IS INITIAL.
            lo_cmp_usage->create_component( ).
          ENDIF.

*         Fire the component usage here
          l_cmp_api        = wd_comp_controller->wd_get_api( ).
          l_window_manager = l_cmp_api->get_window_manager( ).
          l_window      = l_window_manager->create_window_for_cmp_usage(
                          interface_view_name    = 'WD_SER_CPT'
                          component_usage_name   = 'FUNC_SERNO_CAPT'
                          title                  =
                          'Component Serial Number Screen'
                          message_display_mode   =
                          if_wd_window=>co_msg_display_mode_selected ).
          l_window->open( ).

         ENDLOOP...

          

But it is going to dump stating that the 'Already available INTERFACE VIEW' some thing like that. Actually my requirement is as follows :

LOOP the records.

get the POPUP of the component usage with input field ; then after filling value in input field and upon click of 'continue' button ; the respective value is captured in using container and the respective loop record is updated with this new value ... then again POPUP for the second record; button click ; capture in using component; this should be repeated for all records

Total of n popups in sequence for n records.This Scenario is something like call screen with in a loop in a normal dynpro screen.

I am not able to get the control back to the 'using component' controller after the first popup action is done to process for the second record and to get the second popup the next time.

I think i am clear in my explanation.Your helpis highly appreciated.

Thanks and Regards,

Satish A.

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

The solution is acheived and posted above

Former Member
0 Kudos

Hi All,

Yes i could see that unless the phase model completes it is not possbile to trigger the popups. Thanks for your replies.Closing the thread as i have changed the logic for this by creating a normal view which is refreshed each and every time with new set of data record ( 2, 3, 4 records and so on ... ) upon button click of 'CONTINUE' .. and using that component as component usage for my main component.

Thanks and Regards,

Satish A.

Former Member
0 Kudos

Yes, I am using only one external component; the same component i want to call in a loop.

Regards,

Satish A.

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

Logically this approach simply doesn't work. Popups aren't processed synchronously in Web Dynpro ABAP as they were in Classic Dynpro. You therefore can never call a popup within any kind of looping or branching logic. The Popup will not be displayed until the end of the phase model. Therefore the actual call to the popup doesn't stop processing of the code. Processing of the event handler or method continues and only then is one popup displayed.

Former Member
0 Kudos

hi, Satish A.

There is something wrong with what you have done.

From your description and your coding, it is clear that you have declared ONLY ONE component usage. However in the action which will pop-up the component usage's interface view (i.e the window in fact), you use LOOP and want to open many pop-up.

As far as i know, it is definitely not permitted, and you will get DUMP as you described.

So, what is the solution?

From my experience, i will use the same component usage many times. It is necessary for me to "Declare" many component usage. However, initially, we cannot know the exact number which we will use. So, i must change the mind. That is : i must Clone the declared component usage or create component usage dynamically, 2 approaches.

For Clone component usage, you can search in google or this forum, i am sure there are so many threads about this. As a example (only partly)


**Clone the component usage
    lr_component_usage = wd_this->GR_CMP_FLIGHT_USAGE->CREATE_COMP_USAGE_OF_SAME_TYPE( name = 'COMPB' ).
"here, comp b is the declared component usage name

For create component usage dynamically, also can search. Share one EXAMPLE (only partly)


*   add component usage to usage group
    "wd_this->gr_cmp_usage_grp is a ref to  IF_wD_COMPONENT_USAGE_GROUP
    lr_comp_usage = wd_this->gr_cmp_usage_grp->add_component_usage(
                               name               = lv_cmp_usage_name
                               embedding_position = lv_embed_pos
                               used_component     = 'COMPB' ).

For more detail, you can read the relevant materials or discuss in this thread.

Hope it can help you a little.

Best wishes.