cancel
Showing results for 
Search instead for 
Did you mean: 

Downloading the script into application server in backgound in PDF format..

Former Member
0 Kudos

Hi

I am trying to execute one sales order form in background. I want to implement these scenarios for this. I want to convert the form in to PDF and sent a mail as attachment and at the same i want to download this form in application server. I used GUI_DOWNLOAD FM it's working fine but is there any possibility to download in application serv.

Thanks in advance

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

hi

check thsi out if it helps

MOVE :

'X' TO gs_control-no_dialog,

'X' TO gs_control-getotf,

'PRINTER' TO gs_control-device,

'LOCL'(047) TO gs_output_options-tddest.

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

formname = 'ZLB_BIL_INVOICE'

IMPORTING

fm_name = lv_fnam

EXCEPTIONS

no_form = 1

no_function_module = 2

OTHERS = 3.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

CALL FUNCTION lv_fnam

EXPORTING

control_parameters = gs_control

output_options = gs_output_options

user_settings = space

is_bil_invoice = lv_bill_invoice

is_nast = lv_nast

is_repeat = space

IMPORTING

job_output_info = gs_job_output_info

EXCEPTIONS

formatting_error = 1

internal_error = 2

send_error = 3

user_canceled = 4

OTHERS = 5.

IF sy-subrc <> 0.

  • MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

  • WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

CLEAR lv_bill_invoice.

&----


*& Populate OTF data table

&----


REFRESH gt_otfdata[].

LOOP AT gs_job_output_info-otfdata INTO gs_otfdata.

APPEND gs_otfdata TO gt_otfdata.

CLEAR gs_otfdata.

ENDLOOP. " LOOP AT t_outtab-otfdata

DATA: lv_bytes TYPE p,

lv_bin_file TYPE xstring,

gt_pdfdata TYPE STANDARD TABLE OF tline INITIAL SIZE 0.

CALL FUNCTION 'CONVERT_OTF_2_PDF'

IMPORTING

bin_filesize = lv_bytes

TABLES

otf = gt_otfdata

doctab_archive = doc

lines = lines

EXCEPTIONS

err_conv_not_possible = 1

err_otf_mc_noendmarker = 2

OTHERS = 3.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

Former Member
0 Kudos

Yes its possible to download script to application server. u need to use open dataset instead of gui download

see this code

https://www.sdn.sap.com/irj/scn/wiki?path=/display/abap/converting%252bscripts%252boutput%252binto%2...

in the end gui downlaod is used in above code instead of it use like this


OPEN DATASET p_file FOR OUTPUT IN BINARY MODE  .
  IF  sy-subrc = 0 .
    LOOP AT ittab..
      TRANSFER itab TO p_file . "itab is what convert_otf will give u
    ENDLOOP.
    CLOSE DATASET p_file  .
  ELSE.
    WRITE : / 'Error opening file' .
  ENDIF.