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

Problem with BAPI BAPI_PR_CHANGE

Former Member
0 Likes
1,054

I use the code attached and then I explain the problem:

DATA: wa_pritem LIKE bapimereqitemimp,

wa_pritemx LIKE bapimereqitemx,

wa_praccount LIKE bapimereqaccount,

wa_praccountx LIKE bapimereqaccountx.

DATA: BEGIN OF it_pritemx OCCURS 0.

INCLUDE STRUCTURE bapimereqitemx.

DATA: END OF it_pritemx.

DATA: BEGIN OF it_pritem OCCURS 0.

INCLUDE STRUCTURE bapimereqitemimp.

DATA: END OF it_pritem.

DATA: BEGIN OF it_praccount OCCURS 0.

INCLUDE STRUCTURE bapimereqaccount.

DATA: END OF it_praccount.

DATA: BEGIN OF it_praccountx OCCURS 0.

INCLUDE STRUCTURE bapimereqaccountx.

DATA: END OF it_praccountx.

DATA: BEGIN OF it_change_return OCCURS 0.

INCLUDE STRUCTURE bapiret2.

DATA: END OF it_change_return.

"Asignar nuevos datos a la posicion

wa_pritem-preq_item = '00010'. "Item Number of Purchase Requisition

wa_pritem-quantity = 14. "Purchase Requisition Quantity

wa_pritem-PRICE_UNIT = 14.

wa_pritem-rel_date = '20101212'.

wa_pritem-short_text = 'TXT BAPI .NET 12'.

wa_pritem-acctasscat = 'P'.

wa_pritem-plant = '001'.

wa_pritem-deliv_date = '20101212'.

wa_pritem-pur_group = '01'.

wa_pritem-unit = 'ST'.

wa_pritem-matl_group = '01'.

wa_pritem-preq_name = 'vlg 12'.

wa_pritem-req_blocked = '1'.

wa_pritem-reason_blocking = 'bloque 12'.

"Indicar que cambios son los que se deben ejecutar

wa_pritemx-preq_item = '00010'.

wa_pritemx-quantity = 'X'.

wa_pritemx-PRICE_UNIT = 'X'.

wa_pritemx-short_text = 'X'.

wa_pritemx-acctasscat = 'X'.

wa_pritemx-plant = 'X'.

wa_pritemx-deliv_date = 'X'.

wa_pritemx-pur_group = 'X'.

wa_pritemx-unit = 'X'.

wa_pritemx-matl_group = 'X'.

wa_pritemx-preq_name = 'X'.

wa_pritemx-req_blocked = 'X'.

wa_pritemx-reason_blocking = 'X'.

"Asignar nuevos datos a la posicion de imputacion

wa_praccount-preq_item = '00010'.

wa_praccount-quantity = 14.

wa_praccount-gl_account = '0000000000'.

  • wa_praccount-co_area = 'CTC'.

wa_praccount-wbs_element = 'PARCEL'.

  • wa_praccount-HKONT = ''.

"Indicar que cambios son los que se deben ejecutar

wa_praccountx-preq_item = '00010'.

wa_praccountx-quantity = 'X'.

wa_praccountx-gl_account = 'X'.

  • wa_praccountx-co_area = 'X'.

wa_praccountx-wbs_element = 'X'.

APPEND wa_pritemx TO it_pritemx.

APPEND wa_pritem TO it_pritem.

APPEND wa_praccount TO it_praccount.

APPEND wa_praccountx TO it_praccountx.

data lv_banfn type bapimereqheader-preq_no value '0100000267'.

CALL FUNCTION 'BAPI_PR_CHANGE'

EXPORTING

number = lv_banfn

  • PRHEADER =

  • PRHEADERX =

  • TESTRUN =

  • IMPORTING

  • PRHEADEREXP =

TABLES

return = it_change_return

pritem = it_pritem

pritemx = it_pritemx

  • PRITEMEXP =

  • PRITEMSOURCE =

praccount = it_praccount

  • PRACCOUNTPROITSEGMENT =

praccountx = it_praccountx

  • PRADDRDELIVERY =

  • PRITEMTEXT =

  • PRHEADERTEXT =

  • EXTENSIONIN =

  • EXTENSIONOUT =

  • PRVERSION =

  • PRVERSIONX =

  • ALLVERSIONS =

.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

  • EXPORTING

  • WAIT =

  • IMPORTING

  • RETURN =

.

returns the next error:

**Sum of quantities >28.000< larger than total quantity

Anyone know how to solve this case

Thanks

4 REPLIES 4
Read only

Former Member
0 Likes
737

You aren't changing the total quantity in the header. What is the current total quantity in PR 0100000267 ?

Rob

Read only

0 Likes
737

thanks for attention

The total number is 14,

How I can change the amount of the header?

Thanks

Read only

0 Likes
737

What is the messagte number and class of the error you are getting?

Rob

Read only

0 Likes
737

Type: E

ID: 06

Number: 411

Message: La suma de las cantidades >28.000< es mayor que la cantidad total

Message_V1: 28

Parameter: PRITEM

Row: 1

Field: MKNTM

thanks for the attention