cancel
Showing results for 
Search instead for 
Did you mean: 

Download smartform from webdynpro

Former Member
0 Kudos

Hi !

I'm trying to download a smartform from a webdynpro to my pc. But, I don't know how. I try to do something but the last FM return me an expection "its_not_available".

This is my code;

DATA: lf_filesize TYPE  i,
lt_lines TYPE TABLE OF tline,
ls_info TYPE ssfcrescl,
ls_conpar TYPE ssfctrlop,
ls_output TYPE ssfcompop,
l_formname TYPE rs38l_fnam,
pdf TYPE C VALUE 'X',
resul TYPE  xstring,
ET_OTF TYPE TABLE OF ITCOO.


*-------------------------------
ls_conpar-langu = sy-langu.
ls_conpar-no_dialog = 'X'.

IF pdf = 'X'.
ls_output-tdnewid = 'X'.
ls_conpar-getotf = 'X'.
ELSE.
ls_output-tdimmed ='X'.
ENDIF.

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
  formname                 = 'ZXXXXX''
IMPORTING
  fm_name = l_formname
EXCEPTIONS
  no_form = 1
  no_function_module = 2
  OTHERS = 3.

CALL FUNCTION l_formname
EXPORTING
  control_parameters = ls_conpar
  output_options = ls_output
  user_settings = ' '
*  RFX         = lv_object_id
IMPORTING
  job_output_info = ls_info
EXCEPTIONS
  formatting_error = 1
  internal_error = 2
  send_error = 3
  user_canceled = 4
  OTHERS = 5.


CHECK pdf = 'X'.

et_otf[] = ls_info-otfdata[].

* convertir en OTF dicho formulario
*-----------------------------------
CALL FUNCTION 'CONVERT_OTF'
  EXPORTING
    format = 'PDF'
    pdf_delete_otftab = 'X'
  IMPORTING
    bin_filesize = lf_filesize
    bin_file = resul
  TABLES
    otf = et_otf
    lines = lt_lines
  EXCEPTIONS
    err_max_linewidth = 1
    err_format = 2
    err_conv_not_possible = 3
    OTHERS = 4.

** This code code works fine, but the requirement  is diferent;
**cl_wd_runtime_services=>attach_file_to_response(
**i_filename = 'report.PDF'
**i_content = resul
**i_mime_type = 'application/pdf'
**i_in_new_window = 'X'
**i_inplace = 'X' ).

** I try this;

  DATA:
    lt_pdf_lines             TYPE TABLE OF tline,
    lv_bin_filesize          TYPE i,
    lv_mimetype(30)          TYPE c,
    ls_pdf                   TYPE xstring,
    lt_content               TYPE bbpt_att_cont.

      CALL FUNCTION 'BBP_OUTPUT_X_SAVE_FILE'
        EXPORTING
          iv_xstring = resul.

 CALL FUNCTION 'BBP_OUTPUT_X_TABLESIZE_CHG'
          EXPORTING
            iv_xstring = resul
          IMPORTING
            ev_size    = lv_bin_filesize
          TABLES
            et_data    = lt_content
          EXCEPTIONS
            noentries  = 1
            OTHERS     = 2.


** THIS FM return me an exception
* display PDF file in Web or SAP GUI
        lv_mimetype = 'application/pdf'.
        CALL FUNCTION 'BBP_ALEWEB_DOWNLOAD'
          EXPORTING
            data_len          = lv_bin_filesize
            mime_type         = lv_mimetype
          TABLES
            data_tab          = lt_content
          EXCEPTIONS
            its_not_available = 1
            OTHERS            = 2.

How I can make this work?

Is there any way to automatically download this file in the user sapworklist?

Thanks in advance !

Edited by: Husalban RM on Jun 4, 2010 10:35 AM

Accepted Solutions (0)

Answers (3)

Answers (3)

ChrisPaine
Active Contributor
0 Kudos

Husalban RM,

That FM can't be used for WDA. Use the method suggested by mbanerjee.

Also - this has no relevence to Web Dynpro ABAP Floorplan Manager - you might want to post in the Web Dynpro ABAP forum in future unless - of course - you are asking about an FPM issue.

Regards,

Chris

Former Member
0 Kudos

I don't know. I post it again:

I'm trying to download a smartform from a webdynpro to my pc. But, I don't know how. I try to do something but the last FM return me an expection "its_not_available".

This is my code;

DATA: lf_filesize TYPE i,

lt_lines TYPE TABLE OF tline,

ls_info TYPE ssfcrescl,

ls_conpar TYPE ssfctrlop,

ls_output TYPE ssfcompop,

l_formname TYPE rs38l_fnam,

pdf TYPE C VALUE 'X',

resul TYPE xstring,

ET_OTF TYPE TABLE OF ITCOO.

ls_conpar-langu = sy-langu.

ls_conpar-no_dialog = 'X'.

IF pdf = 'X'.

ls_output-tdnewid = 'X'.

ls_conpar-getotf = 'X'.

ELSE.

ls_output-tdimmed ='X'.

ENDIF.

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

formname = 'ZXXXXX''

IMPORTING

fm_name = l_formname

EXCEPTIONS

no_form = 1

no_function_module = 2

OTHERS = 3.

CALL FUNCTION l_formname

EXPORTING

control_parameters = ls_conpar

output_options = ls_output

user_settings = ' '

  • RFX = lv_object_id

IMPORTING

job_output_info = ls_info

EXCEPTIONS

formatting_error = 1

internal_error = 2

send_error = 3

user_canceled = 4

OTHERS = 5.

CHECK pdf = 'X'.

et_otf[] = ls_info-otfdata[].

CALL FUNCTION 'CONVERT_OTF'

EXPORTING

format = 'PDF'

pdf_delete_otftab = 'X'

IMPORTING

bin_filesize = lf_filesize

bin_file = resul

TABLES

otf = et_otf

lines = lt_lines

EXCEPTIONS

err_max_linewidth = 1

err_format = 2

err_conv_not_possible = 3

OTHERS = 4.

    • I try this;

DATA:

lt_pdf_lines TYPE TABLE OF tline,

lv_bin_filesize TYPE i,

lv_mimetype(30) TYPE c,

ls_pdf TYPE xstring,

lt_content TYPE bbpt_att_cont.

CALL FUNCTION 'BBP_OUTPUT_X_SAVE_FILE'

EXPORTING

iv_xstring = resul.

CALL FUNCTION 'BBP_OUTPUT_X_TABLESIZE_CHG'

EXPORTING

iv_xstring = resul

IMPORTING

ev_size = lv_bin_filesize

TABLES

et_data = lt_content

EXCEPTIONS

noentries = 1

OTHERS = 2.

lv_mimetype = 'application/pdf'.

I try to use the FM BBP_ALEWEB_DOWNLOAD but return to me an exception.

How I can make this work?

Is there any way to automatically download this file in the user sapworklist?

Thanks in advance !

Former Member
0 Kudos

This is the call of the function;

lv_mimetype = 'application/pdf'.
        CALL FUNCTION 'BBP_ALEWEB_DOWNLOAD'
          EXPORTING
            data_len          = lv_bin_filesize
            mime_type         = lv_mimetype
          TABLES
            data_tab          = lt_content
          EXCEPTIONS
            its_not_available = 1
            OTHERS            = 2.

In the FM BBP_OUTPUT_SC_PREVIEW_SMART use this FM and works fine, I do not understand why in my WebDynpro returns me this exception.

Former Member
0 Kudos

Hi,

If you want to download pdf from portal then you have to use class cl_wd_runtime_services and method attach_file_to_response(

i_filename =

i_content =

i_mime_type = 'application/pdf'

i_in_new_window = 'X'

i_inplace = 'X' ).

Can you please tell your exact requirement? Why r u not using the class above?

Former Member
0 Kudos

.