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: 

Hi Question Form Related To Convert into Acrobat format

Former Member
0 Kudos

Hi Abapers,

I was seeing an E-learning Session related to Forms Related to Acrobat Reader , i didn't found Tcodes for it in taht session can body send the Tcodes relating to it . here the function modules involed are

FP_JOB_OPEN

FP_JOB_CLOSE ...

please tell me the Tcodes.

Thanks & Regards

Bhaskar Rao.M

1 ACCEPTED SOLUTION

navin_khedikar2
Contributor
0 Kudos

Hi

Use ful Code

REPORT zptpfrm202p_pogr_pr_instr MESSAGE-ID zmm.

----


  • TABLES *

----


  • Database table made for getting information about PRINTPREVIEW and

  • PRINT command more than one times

TABLES: zgr_table.

TYPE-POOLS:syscr.

----


  • GLOBAL TYPE DECLARATION *

----


DATA: zdoc_output_info TYPE ssfcrespd, "SF:Return Document Inf.

zjob_output_info TYPE ssfcrescl, "SF:Return value at end of

  • form printing

i_control TYPE ssfctrlop ,

i_output_options TYPE ssfcompop,

zjob_output_opts TYPE ssfcresop. "SF:Return value at start

  • of form printing

*This internal table is used for storing Document Segment: Material

DATA: BEGIN OF i_mseg.

INCLUDE STRUCTURE mseg.

DATA: END OF i_mseg.

  • This internal table is used for storing Header: Material Document

DATA: BEGIN OF i_mkpf.

INCLUDE STRUCTURE mkpf.

DATA: END OF i_mkpf.

*Variables

DATA flag(1) TYPE c.

DATA: vfile TYPE string.

----


  • SELECTION-SCREEN *

----


SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-000.

PARAMETERS:p_mblnr TYPE mkpf-mblnr OBLIGATORY MATCHCODE OBJECT zganesh,

p_mjahr TYPE mkpf-mjahr OBLIGATORY MATCHCODE OBJECT zganesh1,

p_zeile TYPE mseg-zeile OBLIGATORY MATCHCODE OBJECT zganesh2.

SELECTION-SCREEN END OF BLOCK b1.

SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-001.

SELECTION-SCREEN BEGIN OF LINE.

SELECTION-SCREEN POSITION 10.

PARAMETER:r_disp RADIOBUTTON GROUP g1 USER-COMMAND u1 DEFAULT 'X'.

SELECTION-SCREEN:COMMENT 15(10) text-002 .

SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN BEGIN OF LINE.

SELECTION-SCREEN POSITION 10.

PARAMETERS: r_down RADIOBUTTON GROUP g1.

SELECTION-SCREEN:COMMENT 15(10) text-003.

*PARAMETERS: v_file LIKE rlgrap-filename .

*SELECTION-SCREEN:COMMENT 70(50) text-005.

SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN BEGIN OF LINE.

SELECTION-SCREEN POSITION 10.

PARAMETERS: r_print RADIOBUTTON GROUP g1 .

SELECTION-SCREEN:COMMENT 15(10) text-004.

SELECTION-SCREEN END OF LINE.

PARAMETERS: v_file LIKE rlgrap-filename MODIF ID g12.

SELECTION-SCREEN END OF BLOCK b2.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR v_file.

DATA : wlv_field_name LIKE dynpread-fieldname,

wlv_file_name LIKE ibipparms-path.

wlv_field_name = v_file.

CALL FUNCTION 'F4_FILENAME'

EXPORTING

field_name = wlv_field_name

IMPORTING

file_name = wlv_file_name.

IF sy-subrc EQ 0.

vfile = wlv_file_name.

v_file = wlv_file_name.

ENDIF.

AT SELECTION-SCREEN OUTPUT.

LOOP AT SCREEN.

IF screen-name = 'V_FILE'.

IF r_disp EQ 'X' OR r_print EQ 'X'.

screen-input = 0.

ELSE.

screen-input = '1'.

ENDIF.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

----


  • START-OF-SELECTION EVENT *

----


START-OF-SELECTION.

----


  • CALLING CONVERSION FUNCTION MODULE 'CONVERSION_EXIT_ALPHA_INPUT' *

----


*Conversion function module for appending 00 befor MBLNR FIELD

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

input = p_mblnr

IMPORTING

output = p_mblnr.

  • Call subroutine for fetching data from database

PERFORM get_data.

----


  • END-OF-SELECTION EVENT *

----


END-OF-SELECTION.

  • Call subroutine for calling and processing smartform

PERFORM call_smartform.

&----


*& Form get_data

&----


  • Subroutine for fetching data from database

----


FORM get_data .

  • Fetching data from MKPF table with using parameters MBLNR and MJAHR

SELECT SINGLE * FROM mkpf

INTO i_mkpf

WHERE mblnr = p_mblnr

AND mjahr = p_mjahr.

IF sy-subrc EQ 0.

  • Fetching data from MSEG with using parameters MBLNR,ZEILE and MJAHR

SELECT SINGLE * FROM mseg

INTO i_mseg

WHERE mblnr = i_mkpf-mblnr

AND mjahr = i_mkpf-mjahr

AND zeile = p_zeile.

IF sy-subrc NE 0.

CLEAR i_mseg.

ENDIF.

ELSE.

MESSAGE i000.

  • EXIT.

*exit use karne se ek empty smartform dikhega while

*leave list-processing se you are taken to the selection screen

leave list-processing.

*leave program.

ENDIF.

ENDFORM. " get_data

&----


*& Form call_smartform

&----


  • Subroutine for calling smartform

----


FORM call_smartform .

  • Local template used in the processing output of smartform

TYPES: BEGIN OF lt_ztable,

mandt TYPE sy-mandt,

mblnr TYPE mseg-mblnr,

flag(1) TYPE c,

END OF lt_ztable.

CONSTANTS: c_x(1) TYPE c VALUE 'X'.

  • Workarea

DATA: lw_ztable TYPE lt_ztable.

*Variable used in the smartform

DATA: lv_form(30) TYPE c,

lv_fm_name(30) TYPE c.

lv_form = 'ZPTPFRM202L_POGR'.

*Calling function module SSF_FUNCTION_MODULE_NAME which gives new name

*to the function module that will generated by smartform.

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

formname = lv_form

IMPORTING

fm_name = lv_fm_name

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.

*Calling function module that will be generated by smartform

IF r_disp = c_x.

i_output_options-tdimmed = space.

i_output_options-tdnewid = c_x.

i_output_options-tddest = 'LOCL'.

i_control-no_dialog = 'X'.

i_control-preview = 'X'.

ELSEIF r_print = c_x.

i_output_options-tdimmed = c_x.

i_output_options-tddest = 'LOCL'.

i_control-no_dialog = c_x.

ELSE.

i_output_options-tdimmed = space.

i_output_options-tdnewid = c_x.

i_output_options-tddest = 'LOCL'.

i_control-getotf = 'X'.

i_control-preview = space.

i_control-no_dialog = c_x.

flag = c_x.

ENDIF.

CALL FUNCTION lv_fm_name

EXPORTING

control_parameters = i_control

output_options = i_output_options

user_settings = space

zmkpf = i_mkpf

zmseg = i_mseg

IMPORTING

document_output_info = zdoc_output_info

job_output_info = zjob_output_info

job_output_options = zjob_output_opts

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.

  • Modify the database table if it found the print command

IF zjob_output_opts-tdpreview NE c_x.

lw_ztable-mandt = sy-mandt.

lw_ztable-mblnr = p_mblnr.

lw_ztable-flag = c_x.

MODIFY zgr_table FROM lw_ztable.

CLEAR lw_ztable.

ENDIF.

IF flag EQ c_x.

DATA: li_lines LIKE tline OCCURS 100 WITH HEADER LINE.

DATA: lv_file TYPE string,

lbin_fsiz TYPE i.

lv_file = v_file.

CALL FUNCTION 'CONVERT_OTF'

EXPORTING

format = 'PDF'

IMPORTING

bin_filesize = lbin_fsiz

TABLES

otf = zjob_output_info-otfdata

lines = li_lines

EXCEPTIONS

err_max_linewidth = 1

err_format = 2

err_conv_not_possible = 3

err_bad_otf = 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.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

bin_filesize = lbin_fsiz

filename = lv_file

filetype = 'BIN'

TABLES

data_tab = li_lines

EXCEPTIONS

file_write_error = 1

no_batch = 2

gui_refuse_filetransfer = 3

invalid_type = 4

no_authority = 5

unknown_error = 6

header_not_allowed = 7

separator_not_allowed = 8

filesize_not_allowed = 9

header_too_long = 10

dp_error_create = 11

dp_error_send = 12

dp_error_write = 13

unknown_dp_error = 14

access_denied = 15

dp_out_of_memory = 16

disk_full = 17

dp_timeout = 18

file_not_found = 19

dataprovider_exception = 20

control_flush_error = 21

OTHERS = 22.

IF sy-subrc <> 0.

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

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

ENDIF.

ENDIF.

ENDFORM. " call_smartform

****Reward Points Important********'

Navin Khedikar

3 REPLIES 3

alison_lloyd
Active Participant
0 Kudos

Program RSTXPDFT4 converts spool to pdf

navin_khedikar2
Contributor
0 Kudos

Hi

Use ful Code

REPORT zptpfrm202p_pogr_pr_instr MESSAGE-ID zmm.

----


  • TABLES *

----


  • Database table made for getting information about PRINTPREVIEW and

  • PRINT command more than one times

TABLES: zgr_table.

TYPE-POOLS:syscr.

----


  • GLOBAL TYPE DECLARATION *

----


DATA: zdoc_output_info TYPE ssfcrespd, "SF:Return Document Inf.

zjob_output_info TYPE ssfcrescl, "SF:Return value at end of

  • form printing

i_control TYPE ssfctrlop ,

i_output_options TYPE ssfcompop,

zjob_output_opts TYPE ssfcresop. "SF:Return value at start

  • of form printing

*This internal table is used for storing Document Segment: Material

DATA: BEGIN OF i_mseg.

INCLUDE STRUCTURE mseg.

DATA: END OF i_mseg.

  • This internal table is used for storing Header: Material Document

DATA: BEGIN OF i_mkpf.

INCLUDE STRUCTURE mkpf.

DATA: END OF i_mkpf.

*Variables

DATA flag(1) TYPE c.

DATA: vfile TYPE string.

----


  • SELECTION-SCREEN *

----


SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-000.

PARAMETERS:p_mblnr TYPE mkpf-mblnr OBLIGATORY MATCHCODE OBJECT zganesh,

p_mjahr TYPE mkpf-mjahr OBLIGATORY MATCHCODE OBJECT zganesh1,

p_zeile TYPE mseg-zeile OBLIGATORY MATCHCODE OBJECT zganesh2.

SELECTION-SCREEN END OF BLOCK b1.

SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-001.

SELECTION-SCREEN BEGIN OF LINE.

SELECTION-SCREEN POSITION 10.

PARAMETER:r_disp RADIOBUTTON GROUP g1 USER-COMMAND u1 DEFAULT 'X'.

SELECTION-SCREEN:COMMENT 15(10) text-002 .

SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN BEGIN OF LINE.

SELECTION-SCREEN POSITION 10.

PARAMETERS: r_down RADIOBUTTON GROUP g1.

SELECTION-SCREEN:COMMENT 15(10) text-003.

*PARAMETERS: v_file LIKE rlgrap-filename .

*SELECTION-SCREEN:COMMENT 70(50) text-005.

SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN BEGIN OF LINE.

SELECTION-SCREEN POSITION 10.

PARAMETERS: r_print RADIOBUTTON GROUP g1 .

SELECTION-SCREEN:COMMENT 15(10) text-004.

SELECTION-SCREEN END OF LINE.

PARAMETERS: v_file LIKE rlgrap-filename MODIF ID g12.

SELECTION-SCREEN END OF BLOCK b2.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR v_file.

DATA : wlv_field_name LIKE dynpread-fieldname,

wlv_file_name LIKE ibipparms-path.

wlv_field_name = v_file.

CALL FUNCTION 'F4_FILENAME'

EXPORTING

field_name = wlv_field_name

IMPORTING

file_name = wlv_file_name.

IF sy-subrc EQ 0.

vfile = wlv_file_name.

v_file = wlv_file_name.

ENDIF.

AT SELECTION-SCREEN OUTPUT.

LOOP AT SCREEN.

IF screen-name = 'V_FILE'.

IF r_disp EQ 'X' OR r_print EQ 'X'.

screen-input = 0.

ELSE.

screen-input = '1'.

ENDIF.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

----


  • START-OF-SELECTION EVENT *

----


START-OF-SELECTION.

----


  • CALLING CONVERSION FUNCTION MODULE 'CONVERSION_EXIT_ALPHA_INPUT' *

----


*Conversion function module for appending 00 befor MBLNR FIELD

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

input = p_mblnr

IMPORTING

output = p_mblnr.

  • Call subroutine for fetching data from database

PERFORM get_data.

----


  • END-OF-SELECTION EVENT *

----


END-OF-SELECTION.

  • Call subroutine for calling and processing smartform

PERFORM call_smartform.

&----


*& Form get_data

&----


  • Subroutine for fetching data from database

----


FORM get_data .

  • Fetching data from MKPF table with using parameters MBLNR and MJAHR

SELECT SINGLE * FROM mkpf

INTO i_mkpf

WHERE mblnr = p_mblnr

AND mjahr = p_mjahr.

IF sy-subrc EQ 0.

  • Fetching data from MSEG with using parameters MBLNR,ZEILE and MJAHR

SELECT SINGLE * FROM mseg

INTO i_mseg

WHERE mblnr = i_mkpf-mblnr

AND mjahr = i_mkpf-mjahr

AND zeile = p_zeile.

IF sy-subrc NE 0.

CLEAR i_mseg.

ENDIF.

ELSE.

MESSAGE i000.

  • EXIT.

*exit use karne se ek empty smartform dikhega while

*leave list-processing se you are taken to the selection screen

leave list-processing.

*leave program.

ENDIF.

ENDFORM. " get_data

&----


*& Form call_smartform

&----


  • Subroutine for calling smartform

----


FORM call_smartform .

  • Local template used in the processing output of smartform

TYPES: BEGIN OF lt_ztable,

mandt TYPE sy-mandt,

mblnr TYPE mseg-mblnr,

flag(1) TYPE c,

END OF lt_ztable.

CONSTANTS: c_x(1) TYPE c VALUE 'X'.

  • Workarea

DATA: lw_ztable TYPE lt_ztable.

*Variable used in the smartform

DATA: lv_form(30) TYPE c,

lv_fm_name(30) TYPE c.

lv_form = 'ZPTPFRM202L_POGR'.

*Calling function module SSF_FUNCTION_MODULE_NAME which gives new name

*to the function module that will generated by smartform.

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

formname = lv_form

IMPORTING

fm_name = lv_fm_name

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.

*Calling function module that will be generated by smartform

IF r_disp = c_x.

i_output_options-tdimmed = space.

i_output_options-tdnewid = c_x.

i_output_options-tddest = 'LOCL'.

i_control-no_dialog = 'X'.

i_control-preview = 'X'.

ELSEIF r_print = c_x.

i_output_options-tdimmed = c_x.

i_output_options-tddest = 'LOCL'.

i_control-no_dialog = c_x.

ELSE.

i_output_options-tdimmed = space.

i_output_options-tdnewid = c_x.

i_output_options-tddest = 'LOCL'.

i_control-getotf = 'X'.

i_control-preview = space.

i_control-no_dialog = c_x.

flag = c_x.

ENDIF.

CALL FUNCTION lv_fm_name

EXPORTING

control_parameters = i_control

output_options = i_output_options

user_settings = space

zmkpf = i_mkpf

zmseg = i_mseg

IMPORTING

document_output_info = zdoc_output_info

job_output_info = zjob_output_info

job_output_options = zjob_output_opts

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.

  • Modify the database table if it found the print command

IF zjob_output_opts-tdpreview NE c_x.

lw_ztable-mandt = sy-mandt.

lw_ztable-mblnr = p_mblnr.

lw_ztable-flag = c_x.

MODIFY zgr_table FROM lw_ztable.

CLEAR lw_ztable.

ENDIF.

IF flag EQ c_x.

DATA: li_lines LIKE tline OCCURS 100 WITH HEADER LINE.

DATA: lv_file TYPE string,

lbin_fsiz TYPE i.

lv_file = v_file.

CALL FUNCTION 'CONVERT_OTF'

EXPORTING

format = 'PDF'

IMPORTING

bin_filesize = lbin_fsiz

TABLES

otf = zjob_output_info-otfdata

lines = li_lines

EXCEPTIONS

err_max_linewidth = 1

err_format = 2

err_conv_not_possible = 3

err_bad_otf = 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.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

bin_filesize = lbin_fsiz

filename = lv_file

filetype = 'BIN'

TABLES

data_tab = li_lines

EXCEPTIONS

file_write_error = 1

no_batch = 2

gui_refuse_filetransfer = 3

invalid_type = 4

no_authority = 5

unknown_error = 6

header_not_allowed = 7

separator_not_allowed = 8

filesize_not_allowed = 9

header_too_long = 10

dp_error_create = 11

dp_error_send = 12

dp_error_write = 13

unknown_dp_error = 14

access_denied = 15

dp_out_of_memory = 16

disk_full = 17

dp_timeout = 18

file_not_found = 19

dataprovider_exception = 20

control_flush_error = 21

OTHERS = 22.

IF sy-subrc <> 0.

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

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

ENDIF.

ENDIF.

ENDFORM. " call_smartform

****Reward Points Important********'

Navin Khedikar

Former Member
0 Kudos

Hi Bhaskar Rao,

Please go through the below procedure and sample Code, this might help you.

Procedure

When we activate the Smart form the system generates a Function Module. The function module name we can get from Smart form screen from menu bar

“Environment => Function Module_Name” . In a report we can get this Function module name by calling a Function Module standard SSF_FUNCTION_MODULE_NAME. This function module at runtime calls the FM generated by smart form, which in turn is then used to pass data from the report to Smart form. In the report given below the FM generated is “ /1BCDWB/SF00000152 ”. In this FM we can see CONTROL_PARAMETERS in import tab. This is of type SSFCTRLOP. We need to set the GETOTF of this to be ‘X’. Setting this field will activate the OTF field in smart form.

In export tab of the FM generated by smart form we can see a parameter JOB_OUTPUT_INFO which is of type SSFCRESCL. The SSFCRESCL is a structure of having one of fields as OTFDATA. OTFDATA in turn is a table of type ITCOO. ITCOO has two fields TDPRINTCOM and TDPRINTPAR. TDPRINTCOM represents command line of OTF format data and TDPRINTPAR contains command parameters of OTF format data.

In every Smart form output in OTF format, TDPRINTCOM begins and ends with ‘//’. ‘EP’ represents the end-of-page value for TDPRINTCOM field.

In addition we need to set few fields at the place where we call this FM(generated by smart form) in our program. While calling this FM we should set control_parameters, output_options, user_settings and job_putput_info fields as shown in program.

Once these settings are done we can call Function Module CONVERT_OTF to convert the OTF data of smart form output to PDF data format. Once these are done we can call method “cl_gui_fronted_services=>file_save_dialog” to specify the directory path where we want to save the output PDF file. After this we can call Function Module GUI_DOWNLOAD to download the PDF file on our local system.

Here is a sample code of program to perform the function.

SAMPLE CODE

&----


*& Report ZAMIT_SMART_FORM_PDF *

&----


&----


REPORT ZAMIT_SMART_FORM_PDF .

data: carr_id type sbook-carrid,

cparam type ssfctrlop,

outop type ssfcompop,

fm_name type rs38l_fnam.

DATA: tab_otf_data TYPE ssfcrescl,

pdf_tab LIKE tline OCCURS 0 WITH HEADER LINE,

tab_otf_final TYPE itcoo OCCURS 0 WITH HEADER LINE,

file_size TYPE i,

bin_filesize TYPE i,

FILE_NAME type string,

File_path type string,

FULL_PATH type string.

parameter: p_custid type scustom-id default 1.

select-options: s_carrid for carr_id default 'LH' to 'LH'.

parameter: p_form type tdsfname default 'ZAMIT_SMART_FORM'.

data: customer type scustom,

bookings type ty_bookings,

connections type ty_connections.

start-of-selection.

                                  • suppressing the dialog box for print preview****************************

outop-tddest = 'LP01'.

cparam-no_dialog = 'X'.

cparam-preview = SPACE.

cparam-getotf = 'X'.

select single * from scustom into customer where id = p_custid.

check sy-subrc = 0.

select * from sbook into table bookings

where customid = p_custid

and carrid in s_carrid

order by primary key.

select * from spfli into table connections

for all entries in bookings

where carrid = bookings-carrid

and connid = bookings-connid

order by primary key.

call function 'SSF_FUNCTION_MODULE_NAME'

exporting formname = p_form

  • variant = ' '

  • direct_call = ' '

importing fm_name = fm_name

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.

exit.

endif.

  • calling the generated function module

call function fm_name

exporting

  • archive_index =

  • archive_parameters =

control_parameters = cparam

  • mail_appl_obj =

  • mail_recipient =

  • mail_sender =

output_options = outop

user_settings = SPACE

bookings = bookings

customer = customer

connections = connections

importing

  • document_output_info =

job_output_info = tab_otf_data

  • job_output_options =

exceptions formatting_error = 1

internal_error = 2

send_error = 3

user_canceled = 4

others = 5.

if sy-subrc <> 0.

  • error handling

message id sy-msgid type sy-msgty number sy-msgno

with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

endif.

tab_otf_final[] = tab_otf_data-otfdata[].

CALL FUNCTION 'CONVERT_OTF'

EXPORTING

format = 'PDF'

max_linewidth = 132

  • ARCHIVE_INDEX = ' '

  • COPYNUMBER = 0

  • ASCII_BIDI_VIS2LOG = ' '

IMPORTING

bin_filesize = bin_filesize

  • BIN_FILE =

TABLES

otf = tab_otf_final

lines = pdf_tab

EXCEPTIONS

err_max_linewidth = 1

err_format = 2

err_conv_not_possible = 3

err_bad_otf = 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.

CALL METHOD cl_gui_frontend_services=>file_save_dialog

  • EXPORTING

  • WINDOW_TITLE =

  • DEFAULT_EXTENSION =

  • DEFAULT_FILE_NAME =

  • FILE_FILTER =

  • INITIAL_DIRECTORY =

  • WITH_ENCODING =

  • PROMPT_ON_OVERWRITE = 'X'

CHANGING

filename = FILE_NAME

path = FILE_PATH

fullpath = FULL_PATH

  • USER_ACTION =

  • FILE_ENCODING =

  • EXCEPTIONS

  • CNTL_ERROR = 1

  • ERROR_NO_GUI = 2

  • NOT_SUPPORTED_BY_GUI = 3

  • others = 4

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

************downloading the converted PDF data to your local PC*******

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

bin_filesize = bin_filesize

filename = FULL_PATH

filetype = 'BIN'

  • APPEND = ' '

  • WRITE_FIELD_SEPARATOR = ' '

  • HEADER = '00'

  • TRUNC_TRAILING_BLANKS = ' '

  • WRITE_LF = 'X'

  • COL_SELECT = ' '

  • COL_SELECT_MASK = ' '

  • DAT_MODE = ' '

  • CONFIRM_OVERWRITE = ' '

  • NO_AUTH_CHECK = ' '

  • CODEPAGE = ' '

  • IGNORE_CERR = ABAP_TRUE

  • REPLACEMENT = '#'

  • WRITE_BOM = ' '

  • TRUNC_TRAILING_BLANKS_EOL = 'X'

IMPORTING

filelength = file_size

TABLES

data_tab = pdf_tab

  • FIELDNAMES =

EXCEPTIONS

file_write_error = 1

no_batch = 2

gui_refuse_filetransfer = 3

invalid_type = 4

no_authority = 5

unknown_error = 6

header_not_allowed = 7

separator_not_allowed = 8

filesize_not_allowed = 9

header_too_long = 10

dp_error_create = 11

dp_error_send = 12

dp_error_write = 13

unknown_dp_error = 14

access_denied = 15

dp_out_of_memory = 16

disk_full = 17

dp_timeout = 18

file_not_found = 19

dataprovider_exception = 20

control_flush_error = 21

OTHERS = 22

.

IF sy-subrc <> 0.

ENDIF.

Hope this resolves your query.

Reward all the helpful answers.

Regards