cancel
Showing results for 
Search instead for 
Did you mean: 

SAP spool for smartform generating but printing immediately

Former Member
0 Kudos

Hi Guys,

I have program which generates SPOOL for printing but I do not want to print immediately. I tried setting control parameter and output paramets but nothing worked out. But when I unchecking Print output immediately in SU01 I am able to get desired SPOOL waiting to be printed. But I want this to happen without changes in SU01....Please Help

DATA :
  fm_name TYPE rs38l_fnam,
  it_vbak TYPE TABLE OF vbak.

*SELECT * FROM vbak into TABLE it_vbak
*  WHERE vbeln GE '0100000004'
*  AND vbeln LE '0100000010'.

DATA :
  gs_control_parameters TYPE SSFCTRLOP,
  gs_output_options TYPE SSFCOMPOP.


gs_output_options-TDIMMED = '  ' .

gs_control_parameters-no_dialog = 'X'.
gs_output_options-tdnewid = 'X'.

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
  EXPORTING
    formname = 'ZCH_LABEL_ONE'

  IMPORTING
    FM_NAME = fm_name
  EXCEPTIONS
    NO_FORM = 1
    NO_FUNCTION_MODULE = 2
    OTHERS = 3.

CALL FUNCTION fm_name
  EXPORTING
    control_parameters = gs_control_parameters
    output_options = gs_output_options
  EXCEPTIONS
    FORMATTING_ERROR = 1
    INTERNAL_ERROR = 2
SEND_ERROR = 3
    USER_CANCELED = 4
   OTHERS = 5
.

Accepted Solutions (1)

Accepted Solutions (1)

former_member215575
Active Participant
0 Kudos

CALL FUNCTION fm_name
  EXPORTING
    control_parameters = gs_control_parameters
    output_options = gs_output_options
  EXCEPTIONS
    FORMATTING_ERROR = 1
    INTERNAL_ERROR = 2
SEND_ERROR = 3
    USER_CANCELED = 4
   OTHERS = 5
.

While calling above FM, in exporting parameters, add user_settings      = ' '  and try.

Regards,

SG        

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi All,

Issue is resolved...

Solution (1) setting user_setting = ' '.............

Solution (2)Using BAPI_USER_CHANGE is also a good option......one can use it for other application also...

Send_ERROR was due to spool overflow.....I deleted the old spool requests......i got the new spools

former_member215575
Active Participant
0 Kudos

Hi Chetan,

Yes, setting user_setting = ' ' will make the system to ignore the user default settings..as you are already making gs_output_options-TDIMMED = '  ' , it will not print immediately.

I was just wondering all these days watching you thread for what you have been still waiting for .

Regards,

SG.

Former Member
0 Kudos

Hi All,

I have been trying all your suggestions. Now a new problem has occured. SEND_ERROR = 3 is causing problem....

Aashish28
Contributor
0 Kudos

Hiii chetan ,

                     I have one idea for this problem which i had used for removing immediate print and again set

                   1)  Before print i used - BAPI_USER_GET_DETAIL and get detail  defaults by user name.

                   than set parameter

    * defaults-spdb = 'G'.    " Set Immediate
     defaults-spdb = 'H'.    " Reset Immediate
    defaultsx-spdb = 'X'.
                   

                    2)  pass this default to BAPI_USER_CHANGE and Reset Immediate parameter as i show above.

                    after print - than again if you want to reset same  

                   3) Use again - BAPI_USER_CHANGE .

Former Member
0 Kudos

I wil try this out. Thank you very much.... Any comments on SEND_ERROR problem

Aashish28
Contributor
0 Kudos

Hiii,

       SEND_ERROR problem - do you want to send mail of same smart form also ?????  what parameter you have set ???

iftah_peretz
Active Contributor
0 Kudos

Hi,

Rap this program with a dummy selection screen - that does nothing, then on the selection screen choose in menu program--->execute on back ground.

Once you run this job in the background and under properties of the printing settings (the first dialog box that pops up after asking to run job in background) and double click the print immediately and chose print to sap spool for now.

That should do the job,

Best,

Iftah

Former Member
0 Kudos

No doubt it worked.....Thanks but the purpose is not solved because I am executing this piece of code in webdynpro method so how can I schedule in Background ????

iftah_peretz
Active Contributor
0 Kudos

Well, a naive solution would be:

at beginng of your RFC to create a bdc that changes the SU01. Then your RFC logic and then a bdc to change back SU01.

What do you think?