‎2011 Mar 23 5:57 AM
Hi Guys.
I am getting an error message Sum of quantities >2< larger than total quantity.I saw some related threads from this forum.But not conclusive.
This error is from
CALL FUNCTION 'BAPI_REQUISITION_CHANGE'
EXPORTING
number = prno
TABLES
requisition_items_old = i_bapieban_old
requisition_items_new = i_bapieban_new
return = i_bapireturn.
The Quantity in both i_bapieban_old and in i_bapieban_new is 1.
The PR has only one quantity.
I would like to know why this error arises.
Thanks in advance.
‎2011 Mar 23 6:06 AM
Hi,
what's the quantity in database table EBAN for all lines of requisition (look at field MENGE)? You want to change an existing requisition!
Regards,
Klaus
Edited by: Klaus Babl on Mar 23, 2011 7:06 AM
‎2011 Mar 23 6:16 AM
The PR has only one item.
EBAN-MENGE for that PR item is 1.
Yes, I want to change an existing PR.
‎2011 Mar 23 7:56 AM
Hi,
I suggest to use BAPI_PR_CHANGE function to change PR.
Just pass new value to the field you want to change in PRITEM table and for same field pass "X" value in PRITEMX table.
‎2011 Mar 23 8:37 AM
I am using only BAPI_REQUISITION_GETDETAIL to fetch the PR data.Using that I populate REQUISITION_ITEMS_OLD & NEW.
Then I use BAPI_REQUISITION_CHANGE.
‎2011 Mar 23 9:12 AM
Which field value is being changed during the BAPI call ? I tested the BAPI which works correctly even when the quantity field is same in OLD and NEW Structures.
‎2011 Mar 23 8:14 AM
Check the way you are populating the data in REQUISITION_ITEMS_OLD & NEW. Extract the existing data using bapi BAPI_REQUISITION_GETDETAIL and use its output for populating data to BAPI_REQUISITION_CHANGE.
See the standard function module MASS_CHANGE_PURCHASE_REQ (Line number 37 to 87 ) for reference.
‎2011 Mar 23 9:31 AM
The current problematic case has same quantity in both old and new structures (Value = 1).
I am intending to change the quantity field and short_text in PR.
‎2011 Mar 23 10:24 AM
Similiar scenario works correctly for me. Can you paste relevant portion of the Code where you are populating the NEW & OLD structures ?
‎2011 Mar 23 10:28 AM
CALL FUNCTION 'BAPI_REQUISITION_GETDETAIL'
EXPORTING
number = prno
TABLES
requisition_items = i_bapieban
return = i_bapireturn.
READ TABLE i_bapieban WITH KEY preq_no = prno
preq_item = itab-bnfpo.
IF sy-subrc = 0.
MOVE-CORRESPONDING i_bapieban TO i_bapieban_old.
MOVE-CORRESPONDING i_bapieban TO i_bapieban_new.
i_bapieban_new-quantity = itab-clqty.
i_bapieban_new-short_text = itab-txz01.
APPEND i_bapieban_old.
APPEND i_bapieban_new.
CALL FUNCTION 'BAPI_REQUISITION_CHANGE'
EXPORTING
number = prno
TABLES
requisition_items_old = i_bapieban_old
requisition_items_new = i_bapieban_new
return = i_bapireturn.
‎2011 Mar 23 10:52 AM
‎2013 Jul 01 7:15 AM