Abap BAPI\u SALESORDER\u更改引发类型异常
我在使用FMAbap BAPI\u SALESORDER\u更改引发类型异常,abap,bapi,function-module,Abap,Bapi,Function Module,我在使用FMBAPI\u SALESORDER\u CHANGE时遇到问题 我一执行报告,FM就会抛出一个异常。以下是异常的转储 An exception occurred that is explained in detail below. The exception, which is assigned to class 'CX_SY_DYN_CALL_ILLEGAL_TYPE', was not caught and therefore caused a runtime error. T
BAPI\u SALESORDER\u CHANGE
时遇到问题
我一执行报告,FM就会抛出一个异常。以下是异常的转储
An exception occurred that is explained in detail below.
The exception, which is assigned to class 'CX_SY_DYN_CALL_ILLEGAL_TYPE', was
not caught and
therefore caused a runtime error.
The reason for the exception is:
The call to the function module "BAPI_SALESORDER_CHANGE" is incorrect:
In the function module interface, you can specify only
fields of a specific type and length under "ORDER_HEADER_IN".
Although the currently specified field
"LS_ORDER_HEADER_IN" is the correct type, its length is incorrect.
现在,我发现,中的LS\u顺序\u标题\u的长度不正确。但我不明白的是为什么它是不正确的
以下是我的报告代码:
REPORT ztesting.
DATA:
lv_sales_document TYPE bapivbeln-vbeln,
ls_order_header_in TYPE bapisdhd1,
lt_order_header_in TYPE TABLE OF bapisdhd1,
ls_order_header_inx TYPE bapisdhd1x,
lt_order_header_inx TYPE TABLE OF bapisdh1x,
lt_return TYPE TABLE OF bapiret2,
ls_order_item_in TYPE bapisditm,
lt_order_item_in TYPE bapisditm OCCURS 0 WITH HEADER LINE,
ls_order_item_inx TYPE bapisditmx,
lt_order_item_inx TYPE bapisditmx OCCURS 0 WITH HEADER LINE,
ls_schedule_lines TYPE bapischdl,
lt_schedule_lines TYPE STANDARD TABLE OF bapischdl WITH HEADER LINE,
ls_schedule_linesx TYPE bapischdlx,
lt_schedule_linesx TYPE STANDARD TABLE OF bapischdlx WITH HEADER LINE,
ls_return TYPE bapiret2.
lv_sales_document = '5999999'.
ls_order_header_inx-updateflag = 'U'.
ls_order_item_in-itm_number = '10'.
ls_order_item_inx-itm_number = 'X'.
ls_order_item_in-material = '16'.
ls_order_item_inx-material = 'X'.
ls_order_item_inx-updateflag = 'U'.
ls_schedule_lines-itm_number = '10'.
ls_schedule_linesx-itm_number = 'X'.
ls_schedule_lines-req_qty = '1000'.
ls_schedule_linesx-req_qty = 'X'.
ls_schedule_linesx-req_qty = 'X'.
APPEND:
ls_order_header_inx TO lt_order_header_inx,
ls_order_header_in TO lt_order_header_in,
ls_order_item_in TO lt_order_item_in,
ls_order_item_inx TO lt_order_item_inx,
ls_schedule_lines TO lt_schedule_lines,
ls_schedule_linesx TO lt_schedule_linesx.
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
salesdocument = lv_sales_document
order_header_in = ls_order_header_in
order_header_inx = ls_order_header_inx
TABLES
return = lt_return
order_item_in = lt_order_item_in
order_item_inx = lt_order_item_inx
schedule_lines = lt_schedule_lines
schedule_linesx = lt_schedule_linesx.
DATA: lt_return2 TYPE TABLE OF bapiret2.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
LOOP AT lt_return INTO ls_return.
WRITE: / sy-subrc, ls_return-type, ls_return-number, ls_return-id, ls_return-message.
ENDLOOP.
还有,你能指出我犯过的其他错误吗?这是我第一次使用这个函数。
注意:我从SAP论坛复制了代码。我只是修改了值和变量名
提前谢谢
您好,迭戈。您的页眉类型错误,您需要:
ls_order_header_in TYPE bapisdh1
而不是bapisdhd1,以及
ls_order_header_inx TYPE bapisdh1x
而不是bapisdhd1x。表类型也必须与此匹配
它们看起来几乎相似,但它们并不相同,您所使用的是通用SD文档的结构,并非如此。这只是您代码中的一个输入错误。不要手动键入名称,尤其是当编译器告诉您类型不正确时,请复制并粘贴它们。