Skip to Content
0
Former Member
May 14, 2010 at 09:30 PM

Background task to archive smartform document

69 Views

Hi gurus,<p>

<p>

I'm nearly giving up...<p>

I want to fill and archive a smartform document as a background step within a worfklow.<p>

<p><p>

When running this task as a dialog task, everything is working fine. The smartform document ist archived.

When running in background I receive the error 'formatting_error' from the smartform function module.<p>

<p>

I went thought my smartform document many times. I don't find any error.<p>

WF-Batch has SAP_ALL.<p>

<p>

Any ideas ?Find my coding below.<p>

<p>

Regards,Georg<p>

<p>

<p>

<p>
* Output_options<p>
 ls_ssfcompop-xsfcmode     = 'X'.<p>
 ls_ssfcompop--xsf                 = space.<p>
 ls_ssfcompop--xdfcmode    = 'X'.<p>
 ls_ssfcompop--xdf                 = space.<p>
 ls_ssfcompop--tdarmod      = '2'.  "Archive only<p>
 ls_ssfcompop--tddelete      = 'X'.<p>
 ls_ssfcompop--tdimmed     = 'X'.<p>
 ls_ssfcompop--tdnewid      = 'X'.<p>
 lv_len = 132.<p>
<p>
* Control parameters<p>
  ls_ssfctrlop-no_dialog = 'X'.<p>
  ls_ssfctrlop-device    = 'PRINTER'.<p>
<p>
* Get smartform FM<p>
  call function 'SSF_FUNCTION_MODULE_NAME'<p>
    exporting<p>
      formname           = lv_formname<p>
    importing<p>
      fm_name            = lv_fm_name<p>
    exceptions<p>
      no_form            = 1<p>
      no_function_module = 2<p>
      others             = 3.<p>
<p>
  if sy-subrc <> 0.<p>
    raise error_smartform.<p>
  endif.<p>
<p>
* Archivierungsparameter<p>
  ls_archive_index-function         = 'DARA'.<p>
  ls_archive_index-mandant       = sy-mandt.<p>
  ls_archive_index-sap_object   = lv_sap_object.<p>
  ls_archive_index-reserve          = 'COMMIT'.<p>
  ls_archive_index-ar_object      = lv_docart to.<p>
  ls_archive_index-object_id      = lv_object_id  to .<p>
  ls_archive_index-formarchiv    = lv_archiv_id.<p>
<p>
  append ls_archive_index to lt_archive_index_tab.<p>
*<p>
  ls_archive_parameters-mandant      = sy-mandt.<p>
  ls_archive_parameters-sap_object  = lv_sap_object.<p>
  ls_archive_parameters-ar_object     = lv_docart.<p>
  ls_archive_parameters-doc_type     = lv_doc_type.<p>
  ls_archive_parameters-printer          = 'LP01'.<p>
   ls_archive_parameters-archiv_id    =  lv_archiv_id.<p>
<p>
<p>
  call function lv_fm_name<p>
    exporting<p>
        archive_index                    = ls_archive_index<p>
        archive_index_tab             = lt_archive_index_tab<p>
        archive_parameters         = ls_archive_parameters<p>
        control_parameters         =  ls_ssfctrlop<p>
        output_options                 =  ls_ssfcompop<p>
        user_settings                   = space<p>
       im_data                              = lt_data<p>
    importing<p>
        job_output_info            =           gs_output_data<p>
   exceptions<p>
       formatting_error           = 1<p>
       internal_error                = 2<p>
       send_error                    = 3<p>
      user_canceled              = 4<p>
       others                             = 5.<p>