Application Development and Automation 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: 
Read only

Convert spool to OTF format

Former Member
0 Likes
2,148

Hi All,

My requirement:

I have a report which generates PDF format for all the employees provided on the selection screen ,for this i used the FM :

call function 'CONVERT_ABAPSPOOLJOB_2_PDF'

exporting

src_spoolid = max_spool

no_dialog = space

dst_device = mstr_print_parms-pdest

importing

pdf_bytecount = mi_bytecount

tables

pdf = mtab_pdf

exceptions

err_no_abap_spooljob = 1

err_no_spooljob = 2

err_no_permission = 3

err_conv_not_possible = 4

err_bad_destdevice = 5

user_cancelled = 6

err_spoolerror = 7

err_temseerror = 8

err_btcjob_open_failed = 9

err_btcjob_submit_failed = 10

err_btcjob_close_failed = 11

others = 12.

Now i want to create an RFC function module which has to generate PDF binary data using the PDF generation report .

The process which i am following is :

. Creating RFC function module with the import parameter u2018PERNRu2019

· call this report YREPORT inside the RFC using the PERNR and receive the OTF data from report using buffer.

· Then convert the OTF data into PDF lines using the function module u2018CONVERT_OTFu2019

· And then convert the PDF lines in to PDF binary data.

Please suggest how to get OTF data format from report using buffer .Please provide any FM for this & also provide PDF lines into PDF binary data

Regards,

Bharat

1 ACCEPTED SOLUTION
Read only

agnihotro_sinha2
Active Contributor
0 Likes
1,218

what below code does is:

1: it creates a job hence spool is generated.

2: it call a ADOBE form hence PDF object is generated . (which you may not need)

3: it converts PDF to SOLIX or binary PDF for sending as an mail attachment.


  CALL FUNCTION 'FP_JOB_OPEN'
    CHANGING
      ie_outputparams = wa_outputparams
    EXCEPTIONS
      cancel          = 0
      usage_error     = 0
      system_error    = 0
      internal_error  = 0
      OTHERS          = 0.
* Processing should continue inspite of errors
* so made Sy-Subrc as 0

* Set form language and country (->form locale)
  wa_docparams-langu   = lc_language.
  wa_docparams-country = lc_country.

* Pass Data to the Form Interface
  CALL FUNCTION lv_form_name
    EXPORTING
      /1bcdwb/docparams  = wa_docparams
      t_stud_data        = wa_mailtab1
    IMPORTING
      /1bcdwb/formoutput = wa_pdfobject
    EXCEPTIONS
      usage_error        = 1
      system_error       = 2
      internal_error     = 3
      OTHERS             = 4.


* Convert PDF Object to type SOLIX
  CALL METHOD cl_document_bcs=>xstring_to_solix
    EXPORTING
      ip_xstring = wa_pdfobject-pdf
    RECEIVING
      rt_solix   = it_attachment.

ags.

Hi All,

My requirement:

I have a report which generates PDF format for all the employees provided on the selection screen ,for this i used the FM :

call function 'CONVERT_ABAPSPOOLJOB_2_PDF'

exporting

src_spoolid = max_spool

no_dialog = space

dst_device = mstr_print_parms-pdest

importing

pdf_bytecount = mi_bytecount

tables

pdf = mtab_pdf

exceptions

err_no_abap_spooljob = 1

err_no_spooljob = 2

err_no_permission = 3

err_conv_not_possible = 4

err_bad_destdevice = 5

user_cancelled = 6

err_spoolerror = 7

err_temseerror = 8

err_btcjob_open_failed = 9

err_btcjob_submit_failed = 10

err_btcjob_close_failed = 11

others = 12.

Now i want to create an RFC function module which has to generate PDF binary data using the PDF generation report .

The process which i am following is :

. Creating RFC function module with the import parameter u2018PERNRu2019

· call this report YREPORT inside the RFC using the PERNR and receive the OTF data from report using buffer.

· Then convert the OTF data into PDF lines using the function module u2018CONVERT_OTFu2019

· And then convert the PDF lines in to PDF binary data.

Please suggest how to get OTF data format from report using buffer .Please provide any FM for this & also provide PDF lines into PDF binary data

Regards,

Bharat

2 REPLIES 2
Read only

agnihotro_sinha2
Active Contributor
0 Likes
1,219

what below code does is:

1: it creates a job hence spool is generated.

2: it call a ADOBE form hence PDF object is generated . (which you may not need)

3: it converts PDF to SOLIX or binary PDF for sending as an mail attachment.


  CALL FUNCTION 'FP_JOB_OPEN'
    CHANGING
      ie_outputparams = wa_outputparams
    EXCEPTIONS
      cancel          = 0
      usage_error     = 0
      system_error    = 0
      internal_error  = 0
      OTHERS          = 0.
* Processing should continue inspite of errors
* so made Sy-Subrc as 0

* Set form language and country (->form locale)
  wa_docparams-langu   = lc_language.
  wa_docparams-country = lc_country.

* Pass Data to the Form Interface
  CALL FUNCTION lv_form_name
    EXPORTING
      /1bcdwb/docparams  = wa_docparams
      t_stud_data        = wa_mailtab1
    IMPORTING
      /1bcdwb/formoutput = wa_pdfobject
    EXCEPTIONS
      usage_error        = 1
      system_error       = 2
      internal_error     = 3
      OTHERS             = 4.


* Convert PDF Object to type SOLIX
  CALL METHOD cl_document_bcs=>xstring_to_solix
    EXPORTING
      ip_xstring = wa_pdfobject-pdf
    RECEIVING
      rt_solix   = it_attachment.

ags.

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
1,218

I dont understand receive the OTF data from report using buffer

Generally either a sapscript/smartform/adobeform is used to return OTF data.

Then this OTF data is converted to xstring using CONVERT_OTF.