Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Error when using CHANGE_SALESORDER_BAPI to update delivery date

Former Member
0 Likes
960

I'm recieving an error when using change_salesorder_bapi. My intent is to change the delivery date on a schedule line where the delco input from the user is larger than what is currently on the schedule line.

The following are the specifics of the message:

Type: E

ID: V1

Number: 322

Message: Incorrect index structure for table IVBEP1

There are 2 prior messages in the return table. The first says that ORDER_HEADER_IN has posted successfully. The second says that the ITEM_IN has posted successfully.

A snippet of my code:

LOOP AT line_item INTO wa_line_item.

IF wa_line_item-delco < p$delco.

wa_order_item_in-itm_number = wa_line_item-posnr.

wa_order_item_in-dlv_time = p$delco.

wa_order_item_inx-itm_number = wa_line_item-posnr.

wa_order_item_inx-updateflag = 'U'.

wa_order_item_inx-dlv_time = 'X'.

APPEND wa_order_item_in to i_order_item_in.

APPEND wa_order_item_inx to i_order_item_inx.

ENDIF.

ENDLOOP.

CALL FUNCTION 'BAPI_SALESORDER_CHANGE'

EXPORTING

salesdocument = p$vbeln

ORDER_HEADER_IN = wa_order_header_in

order_header_inx = wa_order_header_inx

tables

return = i_return

ORDER_ITEM_IN = i_order_item_in

ORDER_ITEM_INX = i_order_item_inx

After the Bapi call I also call BAPI_TRANSACTION_COMMIT. The messages I have listed come before the commit bapi is called. What am I missing? The schedule line is not changed.

Thanks,

Chris

1 ACCEPTED SOLUTION
Read only

former_member194669
Active Contributor
0 Likes
829

Welcome to SDN

Can you please check SAP note 693551 ( May it will be helpful)

I'm recieving an error when using change_salesorder_bapi. My intent is to change the delivery date on a schedule line where the delco input from the user is larger than what is currently on the schedule line.

The following are the specifics of the message:

Type: E

ID: V1

Number: 322

Message: Incorrect index structure for table IVBEP1

There are 2 prior messages in the return table. The first says that ORDER_HEADER_IN has posted successfully. The second says that the ITEM_IN has posted successfully.

A snippet of my code:

LOOP AT line_item INTO wa_line_item.

IF wa_line_item-delco < p$delco.

wa_order_item_in-itm_number = wa_line_item-posnr.

wa_order_item_in-dlv_time = p$delco.

wa_order_item_inx-itm_number = wa_line_item-posnr.

wa_order_item_inx-updateflag = 'U'.

wa_order_item_inx-dlv_time = 'X'.

APPEND wa_order_item_in to i_order_item_in.

APPEND wa_order_item_inx to i_order_item_inx.

ENDIF.

ENDLOOP.

CALL FUNCTION 'BAPI_SALESORDER_CHANGE'

EXPORTING

salesdocument = p$vbeln

ORDER_HEADER_IN = wa_order_header_in

order_header_inx = wa_order_header_inx

tables

return = i_return

ORDER_ITEM_IN = i_order_item_in

ORDER_ITEM_INX = i_order_item_inx

After the Bapi call I also call BAPI_TRANSACTION_COMMIT. The messages I have listed come before the commit bapi is called. What am I missing? The schedule line is not changed.

Thanks,

Chris

3 REPLIES 3
Read only

former_member194669
Active Contributor
0 Likes
830

Welcome to SDN

Can you please check SAP note 693551 ( May it will be helpful)

Read only

0 Likes
829

The note mentioned has already been applied to our system.

I know the error is occuring before the commit. Where can I find documentation on what is needed to be passed to the bapi? I've looked at the documentation in the Bapi Explorer for this particular bapi and I'm not finding anything else that needs to be passed.

If I go to VA02 and change the field on the line item manually everything works fine. However writing a program that calls the bapi to do the same thing fails. My guess is that SAP is doing something in the background that the bapi isn't... I just can't figure out what it is or what I'm missing.

Read only

Former Member
0 Likes
829

I can answer this to some extent.

"What am I missing? The schedule line is not changed. "

Yes, You schedule line is not changed becoz you are getting error even before BAPI_COMMIT is processed.

Records are actually saved only after the BAPI_COMMIT is used.

I can say the error occured during the data is passed to Change_bapi. Either not all data is passed or ....please check the structure of that table.

also please check the BAPi return structure and see the ID of that message. Probably you might get some catch

thanks.

Edited by: Alchemi on Mar 6, 2008 11:24 AM