‎2011 May 07 6:46 AM
Hi All,
I am using the FM SXPG_COMMAND_EXECUTE to run a unix script which fetches a pdf file written from ABAP code into
application server.
I have written the pdf file, and while run separately the Unix script is working fine.
But the FM which calls the unix script, SXPG_COMMAND_EXECUTE, returns errors which say that the pdf file could not be opened. I have written the pdf file in binary form on the application server.
Please help.
This is my code:
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
max_linewidth = 132
IMPORTING
bin_filesize = gv_bin_filesize
bin_file = gt_bin
TABLES
otf = gt_otf
lines = gt_pdf_tab
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 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.
data: mstr_print_parms LIKE pri_params,
gv_file type string value '/usr/sap/ABAP-TMP/',
wa_pdf_tab like line of gt_pdf_tab,
it_docs TYPE STANDARD TABLE OF docs,
it_lines TYPE STANDARD TABLE OF tline,
gv_frontfile type string ,
wa_lines type tline.
concatenate gv_file wa_final-pernr '.pdf' into gv_file.
open dataset gv_file for output in binary mode.
transfer gt_bin to gv_file.
close dataset gv_file.
CONSTANTS: c_extcom TYPE sxpgcolist-name VALUE 'ZHRPAYSLIP',
c_oper TYPE syopsys VALUE 'Linux'.
DATA: v_dir_input TYPE sxpgcolist-parameters. " Input Directory
DATA: t_result TYPE STANDARD TABLE OF btcxpm.
concatenate wa_final-pernr
gs_reclist-receiver
'93210951'
into v_dir_input
separated by space.
CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
EXPORTING
commandname = c_extcom
additional_parameters = v_dir_input
operatingsystem = c_oper
TABLES
exec_protocol = t_result
EXCEPTIONS
no_permission = 1
command_not_found = 2
parameters_too_long = 3
security_risk = 4
wrong_check_call_interface = 5
program_start_error = 6
program_termination_error = 7
x_error = 8
parameter_expected = 9
too_many_parameters = 10
illegal_command = 11
wrong_asynchronous_parameters = 12
cant_enq_tbtco_entry = 13
jobcount_generation_error = 14
OTHERS = 15.
Thanks,
Anita
‎2011 May 07 9:35 AM
Hi guys,
Issue has been resolved. I was writing the pdf file in the application server, wheras the Unix script had some other directory as its present working directory.
As we are using the same directory for the purpose, this directory and folder name was hard coded in the Unix script as well,
so that the confusion of path is resolved.
Thus this issue was resolved from the Unix script itself.
Thanks.
Anita Jeyan.