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: 

Problem Submit Via Job in BADI

former_member189779
Active Contributor
0 Kudos

Hello All

I am using SUBMIT VIA JOB in BADI "work order update" and but no job is created....also sy-subrc is 0.

Here is the code

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 z_idoc_create_process_order and return

via job name number number

with p_aufnr = it_header1-aufnr

with p_werks = it_header1-werks

with p_autyp = c_autyp

with p_auart = it_header1-auart

with p_dispo = it_header1-dispo

with p_opt = c_opt

with p_mestyp = c_mestyp.

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.

Any reason why job is not created?

Thanks in advance.

regads

VInit

6 REPLIES 6

david_tuohy2
Participant
0 Kudos

Hi Vinit

this might be helpful to you :

<link to blocked site removed by moderator>

Have just discovered this myself in relation similar issue, but haven't used yet.

This may help tell you status of Job and give you more info:

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.

Regards,

David

Edited by: Thomas Zloch on Feb 9, 2012 10:59 PM

0 Kudos

HI David,

I can not see the job in SM37 itself. Seems its not created....Can't we do this in BADI?

Regards\VInit

0 Kudos

Hi Vinit,

It is hard for me to say why you're getting this error, but in FMs JOB_OPEN and JOB_CLOSE description you can find (incl. COMMIT WORK), so I don't think this is a good idea to use them in BADI.

Best Regards

Marcin Cholewczuk

0 Kudos

HI The job is getting created now but new problem

I am using following code to start a job via SUBMIT

submit z_idoc_create_process_order to sap-spool and return

with p_aufnr = it_header1-aufnr

with p_werks = it_header1-werks

with p_autyp = c_autyp

with p_auart = it_header1-auart

with p_dispo = it_header1-dispo

with p_opt = c_opt

with p_mestyp = c_mestyp

user creator spool parameters print_parameters

without spool dynpro

via job name number number

.

When I add user its giving my subrc 8 and not job is created. But when I do without user addition Job is created successfully.

I also confirmed there no authorization issue as well

Anything I am missing/doing wrong?

Regards

VInit

0 Kudos

Hi guys,

I tried this

SUBMIT z_idoc_create_process_order USER creator using selection-set lv_variant TO SAP-SPOOL

SPOOL PARAMETERS print_parameters

WITHOUT SPOOL DYNPRO

WITH p_aufnr EQ it_header1-aufnr

WITH p_werks EQ it_header1-werks

WITH p_autyp EQ c_autyp

WITH p_auart EQ it_header1-auart

WITH p_dispo EQ it_header1-dispo

WITH p_opt EQ c_opt

WITH p_mestyp EQ c_mestyp

VIA JOB name NUMBER number

AND RETURN.

Now the job is getting created but my Variant has no values

How to pass values to variant? below values are not getting tranferred.

WITH p_aufnr EQ it_header1-aufnr

WITH p_werks EQ it_header1-werks

WITH p_autyp EQ c_autyp

WITH p_auart EQ it_header1-auart

WITH p_dispo EQ it_header1-dispo

WITH p_opt EQ c_opt

WITH p_mestyp EQ c_mestyp

former_member189779
Active Contributor
0 Kudos

I solved it..was strange AUTH issue.