3 weeks ago - last edited 3 weeks ago
Hi.
I have this piece of code
DATA: LD_VBELN TYPE VBELN, " Document number
LS_BAPISDH1 TYPE BAPISDH1, " Contract header data
LS_BAPISDH1X TYPE BAPISDH1X, " Contract header data (change flag)
LT_BAPISDITM TYPE TABLE OF BAPISDITM WITH HEADER LINE, " Contract item data
LT_BAPISDITMX TYPE TABLE OF BAPISDITMX WITH HEADER LINE, " Contract item data (change flag)
lt_return TYPE TABLE OF bapiret2,
ls_return TYPE bapiret2.
LD_VBELN = gv_ekko-ebeln. "document number
LS_BAPISDH1X-UPDATEFLAG = 'U'.
LT_BAPISDITM-ITM_NUMBER = '000010'.
LT_BAPISDITM-PMNTTRMS = ''. "Clear Payment terms
APPEND LT_BAPISDITM.
CLEAR LT_BAPISDITM.
LT_BAPISDITMX-ITM_NUMBER = '000010'.
LT_BAPISDITMX-UPDATEFLAG = 'U'.
LT_BAPISDITMX-PMNTTRMS = 'X'.
APPEND LT_BAPISDITMX.
CLEAR LT_BAPISDITMX.
" BAPI call to update the customer material number in the sales order
CALL FUNCTION 'BAPI_CUSTOMERCONTRACT_CHANGE'
EXPORTING
SALESDOCUMENT = LD_VBELN
CONTRACT_HEADER_IN = LS_BAPISDH1
CONTRACT_HEADER_INX = LS_BAPISDH1X
TABLES
RETURN = LT_RETURN
CONTRACT_ITEM_IN = LT_BAPISDITM
CONTRACT_ITEM_INX = LT_BAPISDITMX.
" BAPI to commit the sales order update in the database
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'.
LOOP AT lt_return INTO ls_return.
WRITE: / ls_return-type, ls_return-message.
ENDLOOP.
But I'm getting this error
"E SD document XYZ is not in the database or has been archived"
The ekko and ekpo lines exists.
Any idea?
It seems you are using a SD contract BAPI (VA42) to update a MM purchase contract (ME32K) ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi.
Explaining.
I have the document number that cames from EKKO / EKPO table (ebeln).
What do you suggest to update the contract info (in this case the Terms of Payment)?
I have this:
lv_contract_no = gv_ekko-ebeln. " Contract number
l_HEADER-pmnttrms = ''. " New payment term value
l_HEADERX-pmnttrms = 'X'. " Mark field for update
* PMNTTRMS
" Update payment terms
CALL FUNCTION 'BAPI_CONTRACT_CHANGE'
EXPORTING
PURCHASINGDOCUMENT = lv_contract_no
HEADER = l_HEADER
HEADERX = l_HEADERX
TABLES
return = lt_return.
But I'm getting this
Any idea, what I'm doing wrong?!?!?!
Thanks in advance.
Marco
Which kind of PO document are you trying to change (there are different BAPIs)
Value of EKKO-BSTYP is
Lower Value | Short Description | Transaction | BAPI |
A | Request for Quotation | ME43 | |
F | Purchase Order | ME23N | BAPI_PO_CHANGE |
K | Contract | ME33K | BAPI_CONTRACT_CHANGE |
L | Scheduling Agreement | ME33L | BAPI_SAG_CHANGE |
R | RFQ | ||
O | Quotation | ||
C | Central Contract | ||
P | Central Purchsae Order | ||
N | Central Request for Quotation | ||
T | Central Supplier Quotation |
User | Count |
---|---|
96 | |
8 | |
7 | |
5 | |
5 | |
4 | |
3 | |
3 | |
2 | |
2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.