Skip to Content

So we have some tricky scenario in one project. There is a little bigger FPM-application which should jump into a standard application where the user should do some stuff. After the user is done the results should be written back immediately.

So you can jump to standard transactions over SAP GUI for HTML out of your FPM-Application. This is nothing special. But how do you know that the user is done and get the changed data?

First there is a own report before the standard transaction so that you can do something own in WebGui.

My first idea was to use Abap Push Channels to “speak” to the FPM-Application after the user finished in Standard Transaction. There is some nice solution for that which comes with NW 7.5. You can trigger FPM-Events over Abap Push Channels.

But unfortunately we are not on 7.5… 🙁

My second idea was to use asynchronous events. Before the jump to the standard transaction an asynchronous event will be registered.

DATA(lo_event) = NEW cl_fpm_event(
          iv_event_id         = 'ASYNC1'
      ).
      DATA(l_notif_id) = cl_fpm_factory=>get_instance( )->register_asynchronous_event( io_event = lo_event ).

      CALL FUNCTION 'ZF_TEST_FPM' STARTING NEW TASK 'DUMMY'
        EXPORTING
          iv_notification = l_notif_id.

In the function module for the event it is waiting until there is a instance in shared memory for the username. If there is an instance then the event will trigger back.

 DATA l_flag TYPE flag VALUE abap_false.

  WHILE l_flag = abap_false.
    TRY.
        DATA(lo_handle) = zcl_shm_dataex_area=>attach_for_read(
                              inst_name = CONV #( sy-uname )
                          ).
        l_flag = abap_true.
        lo_handle->detach( ).
      CATCH cx_root.
    ENDTRY.
  ENDWHILE.

  cl_wd_notification_service=>update_event_status(
    EXPORTING
      event_id     = iv_notification    
      event_status = cl_wd_notification_service=>c_status_done    T_EVENT_STATUS)
  ).

 

Then this event is caucht and you can read the chanced data out of shared memory. Also the FPM-application knows that the user is done. 🙂

IF io_event->mv_event_id EQ 'ASYNC1'.
      TRY.
          DATA(lo_handle) = zcl_shm_dataex_area=>attach_for_read(
                                inst_name = CONV #( sy-uname )
                            ).
          DATA(ls_data) = lo_handle->root->get_data( ).
          lo_handle->detach( ).
          lo_handle->free_area( ).
        CATCH cx_root.
      ENDTRY.

      cs_data = ls_data.
      ev_data_changed = abap_true.
ENDIF.

 

In my Report i have to add something like this

CREATE OBJECT lo_root AREA HANDLE lo_handle.
lo_handle->set_root( root = lo_root ).
lo_root->set_data( is_data = VALUE #( a = p_a b = p_b c = p_c ) ).
lo_handle->detach_commit( ).

 

So there are some improvements to do but the direction is right. The quick & dirty variant works. 🙂

 

Result:

FPM:

Jump to Web GUI Transaction and do some Interaction:

Result in your FPM-Application:

 

I am open to other or better solutions 🙂

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply