Skip to Content

FM JOB_SUBMIT

Hi!

I've to use that fm...

CALL FUNCTION 'JOB_SUBMIT'

EXPORTING

authcknam = SY-UNAME

jobcount = jobcount

jobname = job1

  • REPORT = ' ' "nombre del report (el "step")

  • VARIANT = ' ' "variante de ejecución del report

  • EXCEPTIONS

  • INVALID_JOBDATA = 1

  • JOBNAME_MISSING = 2

.

I've to execute a perform of my program, in a JOB, but i don't know how to call correctly...

Thanks

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jan 28, 2008 at 02:57 PM

    hi

    good

    REPORT ZMAILSPOOL.

    INCLUDE LBTCHDEF.

    • Include the Business Object Repository object

    INCLUDE <CNTN01>.

    DATA ABAPNM LIKE SY-REPID.

    DATA BEGIN OF LOCAL_JOB.

    INCLUDE STRUCTURE TBTCJOB.

    DATA END OF LOCAL_JOB.

    DATA BEGIN OF LOCAL_STEP_TBL OCCURS 10.

    INCLUDE STRUCTURE TBTCSTEP.

    DATA END OF LOCAL_STEP_TBL.

    • Data declarations for the mail recipient

    DATA RECIPIENT TYPE SWC_OBJECT.

    DATA RECIPIENT_OBJ LIKE SWOTOBJID.

    SWC_CONTAINER CONTAINER.

    • Data declarations for the background job

    PARAMETERS ABAPNAME(20) DEFAULT 'ZTEST1'.

    PARAMETERS EMPFNAME LIKE SY-UNAME DEFAULT SY-UNAME.

    ABAPNM = ABAPNAME.

    LOCAL_JOB-JOBNAME = ABAPNAME.

    • Generate recipient object (see report RSSOKIF1 for an example)

      • 1. Create the recipient:

      IF EMPFNAME <> SPACE.

      "** 1.1 Generate an object reference to a recipient object

      SWC_CREATE_OBJECT RECIPIENT 'RECIPIENT' SPACE.

      "** 1.2 Write the import parameters for method

      "** recipient.createaddress into the container

      "** and empty the container

      SWC_CLEAR_CONTAINER CONTAINER.

      "** Set address element (internal user 'JSMITH')

      SWC_SET_ELEMENT CONTAINER 'AddressString' EMPFNAME.

      "** Set address type (internal user)

      SWC_SET_ELEMENT CONTAINER 'TypeId' 'B'.

      "** 1.3 Call the method recipient.createaddress

      SWC_CALL_METHOD RECIPIENT 'CreateAddress' CONTAINER.

      "** Issue any error message generated by a method exception

      IF SY-SUBRC NE 0.

      MESSAGE ID SY-MSGID TYPE 'E' NUMBER SY-MSGNO.

      ENDIF.

      SWC_CALL_METHOD RECIPIENT 'Save' CONTAINER.

      SWC_OBJECT_TO_PERSISTENT RECIPIENT RECIPIENT_OBJ.

      ENDIF.

          • Recipient has been generated and is ready for use in a

          • background job

          CALL FUNCTION 'JOB_OPEN'

          exporting

          • DELANFREP = ' '

          • JOBGROUP = ' '

          jobname = LOCAL_JOB-JOBNAME

          • SDLSTRTDT = NO_DATE

          • SDLSTRTTM = NO_TIME

          IMPORTING

          JOBCOUNT = LOCAL_JOB-JOBCOUNT

          EXCEPTIONS

          CANT_CREATE_JOB = 1

          INVALID_JOB_DATA = 2

          JOBNAME_MISSING = 3

          OTHERS = 4

          .

          if sy-subrc <> 0.

          WRITE: / 'JOB_OPEN PROBLEM ', SY-SUBRC.

          ELSE.

          WRITE: / 'JOB OPEN SUCCESS',

          LOCAL_JOB-JOBNAME, LOCAL_JOB-JOBCOUNT.

          endif.

          CALL FUNCTION 'JOB_SUBMIT'

          exporting

          • ARCPARAMS =

          authcknam = SY-UNAME

          • COMMANDNAME = ' '

          • OPERATINGSYSTEM = ' '

          • EXTPGM_NAME = ' '

          • EXTPGM_PARAM = ' '

          • EXTPGM_SET_TRACE_ON = ' '

          • EXTPGM_STDERR_IN_JOBLOG = 'X'

          • EXTPGM_STDOUT_IN_JOBLOG = 'X'

          • EXTPGM_SYSTEM = ' '

          • EXTPGM_RFCDEST = ' '

          • EXTPGM_WAIT_FOR_TERMINATION = 'X'

          jobcount = LOCAL_JOB-JOBCOUNT

          jobname = LOCAL_JOB-JOBNAME

          • LANGUAGE = SY-LANGU

          • PRIPARAMS = ' '

          REPORT = ABAPNM

          • REPORT = 'ZTEST1'

          • VARIANT = ' '

          • IMPORTING

          • STEP_NUMBER = LOCAL_JOB-STEPCOUNT

          EXCEPTIONS

          BAD_PRIPARAMS = 1

          BAD_XPGFLAGS = 2

          INVALID_JOBDATA = 3

          JOBNAME_MISSING = 4

          JOB_NOTEX = 5

          JOB_SUBMIT_FAILED = 6

          LOCK_FAILED = 7

          PROGRAM_MISSING = 8

          PROG_ABAP_AND_EXTPG_SET = 9

          OTHERS = 10

          .

          if sy-subrc <> 0.

          WRITE: / 'JOB_SUBMIT PROBLEM ', LOCAL_JOB-JOBCOUNT,

          LOCAL_JOB-JOBNAME, ABAPNAME, SY-SUBRC.

          endif.

          IF EMPFNAME <> SPACE.

          CALL FUNCTION 'JOB_CLOSE'

          exporting

          • AT_OPMODE = ' '

          • AT_OPMODE_PERIODIC = ' '

          • CALENDAR_ID = ' '

          • EVENT_ID = ' '

          • EVENT_PARAM = ' '

          • EVENT_PERIODIC = ' '

          jobcount = LOCAL_JOB-JOBCOUNT

          jobname = LOCAL_JOB-JOBNAME

          • LASTSTRTDT = NO_DATE

          • LASTSTRTTM = NO_TIME

          • PRDDAYS = 0

          • PRDHOURS = 0

          • PRDMINS = 0

          • PRDMONTHS = 0

          • PRDWEEKS = 0

          • PREDJOB_CHECKSTAT = ' '

          • PRED_JOBCOUNT = ' '

          • PRED_JOBNAME = ' '

          • SDLSTRTDT = NO_DATE

          • SDLSTRTTM = NO_TIME

          • STARTDATE_RESTRICTION = BTC_PROCESS_ALWAYS

          STRTIMMED = 'X'

          • TARGETSYSTEM = ' '

          • START_ON_WORKDAY_NOT_BEFORE = SY-DATUM

          • START_ON_WORKDAY_NR = 0

          • WORKDAY_COUNT_DIRECTION = 0

          RECIPIENT_OBJ = RECIPIENT_OBJ

          • TARGETSERVER = ' '

          • DONT_RELEASE = ' '

          • IMPORTING

          • JOB_WAS_RELEASED = 'X'

          EXCEPTIONS

          CANT_START_IMMEDIATE = 1

          INVALID_STARTDATE = 2

          JOBNAME_MISSING = 3

          JOB_CLOSE_FAILED = 4

          JOB_NOSTEPS = 5

          JOB_NOTEX = 6

          LOCK_FAILED = 7

          OTHERS = 8

          .

          IF ( SY-SUBRC <> 0 ).

          WRITE: / 'Job_Close Problem:', ABAPNAME, SY-SUBRC.

          ELSE.

          WRITE: / 'Job_Close done'.

          ENDIF.

          ELSE. "no empfname

          ...

          ENDIF.

          thanks

          mrutyun^

          Add a comment
          10|10000 characters needed characters exceeded

        • author's profile photo Former Member
          Former Member
          Posted on Jan 28, 2008 at 12:26 PM

          HI,

          U have to use 3 FMs

          job_open.

          Job_submit

          job_close

          to schedule a job from ur report.

          Cheers,

          Will.

          Add a comment
          10|10000 characters needed characters exceeded

        • author's profile photo Former Member
          Former Member
          Posted on Jan 28, 2008 at 12:31 PM

          Hi Julio,

          You have to use the function modules

          JOB_OPEN , JOB_SUBMIT, JOB_CLOSE.

          Refer the link

          http://help.sap.com/saphelp_nw04/helpdata/en/fa/096d4d543b11d1898e0000e8322d00/frameset.htm

          Add a comment
          10|10000 characters needed characters exceeded

          • Raj S Julio Pita de la Vega

            HI Julio

            You cant use a Job_submit only for a perform ever though its your own program.. you can use that perform in some other report,

            perform <subroutine name> in program<prgnam> using &var& using &var& using &var&.
            
            or 
            
            PERFORM
            SUBROUTINE_NAME(REPORT_NAME_WHERE_THIS_SUBROUTINE_IS_THERE)
            TABLES ITAB1 ITAB2...
            

        Before answering

        You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
        You must be Logged in to submit an answer.

        Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.