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

Scheduling function module execution in background jobs

MNaveen
Product and Topic Expert
Product and Topic Expert
0 Likes
1,830

Hi,

I have requirement where in after obtaining all the required inputs from the user we will call an function module to execute it.

The requirement is that the execution of fm shld happen in background and a log must be created showing the user whther it was successful or if it failed with the list of errors.

Can you kindly give some input on how to schedule the execution of function module in background job and if scheduled how to create the logs to display the success or error message.

Warm Regards,

Naveen M

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
701

Hi,

Just create a simple program where you have to call this FM.

Pass the values to FM either by declaring some internal table of selection screen and execute the program in background.

For Message Log, you can use structurre BDCMSGCOLL

DATA: MESSTAB LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.

After Call to FM, read from this internal table as follows

READ TABLE MESSTAB WITH KEY MSGTYP = <Message Type>

MSGNR = <Message Number>.

regds,

Anil

2 REPLIES 2
Read only

Former Member
0 Likes
701

Hi

Insert the fm in a new report and schedule a job for this new report, in this way all logs and message will be available in trx SM37.

U can use fm JOB_OPEN and JOB_CLOSE in order to create and close a job.

Max

Read only

Former Member
0 Likes
702

Hi,

Just create a simple program where you have to call this FM.

Pass the values to FM either by declaring some internal table of selection screen and execute the program in background.

For Message Log, you can use structurre BDCMSGCOLL

DATA: MESSTAB LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.

After Call to FM, read from this internal table as follows

READ TABLE MESSTAB WITH KEY MSGTYP = <Message Type>

MSGNR = <Message Number>.

regds,

Anil