Skip to Content
-1
Dec 07, 2022 at 01:48 PM

Call function starting new task

385 Views Last edit Dec 07, 2022 at 05:14 PM 5 rev

Experts,

I have a requirement to SUBMIT a program from a standard BADI that is called from a Flexible workflow. I tried submit inside a update FM using call function in update task. I learnt that SUBMIT is an illegal statement to be used in update task. So I changed my custom FM from update to remote enabled. Also in my code, I made a change to use call function starting new task.

When I debug my code by enabling update debugging in debugger profile, I see that submit program is working as expected. When I remove update debugging and external breakpoints, I see that workitem get approved. But submit program functionality didn't happen.

I have to push data from S/4 to SCP whenever Purchase Order flexible workflow is approved. I have a custom program which pushes data from S4 to SCP as expected. I am simply calling this program using SUBMIT statement inside my ARFC. This ARFC is working in debugger mode but not when I simply run the scenario without breakpoint.

I did search the forums before posting. That helped me to get the idea that ARFC should work for my requirement. But I am not still not successful.

I have done an enhancement in class CL_MM_PUR_PO_APPR_ACTIONS_BADI, method /IWWRK/IF_WF_WI_BEFORE_UPD_IB~BEFORE_UPDATE. Inside this enhancement, I have written below code:

DATA: lv_bukrs    TYPE bukrs,
          lv_parentpo TYPE ebeln.
    SELECT SINGLE bukrs, zz_master_po
            FROM ekko
            INTO ( @lv_bukrs, @lv_parentpo )
          WHERE procstat = '05' AND
                frgrl = '' AND
                ebeln = @lv_object_id AND
                bsart IN ('ZSVO', 'ZSCA').
    IF sy-subrc EQ 0.
      SET UPDATE TASK LOCAL.
      CALL FUNCTION 'ZMM_PUSHDATAFROMS4TOCLOUD' STARTING NEW TASK lv_object_id
        EXPORTING
          im_ebeln    = lv_object_id
          im_bukrs    = lv_bukrs
          im_parentpo = lv_parentpo.
    ENDIF.<br>

NOTE: My requirement is to simply call the custom program asynchronously. I am not interested in doing any parallel processing or to wait to get any feedback from the submitted program whether its successful or not. So that is why I am not waiting for results from the ARFC call. Its a custom program with a selection screen for which I am passing values via SUBMIT exportling list and return statement.

I checked whether any commit statement or wait statement in my custom program is messing up with LUW. There is no commit or wait statement.

Thanks

Bharath