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 Message from BAPI_REQUISITION_CHANGE

Arun_Prabhu_K
Active Contributor
0 Likes
1,600

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.

11 REPLIES 11
Read only

Former Member
0 Likes
1,518

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

Read only

0 Likes
1,518

The PR has only one item.

EBAN-MENGE for that PR item is 1.

Yes, I want to change an existing PR.

Read only

0 Likes
1,518

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.

Read only

0 Likes
1,518

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.

Read only

0 Likes
1,518

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.

Read only

Former Member
0 Likes
1,518

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.

Read only

Arun_Prabhu_K
Active Contributor
0 Likes
1,518

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.

Read only

0 Likes
1,518

Similiar scenario works correctly for me. Can you paste relevant portion of the Code where you are populating the NEW & OLD structures ?

Read only

Arun_Prabhu_K
Active Contributor
0 Likes
1,518

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.

Read only

0 Likes
1,518

Code seems to be OK. Check for SAP Notes 739004 & 796973.

Read only

0 Likes
1,518

Really Help full