Application Development 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: 

Cancel Confirmation Qty in Schedule Line (VBEP-BMENG)

Former Member
0 Kudos
1,916

How is the best way to cancel a confirmation in a schedule through a ABAP Program?

For example in the image attached the second line (000010-0002) should be 5 instead of 15.

I tried the approach bellow (snippet)

  it_extensionin     LIKE bapiparex   OCCURS 0 WITH HEADER LINE,
  is_bape_vbep       TYPE bape_vbep,
  is_bape_vbepx      TYPE bape_vbepx.

....

is_bape_vbep-vbeln = gs_vbap-vbeln.
is_bape_vbep-posnr = gs_vbep-posnr.
is_bape_vbep-etenr = gs_vbep-etenr.

if gs_vbep-vsmng gt 0.
     is_bape_vbep-bmeng = gs_vbep-vsmng.       * filled by RV_SCHEDULE_CHECK_DELIVERIES

else

     is_bape_vbep-bmeng = 0.
endif.
MOVE is_bape_vbep TO it_extensionin-valuepart1.
APPEND it_extensionin. CLEAR it_extensionin.
....

CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
             EXPORTING
               salesdocument    = gw_salesdocument
               order_header_inx = gs_orderheaderx
             TABLES
               return           = gt_return2
               order_item_in    = gt_orderitem
               order_item_inx   = gt_orderitemx
               schedule_lines   = gt_schedule_lines
               schedule_linesx  = gt_schedule_linesx
               extensionin      = it_extensionin.

....

But the gt_return2 says "Field 'BMENG' cannot be changed, VBEPKOM 000010 0002 ready for input".



Thanks in advance.


1 ACCEPTED SOLUTION

former_member223981
Active Contributor
0 Kudos
435

Hi Andre,

Why should BMENG for the 2nd schedule line = 5? You have an order quantity = 20. Schedule line 1 has a confirmed quantity = 5. So it seems logical that the 2nd schedule line should have a confirmed quantity = 15.....

You can also use transaction CO06 to manually change the value of VBEP-BMENG for a schedule line rather than creating a Z program to do it.

Hope this helps.

5 REPLIES 5

former_member223981
Active Contributor
0 Kudos
436

Hi Andre,

Why should BMENG for the 2nd schedule line = 5? You have an order quantity = 20. Schedule line 1 has a confirmed quantity = 5. So it seems logical that the 2nd schedule line should have a confirmed quantity = 15.....

You can also use transaction CO06 to manually change the value of VBEP-BMENG for a schedule line rather than creating a Z program to do it.

Hope this helps.

0 Kudos
435

Thanks for replying, bmeng "should" be 5 because the purpose of the program is to Cancel the Confirmation leaving 20 ordered and only 10 confirmed (already delivered).

AFAIK Confirmed quantity can't be changed using CO06, obviously I want to process many orders per run.

Regards.

0 Kudos
435

Just for future reference CO06 was one step in the right direction, debugging the transaction i was able to find the function SD_BACKORDER_UPDATE that can be used to update the schedule lines

Regards.

Former Member
0 Kudos
435

Hi,

Use the Reason for rejection for confirmation cancel.

Please check the VBAP-ABGRU field.

for that you can also Use the BAPI_SALESORDER_CHANGE.


Regards,

Abdul Rahim

0 Kudos
435

Thanks for replying, I don't want to reject the item just remove the confirmation. Just to be more clear we use APO here and this program will only be used in case of the system unavailability.