Application Development 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: 

Call function - New task

former_member190178
Participant
0 Kudos

Hi Everyone,

I would like to use the Call Function - New task for one of my requirments. Please suggest if I am not doing right.

My programs looping structure is:

LOOP at zwewa_x.

PERFORM bapi_matphysinv_changecount.

ENDLOOP.

FORM bapi_matphysinv_changecount .

call function 'BAPI_MATPHYSINV_CHANGECOUNT'

exporting

physinventory = zwewa_y-iblnr

fiscalyear = zwewa_y-gjahr

  • PERCENTAGE_VARIANCE =

tables

items = itab

return = it_return.

ENDFORM. " BAPI_MATPHYSINV_CHANGECOUNT

Why am I thinking to use NEW TAEK is; when normally I call the BAPI its creates so many locks on the different different tables resulting LOCK table memory issue. So I thought to use the NEW TASK addition which would run a new session and while coming back to the calling program, would release all the locks. But I am not understanding how to use the NEW TASK perfectly and how to get the values (IT_RETURN) back from the new session to the calling program.

Can anybody send me the sample code where NEW TASK statement is being used and later from the new session values or Internal tables are coming back to the calling program.

This would be a great help.

1 ACCEPTED SOLUTION

former_member190178
Participant
0 Kudos

Please help.

4 REPLIES 4

former_member190178
Participant
0 Kudos

Please help.

0 Kudos

Hi,

Try this:

CALL FUNCTION func STARTING NEW TASK task

[DESTINATION {dest|{IN GROUP {group|DEFAULT}}}]

parameter list

[{PERFORMING subr}|{CALLING meth} ON END OF TASK].

Regards,

Neenu Jose.

former_member188685
Active Contributor
0 Kudos

may be you can try with Parallel processing.

check this Documentation on parallel processing.

http://help.sap.com/saphelp_nw04/helpdata/en/22/0425c6488911d189490000e829fbbd/content.htm

Former Member
0 Kudos

Hi,

there is no need to start new tasks - just unlock after each BAPI call using FM DEQUEUE_ALL or - more precisely - BAPI_TRANSACTION_COMMIT.

kind regards,

HP