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

Problem submitting a report in back ground

Former Member
0 Likes
1,629

Hi,

I'm trying to submit a report in background and I always get an error saying make an entry in all required fields. But it works perfectly fine in foreground. I'm not sure what am I doing wrong. Pls suggest.............I'm not using any front end FMs...

SUBMIT RKAEP000 via selection-screen

USING SELECTION-SCREEN 310

with p_tcode eq 'KOB2'

WITH SELECTION-TABLE seltab

TO SAP-SPOOL WITHOUT SPOOL DYNPRO

AND RETURN.

Hi,

I'm trying to submit a report in background and I always get an error saying make an entry in all required fields. But it works perfectly fine in foreground. I'm not sure what am I doing wrong. Pls suggest.............I'm not using any front end FMs...

SUBMIT RKAEP000 via selection-screen

USING SELECTION-SCREEN 310

with p_tcode eq 'KOB2'

WITH SELECTION-TABLE seltab

TO SAP-SPOOL WITHOUT SPOOL DYNPRO

AND RETURN.

12 REPLIES 12
Read only

Former Member
0 Likes
1,557

You should syntax similar to what is below...

DATA: number TYPE tbtcjob-jobcount, 
      name TYPE tbtcjob-jobname VALUE 'JOB_TEST', 
      print_parameters TYPE pri_params. 

... 

CALL FUNCTION 'JOB_OPEN' 
  EXPORTING 
    jobname          = name 
  IMPORTING 
    jobcount         = number 
  EXCEPTIONS 
    cant_create_job  = 1 
    invalid_job_data = 2 
    jobname_missing  = 3 
    OTHERS           = 4. 
IF sy-subrc = 0. 
  SUBMIT submitable TO SAP-SPOOL 
                    SPOOL PARAMETERS print_parameters 
                    WITHOUT SPOOL DYNPRO 
                    VIA JOB name NUMBER number 
                    AND RETURN. 
  IF sy-subrc = 0. 
    CALL FUNCTION 'JOB_CLOSE' 
      EXPORTING 
        jobcount             = number 
        jobname              = name 
        strtimmed            = '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. 
      ... 
    ENDIF. 
  ENDIF. 
ENDIF.

Read only

Former Member
0 Likes
1,557

Just check whether u have filled all the mandatory fields for the selection screen 310 in the submit statement or not ???

could u send all the field names in that screen 310.. once ( with their mandatory status )..

reward helpful answers..

sai ramesh

Read only

Former Member
0 Likes
1,557

You cannot execute a background job with a job name obtained through JOB_OPEN function call.

I hope this is clear.

Read only

0 Likes
1,557

Hi Vishnu,

I'm yet to try ur method. But now r u trying to tell what u have suggested wud not work in background..........pls clarify

Read only

0 Likes
1,557

Oops that was a typo, sorry

You cannot execute a background job with<u>out</u> a job name which is obtained through JOB_OPEN function call.

I hope this is clear. The background process needs a job to execute right?

Read only

0 Likes
1,557

Hi,

Thanx for clarifications. But when run with job name creation, while creating the job name I'm getting this below error....

"BTC_A2C_CLEAN_ZOMBIE_LOG" has already been declared.

Read only

0 Likes
1,557

Paste your code, to let me understand what you did

Read only

0 Likes
1,557

Thnx,

sorry it looks like some config problem I didnt get tht error for FM job_open in other boxes.

Read only

0 Likes
1,557

If you problem is solved, don't forget to update this thread as solved and possibly reward if you thought it really helped.

Read only

0 Likes
1,557

Hi Vishnu,

Sorry for the delay, I was trying out other options but in vain. tried using open_job,

job_submit, close_job. Nothing is working for me. Everytime I get an error saying make an entry to all required fields and as far as my knwledge there r no other mandatory fields and it works well in foreground. What else cud be wrong any guessessssssssssssss??????????????

Read only

0 Likes
1,557

Hi chesat

u just compare ur code with this...

Using JOB_OPEN,JOB_SUBMIT,JOB_CLOSE

Demo Program:

REPORT YJob .

DATA : v_jobhead LIKE tbtcjob.

DATA : v_jobcount LIKE tbtcjob-jobcount.

DATA : v_eventparm LIKE tbtcjob-eventparm.

DATA : v_flg_released TYPE c.

DATA: e_error.

DATA: running LIKE tbtcv-run.

TYPES: esp1_boolean LIKE boole-boole.

CONSTANTS: esp1_false TYPE esp1_boolean VALUE ' ',

esp1_true TYPE esp1_boolean VALUE 'X'.

CONSTANTS: true TYPE boolean VALUE esp1_true,

false TYPE boolean VALUE esp1_false.

PARAMETERS: v_jobnam LIKE tbtcjob-jobname,

v_report LIKE sy-repid,

v_varian LIKE raldb-variant,

v_uname LIKE sy-uname.

START-OF-SELECTION.

  • add the new job

CALL FUNCTION 'JOB_OPEN'

EXPORTING

  • delanfrep = 'X'

jobname = v_jobnam

IMPORTING

jobcount = v_jobcount

EXCEPTIONS

cant_create_job = 1

invalid_job_data = 2

jobname_missing = 3

OTHERS = 4.

IF sy-subrc <> 0.

e_error = true.

ELSE.

CALL FUNCTION 'JOB_SUBMIT'

EXPORTING

authcknam = v_uname

jobcount = v_jobcount

jobname = v_jobnam

report = v_report

variant = v_varian

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.

e_error = true.

ELSE.

CALL FUNCTION 'JOB_CLOSE'

EXPORTING

  • EVENT_ID = IC_WWI_WORKPROCESS_EVENT

  • EVENT_PARAM = V_EVENTPARM

  • EVENT_PERIODIC = 'X'

jobcount = v_jobcount

jobname = v_jobnam

strtimmed = 'X'

IMPORTING

job_was_released = v_flg_released

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.

e_error = true.

ELSE.

DO.

CALL FUNCTION 'SHOW_JOBSTATE'

EXPORTING

jobcount = v_jobcount

jobname = v_jobnam

  • IMPORTING

  • ABORTED =

  • FINISHED =

  • PRELIMINARY =

  • READY =

  • running =

  • SCHEDULED =

EXCEPTIONS

jobcount_missing = 1

jobname_missing = 2

job_notex = 3

OTHERS = 4.

IF sy-subrc <> 0.

e_error = true.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

IF running = space.

EXIT.

ENDIF.

ENDDO.

ENDIF.

ENDIF.

ENDIF.

Are u using any ALV display while prinitng..??

Read only

0 Likes
1,557

job output is in ALV . It's from std trans cji5.