SAP for Utilities Discussions
Connect with fellow SAP users to share best practices, troubleshoot challenges, and collaborate on building a sustainable energy future. Join the discussion.
cancel
Showing results for 
Search instead for 
Did you mean: 

Batch process with user interface

Former Member
0 Kudos

Hi Gurus

i have a requirement in which a batch process gets driven by a user interface which will have the options to be selected for ex " gas .electricity,water" and if either of them gets selected the batch program will get triggered fetching data from the table developed.i need a bit of clarification if the user interfca e should be created seperated and batch process seperate and integrate it or if the batch program itself can have its own screen.

Pls clarify

Thanks

1 ACCEPTED SOLUTION

paul_bakker2
Active Contributor
0 Kudos

Hi,

What you're asking is more an ABAP question than IS Utilities.

One way to achieve this is to create background jobs from your interface. Use the function modules JOB_OPEN and JOB_CLOSE.

For example:



* Open a new job
  CALL FUNCTION 'JOB_OPEN'
    EXPORTING
      DELANFREP              = ' '
      JOBGROUP               = 'ZHTER129'
      JOBNAME                = v_print_job_name
    IMPORTING
      JOBCOUNT               = v_print_job_nr
    EXCEPTIONS
      CANT_CREATE_JOB        = 1
      INVALID_JOB_DATA       = 2
      JOBNAME_MISSING        = 3
      OTHERS                 = 4.

  IF SY-SUBRC <> 0.
*     if anything went wrong delete the job
    CALL FUNCTION 'BP_JOB_DELETE'
      EXPORTING
        JOBCOUNT                       = v_print_job_nr
        JOBNAME                        = v_print_job_name.

     message e000(zb) with 'Unable to create job for'
                           'print utility ZHTER129'
                          'return code = ' sy-subrc.
  ENDIF.

* Submit the dunning print utility ZHTER129 via background job
  SUBMIT ZHTER129
            WITH P_LAUFD = p_laufd
            WITH P_LAUFI = p_laufi
            VIA JOB v_print_job_name
            NUMBER v_print_job_nr
            AND RETURN.

  if sy-subrc ne 0.
    message e000(zb) with 'Unable to submit to'
                          'print utility ZHTER129'
                          'return code = ' sy-subrc.
  endif.


    CALL FUNCTION 'JOB_CLOSE'
      EXPORTING
        JOBCOUNT                          = v_print_job_nr
        JOBNAME                           = v_print_job_name

hope this helps

Paul Bakker

View solution in original post

1 REPLY 1

paul_bakker2
Active Contributor
0 Kudos

Hi,

What you're asking is more an ABAP question than IS Utilities.

One way to achieve this is to create background jobs from your interface. Use the function modules JOB_OPEN and JOB_CLOSE.

For example:



* Open a new job
  CALL FUNCTION 'JOB_OPEN'
    EXPORTING
      DELANFREP              = ' '
      JOBGROUP               = 'ZHTER129'
      JOBNAME                = v_print_job_name
    IMPORTING
      JOBCOUNT               = v_print_job_nr
    EXCEPTIONS
      CANT_CREATE_JOB        = 1
      INVALID_JOB_DATA       = 2
      JOBNAME_MISSING        = 3
      OTHERS                 = 4.

  IF SY-SUBRC <> 0.
*     if anything went wrong delete the job
    CALL FUNCTION 'BP_JOB_DELETE'
      EXPORTING
        JOBCOUNT                       = v_print_job_nr
        JOBNAME                        = v_print_job_name.

     message e000(zb) with 'Unable to create job for'
                           'print utility ZHTER129'
                          'return code = ' sy-subrc.
  ENDIF.

* Submit the dunning print utility ZHTER129 via background job
  SUBMIT ZHTER129
            WITH P_LAUFD = p_laufd
            WITH P_LAUFI = p_laufi
            VIA JOB v_print_job_name
            NUMBER v_print_job_nr
            AND RETURN.

  if sy-subrc ne 0.
    message e000(zb) with 'Unable to submit to'
                          'print utility ZHTER129'
                          'return code = ' sy-subrc.
  endif.


    CALL FUNCTION 'JOB_CLOSE'
      EXPORTING
        JOBCOUNT                          = v_print_job_nr
        JOBNAME                           = v_print_job_name

hope this helps

Paul Bakker