Skip to Content
avatar image
-6
Former Member

Function module is not getting executed when report is run in Background

Hello,

I need to schedule a job for custom Function module for which I have created a report in which I have called the same custom Function module.

When I am executing the report in background , Job is getting scheduled but the Function module is not getting executed.

When I re-run the same job using JDBG then the FM is getting executed and also when I run the report in foreground FM is getting executed.

I am facing issue only when I execute the report in background.

Kindly provide suggestions on how to proceed

Thank you!

BestRegards,

Aamukta Malyada A

Add comment
10|10000 characters needed characters exceeded

  • Former Member Rob Dielemans

    Yes,

    But the Issue I am facing is the Function module is not getting Executed in Background

  • I think we're all well aware what your problem is. You do not need to keep restating it.

    If you don't check the sy-subrc at the correct point, then you're not going to trap any issues.

    Since you refuse to supply relevant details, I'm going to close this question.

  • And still there is no answer on how exactly you established that FM does not work and no code posted of what the FM does...

    What have you tried so far to troubleshoot this? Quick Google search for "does not work in background site:sap.com" should've found all the answers regarding what the differences are. And if you can't debug in background then how about adding some messages to display in the job log? ("Logging" is a common programming concept.)

    How did you get a job at SAP? If you are an intern/trainee then there should be a trainer assigned to you. SCN is not a replacement for this, sorry.

Further commenting has been locked.
  • Get RSS Feed

4 Answers

  • Nov 15, 2016 at 08:55 AM

    Have you implemented logging into your program? If not, do it, and log all relevant events, especially non-zero return codes.

    Add comment
    10|10000 characters needed characters exceeded

    Further commenting has been locked.
  • Nov 15, 2016 at 09:54 AM

    Hi,

    It should be dumping then... some FM, indeed, are not meant to be executed in background. But, then you would receive a dump... Otherwise, I wonder how you claim that it was not executed. Log the action through ST05 and see what happens...

    Regards,

    Eli

    Add comment
    10|10000 characters needed characters exceeded

    Further commenting has been locked.
  • avatar image
    Former Member
    Nov 15, 2016 at 09:41 PM

    Your report does not explicitly change whether your Function Module is called if the report is run as a background/scheduled job.

    Providing your job is finishing and in succeed status i would suggest it IS getting executed but something within the Ztest function module is not working properly, or you are handling an exception which equates to a 'successful' run. So you would need to paste the code for the ztest function module for these kind sirs/madams to assist you further.

    Hint: Transaction SE37 to get your Function module code.

    Hint 2: If you are in a development environment, put an infinite loop in your report code prior to the function call. Schedule the job and when it is running, go to SM50 and find the dialog process for the program - the user the job is scheduled under will be the indicator in this case. Highlight the line and go to administration -> Program -> Debugging. Step through and you will see.

    Hint 3: Take an ABAP course.

    ALSO: Have you considered that the foreground and background execution users are different.

    Add comment
    10|10000 characters needed characters exceeded

  • Nov 15, 2016 at 09:49 AM

    Hi,

    Did you write the custom function module? Either the FM tries to do something in the foreground for which it needs user interaction, or there is a piece of code checking sy-batch, or when you execute it in the background it uses a different user and that one is missing authorizations or missing user parameters.

    Kind regards, Rob Dielemans

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Rob Dielemans

      Hello,

      Inside the Function module I am creating a RFC for different system (say ABC) and updating a custom Table in that system(ABC) and No pop up FM's are used or any code that requires information from fore ground.

    Further commenting has been locked.