英文:
Exception CX_SY_NO_HANDLER (type CX_SY_DYN_CALL_ILLEGAL_TYPE)
问题
我从您提供的文本中提取到的代码部分如下:
CONSTANTS c_pdfcnv_pdfdst_xstring(1) TYPE c VALUE 'X'.
DATA: numbytes TYPE i,
jobname TYPE tbtcjob-jobname,
jobcount TYPE tbtcjob-jobcount,
pdf_stream TYPE xstring,
pdf_stream_tab TYPE STANDARD TABLE OF rspolpbi,
pdfspoolid TYPE tsp01-rqident.
IF i_is_otf = 'X'.
CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = i_spool_id
no_dialog = ' '
pdf_destination = c_pdfcnv_pdfdst_xstring
IMPORTING
pdf_bytecount = numbytes
pdf_spoolid = pdfspoolid
btc_jobname = jobname
btc_jobcount = jobcount
bin_file = pdf_stream
EXCEPTIONS
err_no_otf_spooljob = 1
err_no_spooljob = 2
err_no_permission = 3
err_conv_not_possible = 4
err_bad_dstdevice = 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
.
IF sy-subrc NE 0.
ENDIF.
ELSE.
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = i_spool_id
no_dialog = ' '
pdf_destination = c_pdfcnv_pdfdst_xstring
get_size_from_format = 'N'
IMPORTING
pdf_bytecount = numbytes
pdf_spoolid = pdfspoolid
btc_jobname = jobname
btc_jobcount = jobcount
bin_file = pdf_stream
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
.
IF sy-subrc NE 0.
ENDIF.
ENDIF.
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = pdf_stream
TABLES
binary_tab = pdf_stream_tab.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
table_bin = pdf_stream_tab.
size_pdf = numbytes.
希望这有助于您解决问题。如果您有任何其他问题或需要进一步的翻译,请告诉我。
英文:
I have this particular error since the last Thursday and I could not find any solution, so I ask you guys if you know hot to fix it...
First:
I generate a CLASS (SE24) for download a pdf with a spool number.
Before that CLASS I generate a method to convert OTF -> PDF,
- In the parameters of the METHOD I declare 'I_IS_OTF' type C (IMPORTING) for check if OTF is 'X'
- 'I_SPOOL_ID' type I (IMPORTING) for write the SPOOL ID to transform
- And the problem comes here, I declare 'TABLE_BIN' type TABLE (EXPORTING) and 'SIZE_PDF' type I (EXPORTING).
The TABLE_BIN give me the 'Exception CX_SY_NO_HANDLER' and then explotes, but still read the SPOOL and give me information. I'm base in this code -> 'RSTXPDFT4'
I don't have a program to run the methods, I just use the same class.
THE CODE:
CONSTANTS c_pdfcnv_pdfdst_xstring(1) TYPE c VALUE 'X'.
DATA: numbytes TYPE i,
jobname TYPE tbtcjob-jobname,
jobcount TYPE tbtcjob-jobcount,
pdf_stream TYPE xstring,
pdf_stream_tab TYPE STANDARD TABLE OF rspolpbi,
pdfspoolid TYPE tsp01-rqident.
IF i_is_otf = 'X'.
CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = i_spool_id " Duda
no_dialog = ' '
* DST_DEVICE =
pdf_destination = c_pdfcnv_pdfdst_xstring
IMPORTING
pdf_bytecount = numbytes
pdf_spoolid = pdfspoolid
* OTF_PAGECOUNT =
btc_jobname = jobname
btc_jobcount = jobcount
bin_file = pdf_stream
EXCEPTIONS
err_no_otf_spooljob = 1
err_no_spooljob = 2
err_no_permission = 3
err_conv_not_possible = 4
err_bad_dstdevice = 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
.
IF sy-subrc NE 0.
ENDIF.
ELSE.
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = i_spool_id " eSTE
no_dialog = ' '
* DST_DEVICE =
pdf_destination = c_pdfcnv_pdfdst_xstring
get_size_from_format = 'N'
IMPORTING
pdf_bytecount = numbytes
pdf_spoolid = pdfspoolid
* LIST_PAGECOUNT =
btc_jobname = jobname
btc_jobcount = jobcount
bin_file = pdf_stream
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.
IF sy-subrc NE 0.
ENDIF.
ENDIF.
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = pdf_stream
TABLES
binary_tab = pdf_stream_tab.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
table_bin = pdf_stream_tab.
size_pdf = numbytes.
I already debugging this a few times, I only find the SY_TABIX give me '2'.
I tried using a try & catch, but still with the same error. 'Exception CX_SY_NO_HANDLER'.
答案1
得分: 2
在您提供的信息中,您使用了以下内容:
- 类型
SETST_TYPE_TABLE
用于将数据传递给参数table_bin
,该参数是一个包含70个字符类型行的表格, - 并尝试使用变量
pdf_stream_tab
进行初始化,该变量是一个包含类型为RSPOLPBI
的结构行的表格,而RSPOLPBI
是一个带有128字节类型组件的DDIC结构。
根据下面的文档解释(我只指出与您情况相关的部分),这是不允许的,因为这两个表格的行类型不可互相转换(行类型分别为类似字符的字段和不类似字符的结构)。
相反,由于PDF是由字节而不是字符组成的,您应该始终使用"字节类型"的变量。
注意:
- ABAP文档 - 赋值和转换规则
- 内部表的转换规则
> "内部表可以互相分配,如果它们的行类型是兼容或可转换的" - 结构的转换规则
- 平面结构和单字段之间的转换
> "如果一个结构完全类似字符,..."
>
> "如果结构不完全类似字符,单个字段必须具有类型c,并且结构必须以类似字符的片段开头..."
>
> "没有为其他情况定义转换规则,因此不可进行赋值。"
- 平面结构和单字段之间的转换
- 内部表的转换规则
- 以下是上述类型的定义
英文:
In the information you have given, you have used:
- the type
SETST_TYPE_TABLE
for passing data to the parametertable_bin
, which is a table of lines of type 70 characters, - and you tried to initialize it with the variable
pdf_stream_tab
which is a table of structured lines of typeRSPOLPBI
which is a DDIC Structure with 1 component of type 128 bytes.
As explained in the documentation below (I just indicate what is relevant to your case), this is not permitted, because the line types of the 2 tables are not convertible (the line types are respectively a field which is character-like and a structure which is not character-like).
Instead, as a PDF is made of bytes, not characters, you should always use variables "byte-like".
NB:
- ABAP Documentation - Assignment and Conversion Rules
- Conversion Rules for Internal Tables
> "Internal tables can be assigned to each other if their line types are compatible or convertible" - Conversion Rules for Structures
- Conversion between flat structures and single fields
> "If a structure is purely character-like, ..."
>
> "If the structure is not completely character-like, the single field must have the type c and the structure must begin with a character-like fragment ..."
>
> "No conversion rule is defined for any other cases, and assignments are not possible."
- Conversion between flat structures and single fields
- Conversion Rules for Internal Tables
- Here are the definitions of the above types
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论