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

Problem calling FM in background task in report program.

Former Member
0 Likes
630

Hi experts,

I have issue to call a z-fm in background task in report program. This piece of code is working when I call the z-fm in background task in a user-exit.

But when I put these piece of codes in a report program, it doesn't even get triggered as I check from SM58 and no entries there.

Did I miss something here?

LOOP AT gt_mara INTO gwa_mara.

CALL FUNCTION 'Z_FM_MM_PLANT_VAL_EXT' IN BACKGROUND TASK

                 EXPORTING

                   tcode = gc_mm01

                   wmara = gwa_mara

                   wmarc = gwa_source_plant

                   wmbew = gwa_source_valuation.

ENDLOOP.

Appreciate your opinions, thanks.

Regards,

Marlson

1 ACCEPTED SOLUTION
Read only

RaymondGiuseppi
Active Contributor
0 Likes
440

You have to code a COMMIT-WORK statement to trigger the execution of IN BACKGROUND TASK FM calls.

Regards,

Raymond

2 REPLIES 2
Read only

RaymondGiuseppi
Active Contributor
0 Likes
441

You have to code a COMMIT-WORK statement to trigger the execution of IN BACKGROUND TASK FM calls.

Regards,

Raymond

Read only

Former Member
0 Likes
440

Hi Marslon,

Please make sure that the FM is not using any of the frontend services like the class cl_gui_frontend_services. If yes it wont work in the background jobs.

I had a similar issue where this was the rootcause.

Regards,

Akhil