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

Printing Smartform using IN BACKGROUD TASK

Former Member
0 Likes
1,136

Hello

I am having trouble printing a Smartfrom in BACKGROUND. When I remove IN BACKGROUND TASK printing works fine. Below is my code.

CALL FUNCTION 'ZPP_PRINT_ZLINK_TAG'

IN BACKGROUND TASK

EXPORTING

p_matnr = gs_s0100-matnr

TABLES

pt_zlink = gt_zlink.

I checked the following trans but nothing related to my job : SP01, SP02, SM50 & SM37

Below are the parms which are used in FM 'ZPP_PRINT_ZLINK_TAG' in calling the smartform:

*Parameters for CALL FUNCTION fm_name

CLEAR gs_control_param.

gs_control_param-no_dialog = 'X'.

gs_control_param-device = 'PRINTER'.

gs_control_param-langu = 'E'.

CLEAR gs_output.

gs_output-tddest = 'CORU'.

gs_output-tdimmed = 'X'.

gs_output-tddelete = 'X'.

CALL FUNCTION fm_name

EXPORTING

control_parameters = gs_control_param

output_options = gs_output

user_settings = space

zstr_zlinktag = zstr_zlinktag

EXCEPTIONS

formatting_error = 1

internal_error = 2

send_error = 3

user_canceled = 4

OTHERS = 5.

Thanks

Gary

1 ACCEPTED SOLUTION
Read only

Subhankar
Active Contributor
0 Likes
974

Hi ,

You have to do a commit work after the FM call. Other wise background task FM will not call.

CALL FUNCTION 'ZEMAILDET_SR_FUNC' IN BACKGROUND TASK
    EXPORTING
      guid = l_guid.

  COMMIT WORK.

and rest of the coding is fine.

Thanks

Subhankar.

5 REPLIES 5
Read only

Former Member
0 Likes
974

Hi Gary,

probably Your CORU printer uses frontend printing which is not supported in background.

Check SPAD transaction - I thing You have 'Host Spool Access Method' set to F or G.

Regards,

--

Przemysław

Read only

0 Likes
974

I checked trans SPAD and CORU is to the following:

C - Direct operating system call

Should I changed to some other access method?

Thanks for responding

Read only

0 Likes
974

Hi,

no, do not change it - C is the correct one

Read only

0 Likes
974

Hi Przemyslaw

I will not change, will leave at "C". Prints in foregrand but not backgound wonder if it has something to do with printer settings?

Thanks

Read only

Subhankar
Active Contributor
0 Likes
975

Hi ,

You have to do a commit work after the FM call. Other wise background task FM will not call.

CALL FUNCTION 'ZEMAILDET_SR_FUNC' IN BACKGROUND TASK
    EXPORTING
      guid = l_guid.

  COMMIT WORK.

and rest of the coding is fine.

Thanks

Subhankar.