Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Catch up the finished event?

friendlycoder
Participant
0 Kudos
277

Hi all

I have created a program that uses BGRFC:


  DATA(lo_inbound) = cl_bgrfc_destination_inbound=>create( dest_name = 'YCAS1' ).
  DATA(lo_trcf) = lo_inbound->create_trfc_unit( ).

  CALL FUNCTION 'ZAMAR_BG_PROCESS' IN BACKGROUND UNIT lo_trcf
    EXPORTING
      iv_num = 1000000.

  CALL FUNCTION 'ZAMAR_BG_PROCESS' IN BACKGROUND UNIT lo_trcf
    EXPORTING
      iv_num = 2000000.

    CALL FUNCTION 'ZAMAR_BG_PROCESS' IN BACKGROUND UNIT lo_trcf
    EXPORTING
      iv_num = 2000000.

  COMMIT WORK.

  WRITE:/ cl_trfc_client_inbound=>if_bgrfc_client~get_unit_state( unit_id = lo_trcf->unit_id ).
  WRITE:/ 'Hello'.

My question is, how to get the notification when the BGRFC tasks are finished.

Thanks

2 REPLIES 2

Sandra_Rossi
Active Contributor
0 Kudos
200

It's not intended to work like that, it executes asynchronously. Add the last processing in a function module at the end of the queue (function modules are processed sequentially in qRFC).

friendlycoder
Participant
0 Kudos
200

But I am using tRFC.

DATA(lo_trcf)= lo_inbound->create_trfc_unit().

Does it will execute sequentially?

When I going to change the code like:

  DATA(lo_inbound1) = cl_bgrfc_destination_inbound=>create( dest_name = 'YCAS1' ).
  DATA(lo_trcf1) = lo_inbound->create_trfc_unit( ).
  
  DATA(lo_inbound2) = cl_bgrfc_destination_inbound=>create( dest_name = 'YCAS2' ).
  DATA(lo_trcf2) = lo_inbound->create_trfc_unit( ).
  
  DATA(lo_inbound3) = cl_bgrfc_destination_inbound=>create( dest_name = 'YCAS3' ).
  DATA(lo_trcf3) = lo_inbound->create_trfc_unit( ).


  CALL FUNCTION 'ZAMAR_BG_PROCESS' IN BACKGROUND UNIT lo_trcf1
    EXPORTING
      iv_num = 1000000.


  CALL FUNCTION 'ZAMAR_BG_PROCESS' IN BACKGROUND UNIT lo_trcf2
    EXPORTING
      iv_num = 2000000.


    CALL FUNCTION 'ZAMAR_BG_PROCESS' IN BACKGROUND UNIT lo_trcf3
    EXPORTING
      iv_num = 2000000.

Will it run in parallel? If yes, how to get the notification, when all are finished.

Thanks