‎2011 Dec 20 9:36 AM
Hi,
I was trying to use the BAPI_SALESORDER_CHANGE to change 'Material Group 1' field. When executing the program, it kept on failing with this runtime error 'CALL_FUNCTION_CONFLICT_LENG'. Below is my codes and also the error analysis found in ST22.
Kindly please let me know my program errors.
Thanks much.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CODES :-
DATA: l_vbeln TYPE bapivbeln-vbeln,
l_hx LIKE bapisdhead1x,
l_r TYPE STANDARD TABLE OF bapiret2 WITH HEADER LINE,
l_i TYPE STANDARD TABLE OF bapisditem WITH HEADER LINE,
l_ix TYPE STANDARD TABLE OF bapisditemx WITH HEADER LINE,
l_success(1) TYPE c VALUE 'Y'.
l_vbeln = '0000707671'.
l_hx-updateflag = 'U'.
l_i-itm_number = '000010'.
l_i-prc_group1 = 'Y'.
APPEND l_i.
l_ix-itm_number = '000010'.
l_ix-updateflag = 'U'.
l_ix-prc_group1 = 'X'.
APPEND l_ix.
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
salesdocument = l_vbeln
ORDER_HEADER_IN =
order_header_inx = l_hx
SIMULATION =
BEHAVE_WHEN_ERROR = ' '
INT_NUMBER_ASSIGNMENT = ' '
LOGIC_SWITCH =
NO_STATUS_BUF_INIT = ' '
TABLES
return = l_r
order_item_in = l_i
order_item_inx = l_ix
PARTNERS =
PARTNERCHANGES =
PARTNERADDRESSES =
ORDER_CFGS_REF =
ORDER_CFGS_INST =
ORDER_CFGS_PART_OF =
ORDER_CFGS_VALUE =
ORDER_CFGS_BLOB =
ORDER_CFGS_VK =
ORDER_CFGS_REFINST =
SCHEDULE_LINES =
SCHEDULE_LINESX =
ORDER_TEXT =
ORDER_KEYS =
CONDITIONS_IN =
CONDITIONS_INX =
EXTENSIONIN =
NFMETALLITMS =
.
LOOP AT l_r.
IF l_r-type <> 'S'.
l_success = 'N'.
EXIT.
ENDIF.
CLEAR l_r.
ENDLOOP.
IF l_success = 'Y'.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT =
IMPORTING
RETURN =
.
WRITE: / 'Update successful'.
ELSE.
WRITE: / 'Update fail'.
ENDIF.
Error analysis
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_INX".
Although the currently specified field
"L_HX" is the correct type, its length is incorrect.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
‎2011 Dec 20 10:05 AM
Hi,
You need to declare I_hx of type BAPISDH1X.Also update indicator should be 'U' for update and 'I' for insert.
Thanks and Regards,
Sriranjani Chimakurthy.
‎2011 Dec 20 9:40 AM
Hello
I guess in the ORDER_HEADER_INX you can pass values as 'X' only . for all those fields you have provided in the ORDER_HEADER structure , you need to pass the values as 'X' in the structure ORDER_HEADER_INX .
Also l_hx must be of type BAPISDH1X , and as you are not manipulating the header data of Sales Order you dnt have to pass this structures else pass BAPISDH1X-Updateflag = 'X' .
Please try this way & let me know .
Thanks
Edited by: nishant.gaur on Dec 20, 2011 10:43 AM
‎2011 Dec 21 2:39 AM
Thanks Nishant. Yes, you are right that the type of "l_hx" structure should be "BAPISDHD1X". The structure type that i used initially was "BAPISDHEAD1X". I thought it was correct as I found it from the function module details (SE37) for "BAPI_SALESORDER_CHANGE". If you checked the import parameters of FM "BAPI_SALESORDER_CHANGE" using SE37, you will find that the associated type for "ORDER_HEADER_INX" is "BAPISDHEAD1X". However, regarding the updateflag, i think it only accepts either "I" (Insert), "U" (Update) or "D" (Delete) but not "X". Thanks again.
‎2011 Dec 21 2:40 AM
Thanks ALL. Here is the amended program that works fine :-
DATA: l_vbeln TYPE bapivbeln-vbeln,
l_hx TYPE bapisdh1x,
l_r TYPE STANDARD TABLE OF bapiret2 WITH HEADER LINE,
l_i TYPE STANDARD TABLE OF bapisditm WITH HEADER LINE,
l_ix TYPE STANDARD TABLE OF bapisditmx WITH HEADER LINE,
l_success(1) TYPE c VALUE 'Y'.
l_vbeln = '0000707671'.
l_hx-updateflag = 'U'.
l_i-itm_number = '000010'.
l_i-prc_group1 = 'Y'.
APPEND l_i.
l_ix-itm_number = '000010'.
l_ix-updateflag = 'U'.
l_ix-prc_group1 = 'X'.
APPEND l_ix.
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
salesdocument = l_vbeln
ORDER_HEADER_IN =
order_header_inx = l_hx
SIMULATION =
BEHAVE_WHEN_ERROR = ' '
INT_NUMBER_ASSIGNMENT = ' '
LOGIC_SWITCH =
NO_STATUS_BUF_INIT = ' '
TABLES
return = l_r
order_item_in = l_i
order_item_inx = l_ix
PARTNERS =
PARTNERCHANGES =
PARTNERADDRESSES =
ORDER_CFGS_REF =
ORDER_CFGS_INST =
ORDER_CFGS_PART_OF =
ORDER_CFGS_VALUE =
ORDER_CFGS_BLOB =
ORDER_CFGS_VK =
ORDER_CFGS_REFINST =
SCHEDULE_LINES =
SCHEDULE_LINESX =
ORDER_TEXT =
ORDER_KEYS =
CONDITIONS_IN =
CONDITIONS_INX =
EXTENSIONIN =
NFMETALLITMS =
.
LOOP AT l_r.
IF l_r-type <> 'S'.
l_success = 'N'.
EXIT.
ENDIF.
CLEAR l_r.
ENDLOOP.
IF l_success = 'Y'.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT =
IMPORTING
RETURN =
.
WRITE: / 'Update successful'.
ELSE.
WRITE: / 'Update fail'.
ENDIF.
‎2011 Dec 20 10:05 AM
Hi,
You need to declare I_hx of type BAPISDH1X.Also update indicator should be 'U' for update and 'I' for insert.
Thanks and Regards,
Sriranjani Chimakurthy.
‎2011 Dec 20 10:37 AM
Hi,
Which filed you want to change keep as X in and update with U with new value.
Regards,
Madhu.