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

Call function in background

Former Member
0 Likes
2,292

Hi everybody,

My issue is that I have create a module function which insert into database  .

loop AT t_DD02L into s_DD02L.


           CALL FUNCTION 'Z_GET_DURATION_QUERY' "in BACKGROUND TASK
             EXPORTING
               s_table       = s_DD02L-tabname
                     .

     ENDLOOP.


It doesn't insert if it's called in background and if it's called normally it works perfect!


help please,


thank you,

Sam ZA

1 ACCEPTED SOLUTION
Read only

mahesh_madhavan
Participant
0 Likes
2,264

Hi,

Please add a commit work after calling the FM. Your background task sessions are not started until this. You can see pending tRFC session in the tcode SM58..


loop AT t_DD02L into s_DD02L.

           CALL FUNCTION 'Z_GET_DURATION_QUERY' "in BACKGROUND TASK

             EXPORTING

               s_table       = s_DD02L-tabname

                     .

     ENDLOOP.


Commit work.


Cheers,

Mahesh

6 REPLIES 6
Read only

Former Member
0 Likes
2,264

BACKGROUND TASK could use tRFC and tRFC will be processed latter or failing some situation?


Regards,

Vadamala A

Read only

0 Likes
2,264

Does your FM have a COMMIT WORK statement?  Maybe there's no automatic commit in case of a function executed as bg task....

Read only

mahesh_madhavan
Participant
0 Likes
2,265

Hi,

Please add a commit work after calling the FM. Your background task sessions are not started until this. You can see pending tRFC session in the tcode SM58..


loop AT t_DD02L into s_DD02L.

           CALL FUNCTION 'Z_GET_DURATION_QUERY' "in BACKGROUND TASK

             EXPORTING

               s_table       = s_DD02L-tabname

                     .

     ENDLOOP.


Commit work.


Cheers,

Mahesh

Read only

0 Likes
2,264

Hi , my code become as following :

loop AT t_DD02L into s_DD02L.

           CALL FUNCTION 'Z_GET_DURATION_QUERY'

             IN BACKGROUND TASK

               EXPORTING

                 s_table          = s_DD02L-tabname.

     ENDLOOP.

  COMMIT WORK.

ENDFORM.                    " GET_DATA


I checked the sm58  =>  Function module "Z_GET_DURATION_QUERY" cannot be u

sed for 'remote' calls.



Regards,

Sam ZA

Read only

0 Likes
2,264

is the function 'remote' enabled?

Read only

0 Likes
2,264

It works when I put remote enabled FM, thanks