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

How to skip background print parameters when we execute program in background

Former Member
0 Likes
2,026

Hi experts,

I want to skip the background parameters popup when we execute the program in background. Please let me know whether we can do with configuration or coding. Waiting for your replies.

Thanks

1 ACCEPTED SOLUTION
Read only

paul_bakker2
Active Contributor
0 Likes
1,216

Hi,

You can do it like this:

  SUBMIT (P_PROGRAM) TO SAP-SPOOL

                 SPOOL PARAMETERS ls_print_parameters 

                 WITHOUT SPOOL DYNPRO

                 with selection-table t_rsparams

                 VIA JOB lv_jobname

                 NUMBER lv_jcount

                 AND RETURN.

.. and here's some sample code for filling structure ls_print_parameters

* Build the structure with print parameters. The function module

* fills in required fields which are not specified

CALL FUNCTION 'GET_PRINT_PARAMETERS'

  EXPORTING

    DESTINATION                  = ls_print_params-PDEST

    IMMEDIATELY                  = ls_print_params-PRIMM

    RELEASE                      = ls_print_params-PRREL

    EXPIRATION                   = ls_print_params-PEXPI

    LAYOUT                       = ls_print_params-PAART

    NEW_LIST_ID                  = 'X'  "new spool request

    NO_DIALOG                    = 'X'  "background processing

  IMPORTING

    OUT_PARAMETERS               = ls_print_parameters

    VALID                        = lv_valid

* EXCEPTIONS

*   ARCHIVE_INFO_NOT_FOUND       = 1

*   INVALID_PRINT_PARAMS         = 2

*   INVALID_ARCHIVE_PARAMS       = 3

*   OTHERS                       = 4

          .

if lv_valid ne 'X'.

  clear ls_print_parameters .

endif.

cheers

Paul

3 REPLIES 3
Read only

Former Member
0 Likes
1,216

Hi Nandan,

You can use FM's as JOB_OPEN, JOB_SUBMIT and JOB_CLOSE.

For more details go through:

http://scn.sap.com/thread/99590

http://help.sap.com/saphelp_nw73ehp1/helpdata/en/4d/906689eba36e73e10000000a15822b/content.htm

Regards,

Ganesh Lathi

Read only

paul_bakker2
Active Contributor
0 Likes
1,217

Hi,

You can do it like this:

  SUBMIT (P_PROGRAM) TO SAP-SPOOL

                 SPOOL PARAMETERS ls_print_parameters 

                 WITHOUT SPOOL DYNPRO

                 with selection-table t_rsparams

                 VIA JOB lv_jobname

                 NUMBER lv_jcount

                 AND RETURN.

.. and here's some sample code for filling structure ls_print_parameters

* Build the structure with print parameters. The function module

* fills in required fields which are not specified

CALL FUNCTION 'GET_PRINT_PARAMETERS'

  EXPORTING

    DESTINATION                  = ls_print_params-PDEST

    IMMEDIATELY                  = ls_print_params-PRIMM

    RELEASE                      = ls_print_params-PRREL

    EXPIRATION                   = ls_print_params-PEXPI

    LAYOUT                       = ls_print_params-PAART

    NEW_LIST_ID                  = 'X'  "new spool request

    NO_DIALOG                    = 'X'  "background processing

  IMPORTING

    OUT_PARAMETERS               = ls_print_parameters

    VALID                        = lv_valid

* EXCEPTIONS

*   ARCHIVE_INFO_NOT_FOUND       = 1

*   INVALID_PRINT_PARAMS         = 2

*   INVALID_ARCHIVE_PARAMS       = 3

*   OTHERS                       = 4

          .

if lv_valid ne 'X'.

  clear ls_print_parameters .

endif.

cheers

Paul

Read only

Former Member
0 Likes
1,216

Hi Nandan,

Please try below code.

  DATA: lv_jobname TYPE btcjob,
      lv_jb_count TYPE tbtcjob-jobcount,
      lw_out TYPE pri_params,
      lw_stp_cnt TYPE tbtcjob-stepcount.


CONCATENATE sy-cprog sy-datum sy-uzeit INTO lv_jobname SEPARATED BY '_'.

START-OF-SELECTION.
*submit rsbdcsub
  CALL FUNCTION 'JOB_OPEN'
    EXPORTING
      jobname          = lv_jobname
      sdlstrtdt        = sy-datum
      sdlstrttm        = sy-uzeit
    IMPORTING
      jobcount         = lv_jb_count
    EXCEPTIONS
      cant_create_job  = 1
      invalid_job_data = 2
      jobname_missing  = 3
      OTHERS           = 4.

  CALL FUNCTION 'GET_PRINT_PARAMETERS'
    EXPORTING
      no_dialog                = 'X'
    IMPORTING
*     OUT_ARCHIVE_PARAMETERS   =
      out_parameters           = lw_out
*     VALID                    = lw_valid
*     VALID_FOR_SPOOL_CREATION =
    EXCEPTIONS
      archive_info_not_found   = 1
      invalid_print_params     = 2
      invalid_archive_params   = 3
      OTHERS                   = 4.
  IF sy-subrc <> 0.
* Implement suitable error handling here
  ENDIF.

  IF sy-subrc EQ 0.
    CALL FUNCTION 'JOB_SUBMIT'
      EXPORTING
        authcknam               = sy-uname
        jobcount                = lv_jb_count
        jobname                 = lv_jobname
        report                  = 'Your program name'
        priparams               = lw_out
      IMPORTING
        step_number             = lw_stp_cnt
      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.

        CALL FUNCTION 'JOB_CLOSE'
      EXPORTING
        jobcount             = lv_jb_count
        jobname              = lv_jobname
      EXCEPTIONS
        cant_start_immediate = 1
        invalid_startdate    = 2
        jobname_missing      = 3
        job_close_failed     = 4
        job_nosteps          = 5
        job_notex            = 6
        lock_failed          = 7
        invalid_target       = 8
        OTHERS               = 9.
    IF sy-subrc = 0.
      WRITE:/ 'Job done successfully'.
    ENDIF.
  ENDIF.

Thanks,

Sree