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

Catching Errors of a Batch Input

Former Member
0 Likes
793

Good Morning,

I'm using the following to generate a Batch Input:


* Generate BI folder (Standard program)

  CONCATENATE text-001 pa_bukrs sy-datum
         INTO jobname
 SEPARATED BY space.

  CALL FUNCTION 'JOB_OPEN'
    EXPORTING
      jobname          = jobname
    IMPORTING
      jobcount         = jobcount
    EXCEPTIONS
      cant_create_job  = 1
      invalid_job_data = 2
      jobname_missing  = 3
      OTHERS           = 4.

  IF sy-batch IS INITIAL.
    SUBMIT (programa) VIA JOB jobname NUMBER jobcount
            TO SAP-SPOOL AND RETURN IMMEDIATELY ' '
            WITH ds_name = pa_filed
            WITH fl_check = space
            WITH callmode = 'D'
            WITHOUT SPOOL DYNPRO.
  ELSE.
    SUBMIT (programa) VIA JOB jobname NUMBER jobcount
            TO SAP-SPOOL AND RETURN IMMEDIATELY ' '
            WITH ds_name = pa_filed
            WITH fl_check = space
            WITH callmode = 'B'
            WITHOUT SPOOL DYNPRO.
  ENDIF.

  CALL FUNCTION 'JOB_CLOSE'
    EXPORTING
      jobcount             = jobcount
      jobname              = jobname
      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 EQ 0.
    MESSAGE i090(z3) WITH jobname.
  ELSE.
    MESSAGE e089(z3) WITH jobname.
  ENDIF.

  SUBMIT rsbdcsub AND RETURN WITH mappe = pasta.

I have two questions concerning this:

1st - What's the difference between callmode 'B' and call mode 'D'? I've tested the two modes and i can see that with mode 'B' when i go to sm35 the batch is there, and if i use mode 'D' nothing is created there.

2nd - I need to know if the job had errors and if so, i need to be able to know the description of the errors and return that information to a internal table in order to display it. Is this possible, if yes, how can i do that in my program?

Best Regards,

Pedro Gaspar

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
431

Hi,

obviously B creates a session (Batch input folder) and the other call mode is Dialog.

For the B mode: you can see only after you executed the session the errors or succesfully posted docs in the protocol in SM35.

D will execute the postings in background immediately. Check in SM37 the "job-log".

Rgds,

JP

1 REPLY 1
Read only

Former Member
0 Likes
432

Hi,

obviously B creates a session (Batch input folder) and the other call mode is Dialog.

For the B mode: you can see only after you executed the session the errors or succesfully posted docs in the protocol in SM35.

D will execute the postings in background immediately. Check in SM37 the "job-log".

Rgds,

JP