cancel
Showing results for 
Search instead for 
Did you mean: 

Alternate Function module for OTF to PDF

former_member625937
Participant
0 Kudos

Hi Team,

We are running the RSNAST00 in bulk processing sale order.for a particular output type ZABC

As per process, it calls the smartforms>otf format>pdf>archive>send mail via BCS class concept.

Problem is when it runs in bulk, few of the orders pdf not getting attached.

Function module for the OTF to pdf used is SX_OBJECT_CONVERT_OTF_PDF

I want to know is there any alternate FM for this..noticed in few of blog, this FM been obsolete and problem happens like PDF not generate when run in bulk.

Kindly suggest on the same.If i use new FM, can i know where to pass the devtype for it.

sample code used -

CALL FUNCTION 'SX_OBJECT_CONVERT_OTF_PDF'
EXPORTING
format_src = 'OTF'
format_dst = 'PDF'
devtype = 'PDF1' "MOD02
CHANGING
transfer_bin = l_transfer
content_txt = otf_tab
content_bin = itab2
objhead = l_objhead
len = l_len
EXCEPTIONS
err_conv_failed = 1
OTHERS = 2.

Regards,

Karthik s

Florian
Active Contributor

Double post a question is not necessary. Do you think you get an answer faster... please have a look at the community guidelines...

Accepted Solutions (0)

Answers (2)

Answers (2)

Sijin_Chandran
Active Contributor

Hi Karthik,

Instead I would recommend you to use FM 'CONVERT_OTF'.

This FM is not Obsolete(I could see last patch update date as on year 2016) and also released for use.

So below would be the steps:

1. Pass the OTF data to FM 'CONVERT_OTF' and get the BINARY FORMAT data from EXPORTING parameter 'bin_file'.

2. Pass the BINARY FORMAT data received in the above step to FM 'SCMS_XSTRING_TO_BINARY' and get the DATA in BINARY FORMAT(Internal Table format) using the TABLES parameter 'binary_tab'.

3. Now while using cl_document_bcs's add_attachment METHOD use this above Internal Table for Parameter 'i_att_content_hex' and also pass the parameter 'i_attachment_type' as 'PDF'.

The above steps should help you out.

Thanks,

Sijin

former_member625937
Participant
0 Kudos

Hi Sijin,

Thanks for the Suggestion and I can use the same steps mentioned instead of that FM SX_OBJECT_CONVERT_OTF_PDF right ?

Let imagine at a single instance , i'm processing multiple sale order via RSNAST00...I can use the same method suggested inside the driver program of respective output type right ?

Regards,

Karthik S

Sijin_Chandran
Active Contributor
0 Kudos

Hi Karthik,

Actually this is the method am following from past few years and it works fine for me. Have not tested for Mass scenario. Hence, asking you for giving this a try. SAP has provided couple of DEMO programs based on this FM so I believe this should be a recommended approach.

So in the nutshell you need to Implement this and test and find out this works out for your scenario or not.

Thanks,

Sijin

former_member625937
Participant
0 Kudos

Hi,

Thanks. Will try the same.

Regards,

Karthik s

former_member625937
Participant
0 Kudos

Hi Team,

I have tried the same and still Archive of attachment is not happened to the system...when the sale order runs in bulk via RSNAST00

Listed down the sample code which i have tried and if i have missed any parameters , let me know so that will try the same.


ls_control_param-device = v_printer. "PRINTER
ls_control_param-no_dialog = v_marck. "X
ls_control_param-preview = v_marck. "X
ls_composer_param-tddest = v_dest. "LOCL
ls_control_param-getotf = v_marck. "X

CALL FUNCTION lf_fm_name
EXPORTING
archive_index = toa_dara
archive_parameters = arc_params

control_parameters = ls_control_param
mail_recipient = ls_recipient
mail_sender = ls_sender
output_options = ls_composer_param
user_settings = ' '
vbdka = vbdka
vbco3 = vbco3
v_change_order = v_confirmation_mode
nast = nast
g_is_sma = g_is_sma
g_cus_ck = g_cus_ck
i_old_param = ls_control_param_old
IMPORTING
job_output_info = ls_job_output_info
job_output_options = ls_job_output_options
email_addr = v_email_addr
TABLES
tvbdpa = tvbdpa
i_conf_details = gi_conf_details
i_vbep = gi_vbep
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
IF sy-subrc <> 0.


Regards,

Karthik S

Sandra_Rossi
Active Contributor
0 Kudos

Please use the COMMENT button for comments, questions, adding details, replying to a comment or a proposed solution or to the OP question, etc., ANSWER is only to propose a solution, dixit SAP text at the right of the answer area.