Application Development and Automation 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: 
Read only

Running Function Module in Background with Update Task is not working

Former Member
0 Likes
1,731

Hello Friends,

I have a "Z" Report Program where I am running this Report in Background using JOB_OPEN, JOB_SUBMIT, JOB_CLOSE. I am calling this in BADI.

In this Report I am calling another Function Module PRICES_POST which is a standard Function Module and in this FM there is another FM 'CKML_UPDATE_MATERIAL_PRICE IN UPDATE TASK'. Now when I am running the BADI these values are not being updated.

Friends I would like to know whether can we run Function Modules which are included with UPDATE TASK as Background Job program?

Kindly help me in providing your valuable suggestions in proceeding further.

Thanks and Regards

Pradeep Goli

2 REPLIES 2
Read only

0 Likes
937

Try using the Function Modules JOB_OPEN_ADK, JOB_SUBMIT_ADK & JOB_CLOSE_ADK.

Read only

RaymondGiuseppi
Active Contributor
0 Likes
937

Usually the sequence of CALLs in your report should look like

  CALL FUNCTION 'CM_F_INITIALIZE'
    EXPORTING
      msg_on_screen = c_x.
  CALL FUNCTION 'CKMS_BUFFER_REFRESH_COMPLETE'.
  CALL FUNCTION 'PRICES_CHANGE'
    EXPORTING
      actual_bdatj = f_matpr-pp-bdatj
      actual_poper = f_matpr-pp-poper
      bukrs        = p_bukrs
      budat        = p_date
      xblnr        = p_xblnr
    TABLES
      t_matpr      = t_matpr.
  READ TABLE t_matpr WITH KEY pp-xerror = ' '
                            TRANSPORTING NO FIELDS.
  IF sy-subrc <> 0.
    MESSAGE i046(ckprch).
  ELSE.
    CALL FUNCTION 'PRICES_POST'
      EXPORTING
        i_bktxt    = p_bktxt
        bukrs      = p_bukrs
        lis_update = 'X'
      TABLES
        t_matpr    = t_matpr.
  ENDIF.
  COMMIT WORK.

If you forget the COMMIT-WORK each and every FM called in UPDATE TASK will not be triggered.

Regards,

Raymond