Skip to Content
0
Former Member
May 22, 2014 at 06:03 PM

Cancel Confirmation Qty in Schedule Line (VBEP-BMENG)

990 Views

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.


Attachments

vbep.PNG (5.0 kB)