Application Development 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: 

Download smartform as word document

Former Member
0 Kudos

Dear All,

I need to download smartform as word document. i have used CALL FUNCTION 'CONVERT_OTF' but only word document is creating and downloading without content. How to solve?  kindly see the below code, where i have missed? Kindly advice..


CALL FUNCTION 'CONVERT_OTF'

    EXPORTING

      format                      = 'DOC'

    MAX_LINEWIDTH               = 255

*   ARCHIVE_INDEX               = ' '

*   COPYNUMBER                  = 0

*   ASCII_BIDI_VIS2LOG          = ' '

*   PDF_DELETE_OTFTAB           = ' '

*   PDF_USERNAME                = ' '

*   PDF_PREVIEW                 = ' '

*   USE_CASCADING               = ' '

  IMPORTING

    BIN_FILESIZE                = bin_filesize

*   BIN_FILE                    =

     TABLES

      otf                         = t_otf

       lines                       = t_lines

    EXCEPTIONS

      err_max_linewidth           = 1

      err_format                  = 2

      err_conv_not_possible       = 3

      err_bad_otf                 = 4

      OTHERS                      = 5

             .

   IF sy-subrc <> 0.

* Implement suitable error handling here

   ENDIF.

Thanks & Regards,

Ranjini

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hello Ranjini,

What is the sy-subrc value after CONVERT_OTF FM execution?

Is the T_OTF table filled properly before CONVERT_OTF FM?

I hope you have executed the smartform FM and filled the OTF table (Below is an example).

CALL FUNCTION '/1BCDWB/SF00000234'

  EXPORTING

  control_parameters         =  cparam

  output_options             = outop

   user_settings              = space

*  s_header                   = st_header

  IMPORTING

    job_output_info            = tab_otf_data

  TABLES

       t_ekpo                     = it_ekpo

10 REPLIES 10

Former Member
0 Kudos

Hello Ranjini,

What is the sy-subrc value after CONVERT_OTF FM execution?

Is the T_OTF table filled properly before CONVERT_OTF FM?

I hope you have executed the smartform FM and filled the OTF table (Below is an example).

CALL FUNCTION '/1BCDWB/SF00000234'

  EXPORTING

  control_parameters         =  cparam

  output_options             = outop

   user_settings              = space

*  s_header                   = st_header

  IMPORTING

    job_output_info            = tab_otf_data

  TABLES

       t_ekpo                     = it_ekpo

0 Kudos

Hi Ajeet,

smartform FM code is:

CALL FUNCTION '/1BCDWB/SF00000099' "fm_name

     EXPORTING

*     ARCHIVE_INDEX        =

*     ARCHIVE_INDEX_TAB    =

*     ARCHIVE_PARAMETERS   =

        CONTROL_PARAMETERS         = cont_param

*     MAIL_APPL_OBJ        =

*     MAIL_RECIPIENT       =

*     MAIL_SENDER          =

       OUTPUT_OPTIONS             = out_opt

       USER_SETTINGS        = ' '

       c_code               = c_code

       f_year               = f_year

       v_gcode              = v_gcode

       v_ven                = v_ven

       v_ccode              = v_ccode

       v_gl                 = v_gl

       v_cust               = v_cust

       v_vendor             = v_vendor

     IMPORTING

   "   DOCUMENT_OUTPUT_INFO = w_doc1

       job_output_info      = w_joboutput

    "  JOB_OUTPUT_OPTIONS   = w_doc3

     EXCEPTIONS

       formatting_error     = 1

       internal_error       = 2

       send_error           = 3

       user_canceled        = 4

       OTHERS               = 5.

   t_otf[] = w_joboutput-otfdata[].


here i am not getting record for w_joboutput. that is the problem..

i am not getting why it is not filling??


Thanks & Regards,

Ranjini

0 Kudos

HI Rajini,

Try executing the Smartform directly and see whether its displaying the form.

if there is some problem with the smartform then JOBOUTPUT value will not come.

Regards,

Shony

0 Kudos

Hi Shony,

I have executed the smartform directly. smartform is opening with values and data properly.

but no value displaying in JOB_OUTPUT_INFO.

Kindly advice.

Thanks & Regards,

Ranjini

0 Kudos

Hi Ranjini,

is it returning an exception while running the Function module ?

EXCEPTIONS

       formatting_error     = 1

       internal_error       = 2

       send_error           = 3

       user_canceled        = 4

       OTHERS               = 5.



Regards,

Shony

0 Kudos

Hi,

Thanks for the reply. its not returning any exceptions. The smartform is executing and its converting and downloading into word format also. but data is not displaying, it is saying 0 bytes transferred.

Thanks & Regards,

Ranjini

0 Kudos

Hi Ranjini,

Try this,

pass the GETOTF parameter in the control parameters as 'X'

Hope this will solve the issue

Regards,

Shony

0 Kudos

Hi Shony,

Yes, now the data is filling in w_joboutput.

I am assigning the data to t_otf like as shown below:

t_otf[] = w_joboutput-otfdata[].

CALL FUNCTION 'CONVERT_OTF'

    EXPORTING

      format                      = 'DOC'

    MAX_LINEWIDTH               = 255

*   ARCHIVE_INDEX               = ' '

*   COPYNUMBER                  = 0

*   ASCII_BIDI_VIS2LOG          = ' '

*   PDF_DELETE_OTFTAB           = ' '

*   PDF_USERNAME                = ' '

*   PDF_PREVIEW                 = ' '

*   USE_CASCADING               = ' '

  IMPORTING

    BIN_FILESIZE                = bin_filesize

*   BIN_FILE                    =

     TABLES

      otf                           = t_otf

       lines                       = t_lines

    EXCEPTIONS

      err_max_linewidth           = 1

      err_format                       = 2

      err_conv_not_possible     = 3

      err_bad_otf                     = 4

      OTHERS                      = 5

             .

here i got exception  2 ie err_format.

any corrections needs to be done? the word document is displying without data.

Thanks & Regards,

Ranjini

0 Kudos

This message was moderated.

0 Kudos

Hi Shony,

Thanks. It works. But In my Smartform, tables are there, that table lines is not displaying it is just showing as text without table format.

Anyways thanks.

Thanks & Regards,

Ranjini